00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TEveDigitSet
00013 #define ROOT_TEveDigitSet
00014
00015 #include "TNamed.h"
00016 #include "TQObject.h"
00017 #include "TAtt3D.h"
00018 #include "TAttBBox.h"
00019
00020 #include "TEveUtil.h"
00021 #include "TEveElement.h"
00022 #include "TEveFrameBox.h"
00023 #include "TEveRGBAPalette.h"
00024 #include "TEveChunkManager.h"
00025 #include "TEveSecondarySelectable.h"
00026
00027 class TRefArray;
00028
00029 class TEveDigitSet : public TEveElement,
00030 public TNamed, public TQObject,
00031 public TAtt3D,
00032 public TAttBBox,
00033 public TEveSecondarySelectable
00034 {
00035 friend class TEveDigitSetEditor;
00036 friend class TEveDigitSetGL;
00037
00038 TEveDigitSet(const TEveDigitSet&);
00039 TEveDigitSet& operator=(const TEveDigitSet&);
00040
00041 public:
00042 enum ERenderMode_e { kRM_AsIs, kRM_Line, kRM_Fill };
00043
00044 typedef void (*Callback_foo)(TEveDigitSet*, Int_t, TObject*);
00045 typedef TString (*TooltipCB_foo)(TEveDigitSet*, Int_t);
00046
00047 struct DigitBase_t
00048 {
00049
00050
00051 Int_t fValue;
00052 void *fUserData;
00053
00054 DigitBase_t(Int_t v=0) : fValue(v), fUserData(0) {}
00055 };
00056
00057 protected:
00058 TRefArray *fDigitIds;
00059
00060 Int_t fDefaultValue;
00061 Bool_t fValueIsColor;
00062 Bool_t fSingleColor;
00063 Bool_t fAntiFlick;
00064 Bool_t fOwnIds;
00065 TEveChunkManager fPlex;
00066 DigitBase_t* fLastDigit;
00067 Int_t fLastIdx;
00068
00069 Color_t fColor;
00070 TEveFrameBox* fFrame;
00071 TEveRGBAPalette* fPalette;
00072 ERenderMode_e fRenderMode;
00073 Bool_t fDisableLighting;
00074 Bool_t fHistoButtons;
00075
00076 Bool_t fEmitSignals;
00077 Callback_foo fCallbackFoo;
00078 TooltipCB_foo fTooltipCBFoo;
00079
00080 DigitBase_t* NewDigit();
00081 void ReleaseIds();
00082
00083 public:
00084 TEveDigitSet(const char* n="TEveDigitSet", const char* t="");
00085 virtual ~TEveDigitSet();
00086
00087 virtual TObject* GetObject(const TEveException&) const
00088 { const TObject* obj = this; return const_cast<TObject*>(obj); }
00089
00090 void UseSingleColor();
00091
00092 Bool_t GetAntiFlick() const { return fAntiFlick; }
00093 void SetAntiFlick(Bool_t f) { fAntiFlick = f; }
00094
00095 virtual void SetMainColor(Color_t color);
00096
00097 virtual void UnSelected();
00098 virtual void UnHighlighted();
00099
00100 virtual TString GetHighlightTooltip();
00101
00102
00103
00104
00105 void RefitPlex();
00106 void ScanMinMaxValues(Int_t& min, Int_t& max);
00107
00108
00109
00110 void SetCurrentDigit(Int_t idx);
00111
00112 void DigitValue(Int_t value);
00113 void DigitColor(Color_t ci);
00114 void DigitColor(Color_t ci, Char_t transparency);
00115 void DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255);
00116 void DigitColor(UChar_t* rgba);
00117
00118 Bool_t GetOwnIds() const { return fOwnIds; }
00119 void SetOwnIds(Bool_t o) { fOwnIds = o; }
00120
00121 void DigitId(TObject* id);
00122 void DigitUserData(void* ud);
00123
00124 void DigitId(Int_t n, TObject* id);
00125 void DigitUserData(Int_t n, void* ud);
00126
00127 DigitBase_t* GetDigit(Int_t n) const { return (DigitBase_t*) fPlex.Atom(n); }
00128 TObject* GetId(Int_t n) const;
00129 void* GetUserData(Int_t n) const;
00130 using TEveElement::GetUserData;
00131
00132
00133
00134
00135
00136
00137 virtual void Paint(Option_t* option="");
00138
00139 virtual void DigitSelected(Int_t idx);
00140 virtual void SecSelected(TEveDigitSet* qs, Int_t idx);
00141
00142
00143
00144 TEveChunkManager* GetPlex() { return &fPlex; }
00145
00146 TEveFrameBox* GetFrame() const { return fFrame; }
00147 void SetFrame(TEveFrameBox* b);
00148
00149 Bool_t GetValueIsColor() const { return fValueIsColor; }
00150
00151 TEveRGBAPalette* GetPalette() const { return fPalette; }
00152 void SetPalette(TEveRGBAPalette* p);
00153 TEveRGBAPalette* AssertPalette();
00154
00155 ERenderMode_e GetRenderMode() const { return fRenderMode; }
00156 void SetRenderMode(ERenderMode_e rm) { fRenderMode = rm; }
00157
00158 Bool_t GetDisableLighting() const { return fDisableLighting; }
00159 void SetDisableLighting(Bool_t l) { fDisableLighting = l; }
00160
00161 Bool_t GetHistoButtons() const { return fHistoButtons; }
00162 void SetHistoButtons(Bool_t f) { fHistoButtons = f; }
00163
00164 Bool_t GetEmitSignals() const { return fEmitSignals; }
00165 void SetEmitSignals(Bool_t f) { fEmitSignals = f; }
00166
00167 Callback_foo GetCallbackFoo() const { return fCallbackFoo; }
00168 void SetCallbackFoo(Callback_foo f) { fCallbackFoo = f; }
00169
00170 TooltipCB_foo GetTooltipCBFoo() const { return fTooltipCBFoo; }
00171 void SetTooltipCBFoo(TooltipCB_foo f) { fTooltipCBFoo = f; }
00172
00173 ClassDef(TEveDigitSet, 0);
00174 };
00175
00176 #endif