#ifndef ROOT_TGLAnnotation
#define ROOT_TGLAnnotation
#include "TGLOverlay.h"
#include "TGLUtil.h"
#include "TGLFontManager.h"
class TGLViewer;
class TGLViewerBase;
class TGLFont;
class TGTextEdit;
class TGMainFrame;
class TGLAnnotation : public TGLOverlayElement
{
private:
TGLAnnotation(const TGLAnnotation&);
TGLAnnotation& operator=(const TGLAnnotation&);
protected:
enum EDrag { kMove, kResize, kNone };
enum ENameStack { kMoveID, kEditID, kDeleteID, kResizeID };
void MakeEditor();
Char_t GetLineTransparency() const;
Float_t fPosX;
Float_t fPosY;
Float_t fWidth;
Float_t fHeight;
Int_t fMouseX, fMouseY;
EDrag fDrag;
Float_t fDrawW, fDrawH;
Float_t fTextSizeDrag;
TGLVector3 fPointer;
Bool_t fActive;
TGMainFrame *fMainFrame;
TGTextEdit *fTextEdit;
static Color_t fgBackColor;
static Color_t fgTextColor;
TGLViewer *fParent;
TString fText;
Float_t fTextSize;
TGLFont fFont;
TGLFont fMenuFont;
TGLFont::ETextAlignH_e fTextAlign;
Color_t fBackColor;
Color_t fTextColor;
Char_t fTransparency;
Bool_t fDrawRefLine;
Bool_t fUseColorSet;
Bool_t fAllowClose;
public:
TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy);
TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy, TGLVector3 ref);
virtual ~TGLAnnotation();
void SetText(const TString& x) { fText = x; }
const TString& GetText() const { return fText; }
void SetTransparency(Char_t x) { fTransparency = x; }
Char_t GetTransparency() const { return fTransparency; }
void SetUseColorSet(Bool_t x) { fUseColorSet = x; }
Bool_t GetUseColorSet() const { return fUseColorSet; }
void SetBackColor(Color_t x) { fBackColor = x; }
Color_t GetBackColor() const { return fBackColor; }
void SetTextColor(Color_t x) { fTextColor = x; }
Color_t GetTextColor() const { return fTextColor; }
void SetTextSize(Float_t x) { fTextSize = x; }
Float_t GetTextSize() const { return fTextSize; }
void SetAllowClose(Bool_t x) { fAllowClose = x; }
Bool_t GetAllowClose() const { return fAllowClose; }
TGLFont::ETextAlignH_e GetTextAlign() const { return fTextAlign; }
void SetTextAlign(TGLFont::ETextAlignH_e a) { fTextAlign = a; }
virtual Bool_t MouseEnter(TGLOvlSelectRecord& selRec);
virtual Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec,
Event_t* event);
virtual void MouseLeave();
void CloseEditor();
void UpdateText();
virtual void Render(TGLRnrCtx& rnrCtx);
ClassDef(TGLAnnotation, 0);
};
#endif