Logo ROOT   6.14/05
Reference Guide
TGLAnnotation.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz and Alja Tadel 20/02/2009
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGLAnnotation
13 #define ROOT_TGLAnnotation
14 
15 #include "TGLOverlay.h"
16 #include "TGLUtil.h"
17 #include "TGLFontManager.h"
18 
19 class TGLViewer;
20 class TGLViewerBase;
21 class TGLFont;
22 class TGTextEdit;
23 class TGMainFrame;
24 
26 {
27 private:
28  TGLAnnotation(const TGLAnnotation&); // Not implemented
29  TGLAnnotation& operator=(const TGLAnnotation&); // Not implemented
30 
31 protected:
32  enum EDrag { kMove, kResize, kNone };
34 
35  void MakeEditor();
37 
38  Float_t fPosX; // x position [0, 1]
39  Float_t fPosY; // y position [0, 1]
42 
43  Int_t fMouseX, fMouseY; //! last mouse position
44  EDrag fDrag; //!
45  Float_t fDrawW, fDrawH; //! width and height when drawing
46  Float_t fTextSizeDrag; //! text-size at start of drag
47 
48  TGLVector3 fPointer; // picked location in 3D space
49  Bool_t fActive; // active item identifier
50 
51  TGMainFrame *fMainFrame; // editors
52  TGTextEdit *fTextEdit; // editors
53 
56 
58 
59  TString fText; // annotation text
60  Float_t fTextSize; // relative font size
61  TGLFont fFont; // font used to render labels
62  TGLFont fMenuFont; // font used to render menu buttons
64 
65  Color_t fBackColor; // background color
66  Color_t fTextColor; // text color
67  Char_t fTransparency; // transparency of background
68 
69  Bool_t fDrawRefLine; // draw 3D refrence line
70  Bool_t fUseColorSet; // use color set from rnrCtx
71  Bool_t fAllowClose; // allow closing via 'X' button
72 
73 public:
74  TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy);
75  TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy, TGLVector3 ref);
76  virtual ~TGLAnnotation();
77 
78  void SetText(const TString& x) { fText = x; }
79  const TString& GetText() const { return fText; }
80 
81  void SetTransparency(Char_t x) { fTransparency = x; }
82  Char_t GetTransparency() const { return fTransparency; }
83 
84  void SetUseColorSet(Bool_t x) { fUseColorSet = x; }
85  Bool_t GetUseColorSet() const { return fUseColorSet; }
86 
87  void SetBackColor(Color_t x) { fBackColor = x; }
88  Color_t GetBackColor() const { return fBackColor; }
89 
90  void SetTextColor(Color_t x) { fTextColor = x; }
91  Color_t GetTextColor() const { return fTextColor; }
92 
93  void SetTextSize(Float_t x) { fTextSize = x; }
94  Float_t GetTextSize() const { return fTextSize; }
95 
96  void SetAllowClose(Bool_t x) { fAllowClose = x; }
97  Bool_t GetAllowClose() const { return fAllowClose; }
98 
100  void SetTextAlign(TGLFont::ETextAlignH_e a) { fTextAlign = a; }
101 
102  virtual Bool_t MouseEnter(TGLOvlSelectRecord& selRec);
103  virtual Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec,
104  Event_t* event);
105  virtual void MouseLeave();
106 
107  void CloseEditor();
108 
109  void UpdateText();
110 
111  virtual void Render(TGLRnrCtx& rnrCtx);
112 
113  ClassDef(TGLAnnotation, 0); // GL-annotation.
114 };
115 
116 #endif
TGLViewer * fParent
Definition: TGLAnnotation.h:57
Color_t GetBackColor() const
Definition: TGLAnnotation.h:88
void SetAllowClose(Bool_t x)
Definition: TGLAnnotation.h:96
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:40
Bool_t GetAllowClose() const
Definition: TGLAnnotation.h:97
Float_t fDrawW
Definition: TGLAnnotation.h:45
float Float_t
Definition: RtypesCore.h:53
Float_t fTextSizeDrag
width and height when drawing
Definition: TGLAnnotation.h:46
TGLFont fMenuFont
Definition: TGLAnnotation.h:62
Float_t fHeight
Definition: TGLAnnotation.h:41
GL-overlay annotation.
Definition: TGLAnnotation.h:25
void CloseEditor()
Close the annotation editor.
Bool_t GetUseColorSet() const
Definition: TGLAnnotation.h:85
Basic string class.
Definition: TString.h:131
void SetTextColor(Color_t x)
Definition: TGLAnnotation.h:90
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void MouseLeave()
Mouse has left overlay area.
Bool_t fDrawRefLine
Definition: TGLAnnotation.h:69
An overlay element.
Definition: TGLOverlay.h:22
Base class for GL viewers.
Definition: TGLViewerBase.h:36
Float_t fWidth
Definition: TGLAnnotation.h:40
void SetTransparency(Char_t x)
Definition: TGLAnnotation.h:81
Double_t x[n]
Definition: legend1.C:17
void SetTextSize(Float_t x)
Definition: TGLAnnotation.h:93
#define ClassDef(name, id)
Definition: Rtypes.h:320
TGMainFrame * fMainFrame
Definition: TGLAnnotation.h:51
EDrag fDrag
last mouse position
Definition: TGLAnnotation.h:44
Bool_t fUseColorSet
Definition: TGLAnnotation.h:70
Bool_t fAllowClose
Definition: TGLAnnotation.h:71
void SetUseColorSet(Bool_t x)
Definition: TGLAnnotation.h:84
3 component (x/y/z) vector class.
Definition: TGLUtil.h:246
Color_t fTextColor
Definition: TGLAnnotation.h:66
Char_t GetTransparency() const
Definition: TGLAnnotation.h:82
short Color_t
Definition: RtypesCore.h:79
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
void SetTextAlign(TGLFont::ETextAlignH_e a)
TGLAnnotation(const TGLAnnotation &)
static Color_t fgTextColor
Definition: TGLAnnotation.h:55
auto * a
Definition: textangle.C:12
void SetText(const TString &x)
Definition: TGLAnnotation.h:78
TGLAnnotation & operator=(const TGLAnnotation &)
Float_t GetTextSize() const
Definition: TGLAnnotation.h:94
TGLVector3 fPointer
text-size at start of drag
Definition: TGLAnnotation.h:48
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:53
Char_t fTransparency
Definition: TGLAnnotation.h:67
Char_t GetLineTransparency() const
Returns transparency of annotation outline.
TGLFont::ETextAlignH_e GetTextAlign() const
Definition: TGLAnnotation.h:99
Float_t fDrawH
Definition: TGLAnnotation.h:45
TGLFont::ETextAlignH_e fTextAlign
Definition: TGLAnnotation.h:63
TText * text
Color_t GetTextColor() const
Definition: TGLAnnotation.h:91
char Char_t
Definition: RtypesCore.h:29
static Color_t fgBackColor
Definition: TGLAnnotation.h:54
Color_t fBackColor
Definition: TGLAnnotation.h:65
TGTextEdit * fTextEdit
Definition: TGLAnnotation.h:52
void UpdateText()
Modify the annotation text from the text-edit widget.
virtual void Render(TGLRnrCtx &rnrCtx)
Render the annotation.
void MakeEditor()
Show the annotation editor.
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered overlay area.
A wrapper class for FTFont.
Selection record for overlay objects.
Float_t fTextSize
Definition: TGLAnnotation.h:60
const TString & GetText() const
Definition: TGLAnnotation.h:79
void SetBackColor(Color_t x)
Definition: TGLAnnotation.h:87
virtual ~TGLAnnotation()
Destructor.