]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/DigitSet.h
Merged EVE-dev-after-merge to EVE-dev into HEAD. Requires ROOT-5.17.04.
[u/mrichter/AliRoot.git] / EVE / Reve / DigitSet.h
1 // $Header$
2
3 #ifndef REVE_DigitSetBase_H
4 #define REVE_DigitSetBase_H
5
6 #include <TNamed.h>
7 #include <TQObject.h>
8 #include <TAtt3D.h>
9 #include <TAttBBox.h>
10
11 #include <Reve/Reve.h>
12 #include <Reve/RenderElement.h>
13 #include <Reve/FrameBox.h>
14 #include <Reve/RGBAPalette.h>
15 #include <Reve/Plex.h>
16 #include <Reve/ZTrans.h>
17
18 #include <TObject.h>
19
20 namespace Reve {
21
22 class DigitSet : public RenderElement,
23                  public TNamed, public TQObject,
24                  public TAtt3D,
25                  public TAttBBox
26 {
27   friend class DigitSetEditor;
28
29   DigitSet(const DigitSet&);            // Not implemented
30   DigitSet& operator=(const DigitSet&); // Not implemented
31
32 public:
33   enum RenderMode_e { RM_AsIs, RM_Line, RM_Fill };
34
35 protected:
36   struct DigitBase
37   {
38     Int_t fValue;
39     TRef  fId;
40
41     // Here could have additional integer (like time, second threshold).
42
43     DigitBase(Int_t v=0) : fValue(v), fId() {}
44   };
45
46   Int_t             fDefaultValue;
47   Bool_t            fValueIsColor;
48   Bool_t            fOwnIds;       //Flag specifying if id-objects are owned by the DigitSet
49   VoidCPlex         fPlex;
50   DigitBase*        fLastDigit;    //!
51
52   FrameBox*         fFrame;
53   RGBAPalette*      fPalette;
54   RenderMode_e      fRenderMode;
55   Bool_t            fDisableLigting;
56   Bool_t            fEmitSignals;
57   Bool_t            fHistoButtons;
58   ZTrans            fHMTrans;
59
60   DigitBase* NewDigit();
61   void       ReleaseIds();
62
63 public:
64   DigitSet(const Text_t* n="DigitSet", const Text_t* t="");
65   virtual ~DigitSet();
66
67   virtual Bool_t CanEditMainColor() { return kTRUE; }
68   virtual void   SetMainColor(Color_t color);
69
70   // virtual void Reset(QuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
71
72   void RefitPlex();
73   void ScanMinMaxValues(Int_t& min, Int_t& max);
74
75   // --------------------------------
76
77   void DigitValue(Int_t value);
78   void DigitColor(Color_t ci);
79   void DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255);
80   void DigitColor(UChar_t* rgba);
81
82   void DigitId(TObject* id);
83
84   Bool_t GetOwnIds() const    { return fOwnIds; }
85   void   SetOwnIds(Bool_t o)  { fOwnIds = o; }
86
87   DigitBase* GetDigit(Int_t n) { return (DigitBase*) fPlex.Atom(n);   }
88   TObject*   GetId(Int_t n)   { return GetDigit(n)->fId.GetObject(); }
89
90   // --------------------------------
91
92   // virtual void ComputeBBox(); // implement in subclass
93   virtual void Paint(Option_t* option="");
94
95   virtual void DigitSelected(Int_t idx);
96   virtual void CtrlClicked(DigitSet* qs, Int_t idx); // *SIGNAL*
97
98   // --------------------------------
99
100   VoidCPlex* GetPlex() { return &fPlex; }
101
102   FrameBox* GetFrame() const { return fFrame; }
103   void      SetFrame(FrameBox* b);
104  
105   Bool_t GetValueIsColor()  const { return fValueIsColor; }
106
107   RGBAPalette* GetPalette() const { return fPalette; }
108   void         SetPalette(RGBAPalette* p);
109   RGBAPalette* AssertPalette();
110
111   RenderMode_e  GetRenderMode() const { return fRenderMode; }
112   void SetRenderMode(RenderMode_e rm) { fRenderMode = rm; }
113
114   Bool_t GetEmitSignals() const   { return fEmitSignals; }
115   void   SetEmitSignals(Bool_t f) { fEmitSignals = f; }
116
117   Bool_t GetHistoButtons() const   { return fHistoButtons; }
118   void   SetHistoButtons(Bool_t f) { fHistoButtons = f; }
119
120   ZTrans& RefHMTrans() { return fHMTrans; }
121   void SetTransMatrix(Double_t* carr)        { fHMTrans.SetFrom(carr); }
122   void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat);  }
123
124   ClassDef(DigitSet, 1);
125 }; // endclass DigitSet
126
127 }
128
129 #endif