Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGLAnnotation.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gl:$Id$
0002 // Author:  Matevz and Alja Tadel  20/02/2009
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGLAnnotation
0013 #define ROOT_TGLAnnotation
0014 
0015 #include "TGLOverlay.h"
0016 #include "TGLUtil.h"
0017 #include "TGLFontManager.h"
0018 
0019 class TGLViewer;
0020 class TGLViewerBase;
0021 class TGLFont;
0022 class TGTextEdit;
0023 class TGMainFrame;
0024 
0025 class TGLAnnotation : public TGLOverlayElement
0026 {
0027 private:
0028    TGLAnnotation(const TGLAnnotation&) = delete;
0029    TGLAnnotation& operator=(const TGLAnnotation&) = delete;
0030 
0031 protected:
0032    enum EDrag        { kMove, kResize, kNone };
0033    enum ENameStack   { kMoveID, kEditID, kDeleteID, kResizeID };
0034 
0035    void MakeEditor();
0036    Char_t GetLineTransparency() const;
0037 
0038    Float_t           fPosX;           // x position [0, 1]
0039    Float_t           fPosY;           // y position [0, 1]
0040    Float_t           fWidth;
0041    Float_t           fHeight;
0042 
0043    Int_t             fMouseX, fMouseY; //! last mouse position
0044    EDrag             fDrag;            //!
0045    Float_t           fDrawW,  fDrawH;  //! width and height when drawing
0046    Float_t           fTextSizeDrag;    //! text-size at start of drag
0047 
0048    TGLVector3        fPointer;         // picked location in 3D space
0049    Bool_t            fActive;          // active item identifier
0050 
0051    TGMainFrame      *fMainFrame;       // editors
0052    TGTextEdit       *fTextEdit;        // editors
0053 
0054    static Color_t    fgBackColor;
0055    static Color_t    fgTextColor;
0056 
0057    TGLViewer        *fParent;
0058 
0059    TString           fText;           // annotation text
0060    Float_t           fTextSize;       // relative font size
0061    TGLFont           fFont;           // font used to render labels
0062    TGLFont           fMenuFont;       // font used to render menu buttons
0063    TGLFont::ETextAlignH_e fTextAlign;
0064 
0065    Color_t           fBackColor;      // background color
0066    Color_t           fTextColor;      // text color
0067    Char_t            fTransparency;   // transparency of background
0068 
0069    Bool_t            fDrawRefLine;    // draw 3D refrence line
0070    Bool_t            fUseColorSet;    // use color set from rnrCtx
0071    Bool_t            fAllowClose;     // allow closing via 'X' button
0072 
0073 public:
0074    TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy);
0075    TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy, TGLVector3 ref);
0076    ~TGLAnnotation() override;
0077 
0078    void  SetText(const TString& x)   { fText = x; }
0079    const TString& GetText()    const { return fText; }
0080 
0081    void    SetTransparency(Char_t x) { fTransparency = x; }
0082    Char_t  GetTransparency()   const { return fTransparency; }
0083 
0084    void    SetUseColorSet(Bool_t x)  { fUseColorSet = x; }
0085    Bool_t  GetUseColorSet()    const { return fUseColorSet; }
0086 
0087    void    SetBackColor(Color_t x)   { fBackColor = x; }
0088    Color_t GetBackColor()      const { return fBackColor; }
0089 
0090    void    SetTextColor(Color_t x)   { fTextColor = x; }
0091    Color_t GetTextColor()      const { return fTextColor; }
0092 
0093    void    SetTextSize(Float_t x)    { fTextSize = x; }
0094    Float_t GetTextSize()       const { return fTextSize; }
0095 
0096    void    SetAllowClose(Bool_t x)   { fAllowClose = x; }
0097    Bool_t  GetAllowClose()     const { return fAllowClose; }
0098 
0099    TGLFont::ETextAlignH_e GetTextAlign() const { return fTextAlign; }
0100    void SetTextAlign(TGLFont::ETextAlignH_e a) { fTextAlign = a; }
0101 
0102    Bool_t MouseEnter(TGLOvlSelectRecord& selRec) override;
0103    Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec,
0104                          Event_t* event) override;
0105    void   MouseLeave() override;
0106 
0107    void CloseEditor();
0108 
0109    void UpdateText();
0110 
0111    void   Render(TGLRnrCtx& rnrCtx) override;
0112 
0113    ClassDefOverride(TGLAnnotation, 0); // GL-annotation.
0114 };
0115 
0116 #endif