Implemented dtor for RenderElement removing all instances from browsers.
[u/mrichter/AliRoot.git] / EVE / Reve / RenderElement.h
CommitLineData
5a5a1232 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#include <Gtypes.h>
12#include <GuiTypes.h>
13
14#include <list>
15#include <set>
16
17class TGListTree;
18class TGListTreeItem;
19
20namespace Reve {
21
22class RenderElement
23{
24 friend class RGTopFrame;
25
26protected:
27 // TRef fSource;
28
29 Bool_t fRnrElement;
30 Color_t* fMainColorPtr;
31
32 struct ListTreeInfo {
33 TGListTree* fTree;
34 TGListTreeItem* fItem;
35
36 ListTreeInfo() {}
37 ListTreeInfo(TGListTree* lt, TGListTreeItem* lti) : fTree(lt), fItem(lti) {}
a8b53f69 38 virtual ~ListTreeInfo() {}
39
5a5a1232 40 bool operator==(const ListTreeInfo& x) const
41 { return fTree == x.fTree && fItem == x.fItem; }
42 bool operator<(const ListTreeInfo& x) const
43 { return fTree == x.fTree ? fItem < x.fItem : fTree < x.fTree; }
44
45 ClassDef(ListTreeInfo, 0);
46 };
47 typedef std::set<ListTreeInfo> sLTI_t;
48 typedef std::set<ListTreeInfo>::iterator sLTI_i;
49
50 sLTI_t fItems;
51
52public:
53 RenderElement();
54 RenderElement(Color_t& main_color);
a87df773 55 virtual ~RenderElement();
5a5a1232 56
092578a7 57 virtual TObject* GetObject(Reve::Exc_t eh="RenderElement::GetObject ");
5a5a1232 58
59 /*
60 TRef& GetSource() { return fSource; }
61 TObject* GetSourceObject() const { return fSource.GetObject(); }
62 void SetSourceObject(TObject* o) { fSource.SetObject(o); }
63
64 void DumpSourceObject(); // *MENU*
65 void InspectSourceObject(); // *MENU*
66 */
67
68 virtual TGListTreeItem* AddIntoListTree(TGListTree* ltree,
69 TGListTreeItem* parent);
70
71 virtual void FullUpdate();
72
73 void SpawnEditor(); // *MENU*
74 void ExportToCINT(Text_t* var_name); // *MENU*
75
a87df773 76 virtual Bool_t CanEditRnrElement() { return kTRUE; }
5a5a1232 77 virtual Bool_t GetRnrElement() const { return fRnrElement; }
78 virtual void SetRnrElement(Bool_t rnr);
79
a87df773 80 virtual Bool_t CanEditMainColor() { return kFALSE; }
5a5a1232 81 Color_t* GetMainColorPtr() { return fMainColorPtr; }
82 void SetMainColorPtr(Color_t* color) { fMainColorPtr = color; }
83
84 virtual Color_t GetMainColor() const { return fMainColorPtr ? *fMainColorPtr : 0; }
85 virtual void SetMainColor(Color_t color);
86 void SetMainColorByPixel(Pixel_t pixel);
87
88 ClassDef(RenderElement, 1);
092578a7 89}; // endclass RenderElement
90
91/**************************************************************************/
92
93class RenderElementObjPtr : public RenderElement
94{
95protected:
96 TObject* fObject;
97
98public:
99 RenderElementObjPtr(TObject* obj);
100 RenderElementObjPtr(TObject* obj, Color_t& mainColor);
101 virtual ~RenderElementObjPtr();
102
103 virtual TObject* GetObject(Reve::Exc_t eh="RenderElementObjPtr::GetObject ");
104
105 virtual void SetRnrElement(Bool_t rnr);
106
107 ClassDef(RenderElementObjPtr, 1);
108}; // endclass RenderElementObjPtr
5a5a1232 109
110/**************************************************************************/
111
112class RenderElementListBase : public RenderElement
113{
114protected:
115 typedef std::list<RenderElement*> lpRE_t;
116 typedef std::list<RenderElement*>::iterator lpRE_i;
117
118 lpRE_t fList;
119
120 void PaintElements(Option_t* option="");
121
122public:
123 RenderElementListBase() {}
124 RenderElementListBase(Color_t& col) : RenderElement(col) {}
a8b53f69 125 virtual ~RenderElementListBase() {}
5a5a1232 126
127 virtual void AddElement(RenderElement* el) { fList.push_back(el); }
128
129 virtual Int_t ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent);
130
131 void EnableListElements(); // *MENU*
132 void DisableListElements(); // *MENU*
133
134 virtual void SetMainColor(Color_t color);
135 virtual void SetMainColor(Pixel_t pixel);
136
137 ClassDef(RenderElementListBase, 1);
138};
139
140/**************************************************************************/
141
142class RenderElementList : public TNamed, public RenderElementListBase
143{
144protected:
145 Color_t fColor;
146
147public:
148 RenderElementList(const Text_t* n="RenderElementList", const Text_t* t="") :
149 TNamed(n, t), RenderElementListBase(fColor), fColor(0)
150 {}
a8b53f69 151 virtual ~RenderElementList() {}
5a5a1232 152
a87df773 153 virtual Bool_t CanEditMainColor() { return kTRUE; }
5a5a1232 154
155 virtual void Paint(Option_t* option = "") { PaintElements(option); }
156
157 ClassDef(RenderElementList, 1);
158};
159
160}
161
162#endif