Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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&) = delete;
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 ~TGLAnnotation() override;
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 Bool_t MouseEnter(TGLOvlSelectRecord& selRec) override;
103 Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec,
104 Event_t* event) override;
105 void MouseLeave() override;
106
107 void CloseEditor();
108
109 void UpdateText();
110
111 void Render(TGLRnrCtx& rnrCtx) override;
112
113 ClassDefOverride(TGLAnnotation, 0); // GL-annotation.
114};
115
116#endif
#define a(i)
Definition RSha256.hxx:99
bool Bool_t
Definition RtypesCore.h:63
short Color_t
Definition RtypesCore.h:92
char Char_t
Definition RtypesCore.h:37
float Float_t
Definition RtypesCore.h:57
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char text
GL-overlay annotation.
static Color_t fgBackColor
TGLAnnotation(const TGLAnnotation &)=delete
Bool_t MouseEnter(TGLOvlSelectRecord &selRec) override
Mouse has entered overlay area.
TGLFont fMenuFont
Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event) override
Handle overlay event.
static Color_t fgTextColor
TGMainFrame * fMainFrame
void SetTextColor(Color_t x)
Float_t fTextSize
Bool_t fDrawRefLine
void MakeEditor()
Show the annotation editor.
void UpdateText()
Modify the annotation text from the text-edit widget.
Color_t fTextColor
void SetText(const TString &x)
TGTextEdit * fTextEdit
TGLAnnotation & operator=(const TGLAnnotation &)=delete
Float_t GetTextSize() const
Color_t GetBackColor() const
TGLFont::ETextAlignH_e GetTextAlign() const
TGLViewer * fParent
Bool_t GetAllowClose() const
void CloseEditor()
Close the annotation editor.
TGLFont::ETextAlignH_e fTextAlign
void SetTransparency(Char_t x)
void SetUseColorSet(Bool_t x)
Color_t GetTextColor() const
Char_t GetLineTransparency() const
Returns transparency of annotation outline.
void SetTextAlign(TGLFont::ETextAlignH_e a)
~TGLAnnotation() override
Destructor.
void MouseLeave() override
Mouse has left overlay area.
void SetTextSize(Float_t x)
Bool_t fUseColorSet
EDrag fDrag
last mouse position
void Render(TGLRnrCtx &rnrCtx) override
Render the annotation.
Float_t fTextSizeDrag
width and height when drawing
Char_t fTransparency
void SetAllowClose(Bool_t x)
Char_t GetTransparency() const
Bool_t GetUseColorSet() const
const TString & GetText() const
void SetBackColor(Color_t x)
Color_t fBackColor
TGLVector3 fPointer
text-size at start of drag
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:248
Base class for GL viewers.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
A TGTextEdit is a specialization of TGTextView.
Definition TGTextEdit.h:22
Basic string class.
Definition TString.h:139
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174