Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLOverlayButton.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Bertrand Bellenot 2008
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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_TGLOverlayButton
13 #define ROOT_TGLOverlayButton
14 
15 #include "TGLOverlay.h"
16 #include "TGLFontManager.h"
17 #include "TGLViewerBase.h"
18 #include "TQObject.h"
19 
20 class TString;
21 
22 class TGLOverlayButton : public TGLOverlayElement,
23  public TQObject
24 {
25 
26 private:
27  TGLOverlayButton(const TGLOverlayButton&); // Not implemented
28  TGLOverlayButton& operator=(const TGLOverlayButton&); // Not implemented
29 
30 protected:
31 
32  TString fText; // button text
33  Int_t fActiveID; // active item identifier
34  Pixel_t fBackColor; // button background color
35  Pixel_t fTextColor; // text color
36  Float_t fNormAlpha; // button alpha value (transparency) in normal state
37  Float_t fHighAlpha; // button alpha value (transparency) in highlight state
38 
39  Float_t fPosX; // button x position
40  Float_t fPosY; // button y position
41  Float_t fWidth; // button width
42  Float_t fHeight; // button height
43 
44  mutable TGLFont fFont; // font used to render text
45 
46 public:
47  TGLOverlayButton(TGLViewerBase *parent, const char *text, Float_t posx,
48  Float_t posy, Float_t width, Float_t height);
49  virtual ~TGLOverlayButton() { }
50 
51  virtual Bool_t MouseEnter(TGLOvlSelectRecord& selRec);
52  virtual Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec, Event_t* event);
53  virtual void MouseLeave();
54 
55  virtual void Render(TGLRnrCtx& rnrCtx);
56  virtual void ResetState() { fActiveID = -1; }
57 
58  virtual const char *GetText() const { return fText.Data(); }
59  virtual Pixel_t GetBackColor() const { return fBackColor; }
60  virtual Pixel_t GetTextColor() const { return fTextColor; }
61  virtual void SetText(const char *text) { fText = text; }
62  virtual void SetPosition(Float_t x, Float_t y) { fPosX = x; fPosY = y; }
63  virtual void SetSize(Float_t w, Float_t h) { fWidth = w; fHeight = h; }
64  virtual void SetAlphaValues(Float_t norm, Float_t high) { fNormAlpha = norm; fHighAlpha = high; }
65  virtual void SetBackColor(Pixel_t col) { fBackColor = col; }
66  virtual void SetTextColor(Pixel_t col) { fTextColor = col; }
67 
68  virtual void Clicked(TGLViewerBase *viewer); // *SIGNAL*
69 
70  ClassDef(TGLOverlayButton, 0); // GL-overlay button.
71 };
72 
73 #endif
74