]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/RenderElement.h
e84de0f951bb13d9dd272ad68a95b4a58a63ac0c
[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 #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) {}
38     virtual ~ListTreeInfo() {}
39
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
57   TObject* GetObject(Reve::Exc_t eh="RenderElement::GetObject ");
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);
89 }; // endclass Reve
90
91 /**************************************************************************/
92
93 class RenderElementListBase : public RenderElement
94 {
95 protected:
96   typedef std::list<RenderElement*>            lpRE_t;
97   typedef std::list<RenderElement*>::iterator  lpRE_i;
98
99   lpRE_t fList;
100
101   void PaintElements(Option_t* option="");
102
103 public:
104   RenderElementListBase() {}
105   RenderElementListBase(Color_t& col) : RenderElement(col) {}
106   virtual ~RenderElementListBase() {}
107
108   virtual void AddElement(RenderElement* el) { fList.push_back(el); }
109
110   virtual Int_t ExpandIntoListTree(TGListTree* ltree, TGListTreeItem* parent);
111
112   void EnableListElements();   // *MENU*
113   void DisableListElements();  // *MENU*
114
115   virtual void SetMainColor(Color_t color);
116   virtual void SetMainColor(Pixel_t pixel);
117
118   ClassDef(RenderElementListBase, 1);
119 };
120
121 /**************************************************************************/
122
123 class RenderElementList : public TNamed, public RenderElementListBase
124 {
125 protected:
126   Color_t   fColor;
127
128 public:
129   RenderElementList(const Text_t* n="RenderElementList", const Text_t* t="") :
130     TNamed(n, t), RenderElementListBase(fColor), fColor(0)
131   {}
132   virtual ~RenderElementList() {}
133
134   virtual Bool_t CanEditMainColor()  { return true; }
135
136   virtual void Paint(Option_t* option = "") { PaintElements(option); }
137
138   ClassDef(RenderElementList, 1);
139 };
140
141 }
142
143 #endif