]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/RenderElement.h
Runloader is updated when moving to next file (quick fix).
[u/mrichter/AliRoot.git] / EVE / Reve / RenderElement.h
1 // $Header$
2
3 #ifndef REVE_RenderElement_H
4 #define REVE_RenderElement_H
5
6 #include <Reve/Reve.h>
7
8 #include <TNamed.h>
9 #include <TRef.h>
10
11 class TGListTree;
12 class TGListTreeItem;
13 class TGPicture;
14
15 namespace Reve {
16
17 class ZTrans;
18
19 class RenderElement
20 {
21   friend class RGTopFrame;
22
23   RenderElement(const RenderElement&);            // Not implemented
24   RenderElement& operator=(const RenderElement&); // Not implemented
25
26 public:
27   class ListTreeInfo
28   {
29   public:
30     TGListTree*     fTree;
31     TGListTreeItem* fItem;
32
33     ListTreeInfo() : fTree(0), fItem(0) {}
34     ListTreeInfo(TGListTree* lt, TGListTreeItem* lti) : fTree(lt), fItem(lti) {}
35     ListTreeInfo(const ListTreeInfo& l) : fTree(l.fTree), fItem(l.fItem) {}
36     virtual ~ListTreeInfo() {}
37
38     ListTreeInfo& operator=(const ListTreeInfo& l)
39     { fTree = l.fTree; fItem = l.fItem; return *this; }
40
41     bool operator==(const ListTreeInfo& x) const
42     { return fTree == x.fTree && fItem == x.fItem; }
43     bool operator<(const ListTreeInfo& x) const
44     { return fTree == x.fTree ? fItem < x.fItem : fTree < x.fTree; }
45
46     ClassDef(ListTreeInfo, 0);
47   };
48
49   static const TGPicture*                      fgRnrIcons[4];
50
51   typedef std::set<ListTreeInfo>               sLTI_t;
52   typedef std::set<ListTreeInfo>::iterator     sLTI_i;
53
54   typedef std::list<RenderElement*>            List_t;
55   typedef std::list<RenderElement*>::iterator  List_i;
56
57 protected:
58   // TRef     fSource;
59
60   Bool_t   fRnrSelf;
61   Bool_t   fRnrChildren;
62   Color_t* fMainColorPtr;
63
64   sLTI_t fItems;
65   List_t fParents;
66
67   Bool_t fDestroyOnZeroRefCnt;
68   Bool_t fDenyDestroy;
69
70   List_t fChildren;
71
72 public:
73   RenderElement();
74   RenderElement(Color_t& main_color);
75   virtual ~RenderElement();
76
77   virtual void AddParent(RenderElement* re);
78   virtual void RemoveParent(RenderElement* re);
79
80   List_i BeginParents() { return fParents.begin(); }
81   List_i EndParents()   { return fParents.end();   }
82   Int_t  GetNParents() const { return fParents.size(); }
83
84   List_i BeginChildren() { return fChildren.begin(); }
85   List_i EndChildren()   { return fChildren.end();   }
86   Int_t  GetNChildren() const { return fChildren.size(); }
87
88   virtual Int_t ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent);
89   virtual Int_t DestroyListSubTree(TGListTree* ltree, TGListTreeItem* parent);
90
91   void EnableListElements();   // *MENU*
92   void DisableListElements();  // *MENU*
93
94   Bool_t GetDestroyOnZeroRefCnt() const   { return fDestroyOnZeroRefCnt; }
95   void   SetDestroyOnZeroRefCnt(Bool_t d) { fDestroyOnZeroRefCnt = d; }
96
97   Bool_t GetDenyDestroy() const   { return fDenyDestroy; }
98   void   SetDenyDestroy(Bool_t d) { fDenyDestroy = d; }
99
100   virtual void PadPaint(Option_t* option);
101
102   virtual TObject* GetObject(Reve::Exc_t eh="RenderElement::GetObject ");
103
104   /*
105     TRef&    GetSource() { return fSource; }
106     TObject* GetSourceObject() const { return fSource.GetObject(); }
107     void SetSourceObject(TObject* o) { fSource.SetObject(o); }
108
109     void DumpSourceObject();    // *MENU*
110     void InspectSourceObject(); // *MENU*
111   */
112
113   virtual TGListTreeItem* AddIntoListTree(TGListTree* ltree,
114                                           TGListTreeItem* parent_lti);
115   virtual TGListTreeItem* AddIntoListTree(TGListTree* ltree,
116                                           RenderElement* parent);
117   virtual Bool_t          RemoveFromListTree(TGListTree* ltree);
118   virtual Bool_t          RemoveFromListTree(TGListTree* ltree,
119                                              TGListTreeItem* parent_lti);
120
121   virtual sLTI_i          FindItem(TGListTree* ltree);
122   virtual sLTI_i          FindItem(TGListTree* ltree,
123                                    TGListTreeItem* parent_lti);
124   virtual TGListTreeItem* FindListTreeItem(TGListTree* ltree);
125   virtual TGListTreeItem* FindListTreeItem(TGListTree* ltree,
126                                            TGListTreeItem* parent_lti);
127
128   virtual void UpdateItems();
129
130   void SpawnEditor();                          // *MENU*
131   virtual void ExportToCINT(Text_t* var_name); // *MENU*
132
133
134   virtual void AddElement(RenderElement* el);
135   virtual void RemoveElement(RenderElement* el);
136   virtual void RemoveElementLocal(RenderElement* el);
137   virtual void RemoveElements();
138
139   virtual void Destroy();                      // *MENU*
140   virtual void DestroyElements();
141
142   virtual Bool_t CanEditRnrElement()   { return kTRUE; }
143   virtual Bool_t GetRnrSelf() const { return fRnrSelf; }
144   virtual Bool_t GetRnrChildren() const { return fRnrChildren; }
145   virtual void   SetRnrSelf(Bool_t rnr);
146   virtual void   SetRnrChildren(Bool_t rnr);
147   virtual void   SetRnrState(Bool_t rnr);
148
149   virtual Bool_t CanEditMainColor()        { return kFALSE; }
150   Color_t* GetMainColorPtr()               { return fMainColorPtr; }
151   void     SetMainColorPtr(Color_t* color) { fMainColorPtr = color; }
152
153   virtual Color_t GetMainColor() const { return fMainColorPtr ? *fMainColorPtr : 0; }
154   virtual void    SetMainColor(Color_t color);
155   void    SetMainColor(Pixel_t pixel);
156
157   virtual Bool_t  CanEditMainTransparency()    { return kFALSE; }
158   virtual UChar_t GetMainTransparency() const  { return 0; }
159   virtual void    SetMainTransparency(UChar_t) {}
160
161   virtual Bool_t  CanEditMainHMTrans() { return kFALSE; }
162   virtual ZTrans* PtrMainHMTrans()     { return 0; }
163
164   static const TGPicture* GetCheckBoxPicture(Bool_t rnrElement, Bool_t rnrDaughter);
165
166   ClassDef(RenderElement, 1);
167 }; // endclass RenderElement
168
169 /**************************************************************************/
170
171 class RenderElementObjPtr : public RenderElement,
172                             public TObject
173 {
174   RenderElementObjPtr(const RenderElementObjPtr&);            // Not implemented
175   RenderElementObjPtr& operator=(const RenderElementObjPtr&); // Not implemented
176
177 protected:
178   TObject* fObject;
179   Bool_t   fOwnObject;
180
181 public:
182   RenderElementObjPtr(TObject* obj, Bool_t own=kTRUE);
183   RenderElementObjPtr(TObject* obj, Color_t& mainColor, Bool_t own=kTRUE);
184   virtual ~RenderElementObjPtr();
185
186   virtual TObject* GetObject(Exc_t eh="RenderElementObjPtr::GetObject ");
187   virtual void     ExportToCINT(Text_t* var_name);
188
189   Bool_t GetOwnObject() const   { return fOwnObject; }
190   void   SetOwnObject(Bool_t o) { fOwnObject = o; }
191
192   ClassDef(RenderElementObjPtr, 1);
193 }; // endclass RenderElementObjPtr
194
195 /**************************************************************************/
196
197 class RenderElementList : public RenderElement,
198                           public TNamed
199 {
200 protected:
201   Color_t   fColor;
202   Bool_t    fDoColor;
203
204 public:
205   RenderElementList(const Text_t* n="RenderElementList", const Text_t* t="",
206                     Bool_t doColor=kFALSE);
207   virtual ~RenderElementList() {}
208
209   virtual Bool_t CanEditMainColor()  { return fDoColor; }
210
211   ClassDef(RenderElementList, 1);
212 };
213
214
215 /**************************************************************************/
216
217 class PadPrimitive : public RenderElement,
218                      public TNamed
219 {
220 public:
221   PadPrimitive(const Text_t* n="PadPrimitive", const Text_t* t="");
222   virtual ~PadPrimitive() {}
223
224   virtual void Paint(Option_t* option = "");
225
226   // virtual void PaintRenderElement(RenderElement* re, Option_t* option);
227
228   ClassDef(PadPrimitive, 1);
229 };
230
231
232 }
233
234 #endif