TGLAnnotation.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TGLAnnotation.h 36946 2010-11-25 15:29:03Z matevz $
00002 // Author:  Matevz and Alja Tadel  20/02/2009
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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&);            // Not implemented
00029    TGLAnnotation& operator=(const TGLAnnotation&); // Not implemented
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;           // x position [0, 1]
00039    Float_t           fPosY;           // y position [0, 1]
00040    Float_t           fWidth;
00041    Float_t           fHeight;
00042 
00043    Int_t             fMouseX, fMouseY; //! last mouse position
00044    EDrag             fDrag;            //!
00045    Float_t           fDrawW,  fDrawH;  //! width and height when drawing
00046    Float_t           fTextSizeDrag;    //! text-size at start of drag
00047 
00048    TGLVector3        fPointer;         // picked location in 3D space
00049    Bool_t            fActive;          // active item identifier
00050 
00051    TGMainFrame      *fMainFrame;       // editors
00052    TGTextEdit       *fTextEdit;        // editors
00053 
00054    static Color_t    fgBackColor;
00055    static Color_t    fgTextColor;
00056 
00057    TGLViewer        *fParent;
00058 
00059    TString           fText;           // annotation text
00060    Float_t           fTextSize;       // relative font size
00061    TGLFont           fFont;           // font used to render labels
00062    TGLFont           fMenuFont;       // font used to render menu buttons
00063    TGLFont::ETextAlignH_e fTextAlign;
00064 
00065    Color_t           fBackColor;      // background color
00066    Color_t           fTextColor;      // text color
00067    Char_t            fTransparency;   // transparency of background
00068 
00069    Bool_t            fDrawRefLine;    // draw 3D refrence line
00070    Bool_t            fUseColorSet;    // use color set from rnrCtx
00071    Bool_t            fAllowClose;     // allow closing via 'X' button
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); // GL-annotation.
00114 };
00115 
00116 #endif

Generated on Tue Jul 5 14:16:42 2011 for ROOT_528-00b_version by  doxygen 1.5.1