00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGLAnnotation
00013 #define ROOT_TGLAnnotation
00014
00015 #include "TGLOverlay.h"
00016 #include "TGLUtil.h"
00017 #include "TGLFontManager.h"
00018
00019 class TGLViewer;
00020 class TGLViewerBase;
00021 class TGLFont;
00022 class TGTextEdit;
00023 class TGMainFrame;
00024
00025 class TGLAnnotation : public TGLOverlayElement
00026 {
00027 private:
00028 TGLAnnotation(const TGLAnnotation&);
00029 TGLAnnotation& operator=(const TGLAnnotation&);
00030
00031 protected:
00032 enum EDrag { kMove, kResize, kNone };
00033 enum ENameStack { kMoveID, kEditID, kDeleteID, kResizeID };
00034
00035 void MakeEditor();
00036 Char_t GetLineTransparency() const;
00037
00038 Float_t fPosX;
00039 Float_t fPosY;
00040 Float_t fWidth;
00041 Float_t fHeight;
00042
00043 Int_t fMouseX, fMouseY;
00044 EDrag fDrag;
00045 Float_t fDrawW, fDrawH;
00046 Float_t fTextSizeDrag;
00047
00048 TGLVector3 fPointer;
00049 Bool_t fActive;
00050
00051 TGMainFrame *fMainFrame;
00052 TGTextEdit *fTextEdit;
00053
00054 static Color_t fgBackColor;
00055 static Color_t fgTextColor;
00056
00057 TGLViewer *fParent;
00058
00059 TString fText;
00060 Float_t fTextSize;
00061 TGLFont fFont;
00062 TGLFont fMenuFont;
00063 TGLFont::ETextAlignH_e fTextAlign;
00064
00065 Color_t fBackColor;
00066 Color_t fTextColor;
00067 Char_t fTransparency;
00068
00069 Bool_t fDrawRefLine;
00070 Bool_t fUseColorSet;
00071 Bool_t fAllowClose;
00072
00073 public:
00074 TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy);
00075 TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy, TGLVector3 ref);
00076 virtual ~TGLAnnotation();
00077
00078 void SetText(const TString& x) { fText = x; }
00079 const TString& GetText() const { return fText; }
00080
00081 void SetTransparency(Char_t x) { fTransparency = x; }
00082 Char_t GetTransparency() const { return fTransparency; }
00083
00084 void SetUseColorSet(Bool_t x) { fUseColorSet = x; }
00085 Bool_t GetUseColorSet() const { return fUseColorSet; }
00086
00087 void SetBackColor(Color_t x) { fBackColor = x; }
00088 Color_t GetBackColor() const { return fBackColor; }
00089
00090 void SetTextColor(Color_t x) { fTextColor = x; }
00091 Color_t GetTextColor() const { return fTextColor; }
00092
00093 void SetTextSize(Float_t x) { fTextSize = x; }
00094 Float_t GetTextSize() const { return fTextSize; }
00095
00096 void SetAllowClose(Bool_t x) { fAllowClose = x; }
00097 Bool_t GetAllowClose() const { return fAllowClose; }
00098
00099 TGLFont::ETextAlignH_e GetTextAlign() const { return fTextAlign; }
00100 void SetTextAlign(TGLFont::ETextAlignH_e a) { fTextAlign = a; }
00101
00102 virtual Bool_t MouseEnter(TGLOvlSelectRecord& selRec);
00103 virtual Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec,
00104 Event_t* event);
00105 virtual void MouseLeave();
00106
00107 void CloseEditor();
00108
00109 void UpdateText();
00110
00111 virtual void Render(TGLRnrCtx& rnrCtx);
00112
00113 ClassDef(TGLAnnotation, 0);
00114 };
00115
00116 #endif