Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLOverlay.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel, Feb 2007
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_TGLOverlay_H
13 #define ROOT_TGLOverlay_H
14 
15 #include <GuiTypes.h>
16 
17 class TGLRnrCtx;
18 class TGLOvlSelectRecord;
19 
20 #include <list>
21 
22 class TGLOverlayElement
23 {
24 public:
25  enum ERole { kUser, kViewer, kAnnotation, kAll };
26 
27  enum EState { kInvisible = 1, kDisabled = 2, kActive = 4,
28  kAllVisible = kDisabled | kActive };
29 
30 private:
31  TGLOverlayElement(const TGLOverlayElement&); // Not implemented
32  TGLOverlayElement& operator=(const TGLOverlayElement&); // Not implemented
33 
34 protected:
35  ERole fRole;
36  EState fState;
37 
38  void ProjectionMatrixPushIdentity();
39 
40 public:
41  TGLOverlayElement(ERole r=kUser, EState s=kActive) :
42  fRole(r), fState(s) {}
43  virtual ~TGLOverlayElement() {}
44 
45  virtual Bool_t MouseEnter(TGLOvlSelectRecord& selRec);
46  virtual Bool_t MouseStillInside(TGLOvlSelectRecord& selRec);
47  virtual Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec,
48  Event_t* event);
49  virtual void MouseLeave();
50 
51  virtual void Render(TGLRnrCtx& rnrCtx) = 0;
52 
53  ERole GetRole() const { return fRole; }
54  void SetRole(ERole r) { fRole = r; }
55 
56  EState GetState() const { return fState; }
57  void SetState(EState s) { fState = s; }
58 
59  void SetBinaryState(Bool_t s) { SetState(s ? kActive : kInvisible); }
60 
61  ClassDef(TGLOverlayElement, 0) // Base class for GL overlay elements.
62 };
63 
64 
65 class TGLOverlayList
66 {
67 private:
68  TGLOverlayList(const TGLOverlayList&); // Not implemented
69  TGLOverlayList& operator=(const TGLOverlayList&); // Not implemented
70 
71 protected:
72  std::list<TGLOverlayElement*> fElements;
73 
74 public:
75  TGLOverlayList() : fElements() {}
76  virtual ~TGLOverlayList() {}
77 
78  // void AddElement(TGLOverlayElement* element);
79  // void RemoveElement(TGLOverlayElement* element);
80 
81  // TGLOverlayElement* SelectElement(TGLSelectRecord& selRec, Int_t nameOff);
82 
83  ClassDef(TGLOverlayList, 0) // Collection of overlay elements to draw/select together.
84 };
85 
86 
87 #endif