]>
Commit | Line | Data |
---|---|---|
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 | ||
17 | class TGListTree; | |
18 | class TGListTreeItem; | |
19 | ||
20 | namespace Reve { | |
21 | ||
22 | class RenderElement | |
23 | { | |
24 | friend class RGTopFrame; | |
25 | ||
26 | protected: | |
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 | ||
52 | public: | |
53 | RenderElement(); | |
54 | RenderElement(Color_t& main_color); | |
55 | virtual ~RenderElement() {} | |
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 | ||
76 | virtual Bool_t CanEditRnrElement() { return true; } | |
77 | virtual Bool_t GetRnrElement() const { return fRnrElement; } | |
78 | virtual void SetRnrElement(Bool_t rnr); | |
79 | ||
80 | virtual Bool_t CanEditMainColor() { return false; } | |
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 | ||
93 | class RenderElementObjPtr : public RenderElement | |
94 | { | |
95 | protected: | |
96 | TObject* fObject; | |
97 | ||
98 | public: | |
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 | ||
112 | class RenderElementListBase : public RenderElement | |
113 | { | |
114 | protected: | |
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 | ||
122 | public: | |
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 | ||
142 | class RenderElementList : public TNamed, public RenderElementListBase | |
143 | { | |
144 | protected: | |
145 | Color_t fColor; | |
146 | ||
147 | public: | |
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 | |
153 | virtual Bool_t CanEditMainColor() { return true; } | |
154 | ||
155 | virtual void Paint(Option_t* option = "") { PaintElements(option); } | |
156 | ||
157 | ClassDef(RenderElementList, 1); | |
158 | }; | |
159 | ||
160 | } | |
161 | ||
162 | #endif |