forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TGLOverlayButton.h
82 lines (64 loc) · 3.1 KB
/
TGLOverlayButton.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// @(#)root/gl:$Id$
// Author: Bertrand Bellenot 2008
/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGLOverlayButton
#define ROOT_TGLOverlayButton
#ifndef ROOT_TGLOverlay
#include "TGLOverlay.h"
#endif
#ifndef ROOT_TGLFontManager
#include "TGLFontManager.h"
#endif
#ifndef ROOT_TGLViewerBase
#include "TGLViewerBase.h"
#endif
#ifndef ROOT_TQObject
#include "TQObject.h"
#endif
class TString;
class TGLOverlayButton : public TGLOverlayElement,
public TQObject
{
private:
TGLOverlayButton(const TGLOverlayButton&); // Not implemented
TGLOverlayButton& operator=(const TGLOverlayButton&); // Not implemented
protected:
TString fText; // button text
Int_t fActiveID; // active item identifier
Pixel_t fBackColor; // button background color
Pixel_t fTextColor; // text color
Float_t fNormAlpha; // button alpha value (transparency) in normal state
Float_t fHighAlpha; // button alpha value (transparency) in highlight state
Float_t fPosX; // button x position
Float_t fPosY; // button y position
Float_t fWidth; // button width
Float_t fHeight; // button height
mutable TGLFont fFont; // font used to render text
public:
TGLOverlayButton(TGLViewerBase *parent, const char *text, Float_t posx,
Float_t posy, Float_t width, Float_t height);
virtual ~TGLOverlayButton() { }
virtual Bool_t MouseEnter(TGLOvlSelectRecord& selRec);
virtual Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec, Event_t* event);
virtual void MouseLeave();
virtual void Render(TGLRnrCtx& rnrCtx);
virtual void ResetState() { fActiveID = -1; }
virtual const char *GetText() const { return fText.Data(); }
virtual Pixel_t GetBackColor() const { return fBackColor; }
virtual Pixel_t GetTextColor() const { return fTextColor; }
virtual void SetText(const char *text) { fText = text; }
virtual void SetPosition(Float_t x, Float_t y) { fPosX = x; fPosY = y; }
virtual void SetSize(Float_t w, Float_t h) { fWidth = w; fHeight = h; }
virtual void SetAlphaValues(Float_t norm, Float_t high) { fNormAlpha = norm; fHighAlpha = high; }
virtual void SetBackColor(Pixel_t col) { fBackColor = col; }
virtual void SetTextColor(Pixel_t col) { fTextColor = col; }
virtual void Clicked(TGLViewerBase *viewer); // *SIGNAL*
ClassDef(TGLOverlayButton, 0); // GL-overlay button.
};
#endif