Logo ROOT   6.16/01
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
19class TGLViewer;
20class TGLViewerBase;
21class TGLFont;
22class TGTextEdit;
23class TGMainFrame;
24
26{
27private:
28 TGLAnnotation(const TGLAnnotation&); // Not implemented
29 TGLAnnotation& operator=(const TGLAnnotation&); // Not implemented
30
31protected:
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
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
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
73public:
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
83
86
88 Color_t GetBackColor() const { return fBackColor; }
89
91 Color_t GetTextColor() const { return fTextColor; }
92
94 Float_t GetTextSize() const { return fTextSize; }
95
97 Bool_t GetAllowClose() const { return fAllowClose; }
98
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
int Int_t
Definition: RtypesCore.h:41
char Char_t
Definition: RtypesCore.h:29
bool Bool_t
Definition: RtypesCore.h:59
short Color_t
Definition: RtypesCore.h:79
float Float_t
Definition: RtypesCore.h:53
#define ClassDef(name, id)
Definition: Rtypes.h:324
GL-overlay annotation.
Definition: TGLAnnotation.h:26
static Color_t fgBackColor
Definition: TGLAnnotation.h:54
TGLFont fMenuFont
Definition: TGLAnnotation.h:62
static Color_t fgTextColor
Definition: TGLAnnotation.h:55
TGMainFrame * fMainFrame
Definition: TGLAnnotation.h:51
void SetTextColor(Color_t x)
Definition: TGLAnnotation.h:90
Float_t fTextSize
Definition: TGLAnnotation.h:60
Bool_t fDrawRefLine
Definition: TGLAnnotation.h:69
void MakeEditor()
Show the annotation editor.
void UpdateText()
Modify the annotation text from the text-edit widget.
Color_t fTextColor
Definition: TGLAnnotation.h:66
void SetText(const TString &x)
Definition: TGLAnnotation.h:78
TGTextEdit * fTextEdit
Definition: TGLAnnotation.h:52
Float_t GetTextSize() const
Definition: TGLAnnotation.h:94
Color_t GetBackColor() const
Definition: TGLAnnotation.h:88
TGLFont::ETextAlignH_e GetTextAlign() const
Definition: TGLAnnotation.h:99
TGLViewer * fParent
Definition: TGLAnnotation.h:57
Bool_t GetAllowClose() const
Definition: TGLAnnotation.h:97
Float_t fDrawH
Definition: TGLAnnotation.h:45
Float_t fDrawW
Definition: TGLAnnotation.h:45
Float_t fWidth
Definition: TGLAnnotation.h:40
void CloseEditor()
Close the annotation editor.
TGLFont::ETextAlignH_e fTextAlign
Definition: TGLAnnotation.h:63
virtual ~TGLAnnotation()
Destructor.
void SetTransparency(Char_t x)
Definition: TGLAnnotation.h:81
void SetUseColorSet(Bool_t x)
Definition: TGLAnnotation.h:84
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered overlay area.
Color_t GetTextColor() const
Definition: TGLAnnotation.h:91
virtual void Render(TGLRnrCtx &rnrCtx)
Render the annotation.
Char_t GetLineTransparency() const
Returns transparency of annotation outline.
TGLAnnotation(const TGLAnnotation &)
void SetTextAlign(TGLFont::ETextAlignH_e a)
void SetTextSize(Float_t x)
Definition: TGLAnnotation.h:93
Bool_t fUseColorSet
Definition: TGLAnnotation.h:70
virtual void MouseLeave()
Mouse has left overlay area.
Float_t fHeight
Definition: TGLAnnotation.h:41
EDrag fDrag
last mouse position
Definition: TGLAnnotation.h:44
Float_t fTextSizeDrag
width and height when drawing
Definition: TGLAnnotation.h:46
Char_t fTransparency
Definition: TGLAnnotation.h:67
void SetAllowClose(Bool_t x)
Definition: TGLAnnotation.h:96
Char_t GetTransparency() const
Definition: TGLAnnotation.h:82
Bool_t GetUseColorSet() const
Definition: TGLAnnotation.h:85
const TString & GetText() const
Definition: TGLAnnotation.h:79
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
TGLAnnotation & operator=(const TGLAnnotation &)
Bool_t fAllowClose
Definition: TGLAnnotation.h:71
void SetBackColor(Color_t x)
Definition: TGLAnnotation.h:87
Color_t fBackColor
Definition: TGLAnnotation.h:65
TGLVector3 fPointer
text-size at start of drag
Definition: TGLAnnotation.h:48
A wrapper class for FTFont.
An overlay element.
Definition: TGLOverlay.h:23
Selection record for overlay objects.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:41
3 component (x/y/z) vector class.
Definition: TGLUtil.h:247
Base class for GL viewers.
Definition: TGLViewerBase.h:37
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:57
Basic string class.
Definition: TString.h:131
TText * text
Double_t x[n]
Definition: legend1.C:17
auto * a
Definition: textangle.C:12