00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TEveGValuators
00013 #define ROOT_TEveGValuators
00014
00015 #include "TGNumberEntry.h"
00016
00017 class TGLabel;
00018 class TGHSlider;
00019 class TGDoubleHSlider;
00020
00021 class TEveGValuatorBase: public TGCompositeFrame, public TGWidget
00022 {
00023 TEveGValuatorBase(const TEveGValuatorBase&);
00024 TEveGValuatorBase& operator=(const TEveGValuatorBase&);
00025
00026 protected:
00027 UInt_t fLabelWidth;
00028 Bool_t fAlignRight;
00029 Bool_t fShowSlider;
00030
00031 Int_t fNELength;
00032 Int_t fNEHeight;
00033
00034 TGLabel* fLabel;
00035
00036 public:
00037 TEveGValuatorBase(const TGWindow *p, const char* title, UInt_t w, UInt_t h, Int_t widgetId=-1);
00038 virtual ~TEveGValuatorBase() {}
00039
00040 virtual void Build(Bool_t connect=kTRUE) = 0;
00041
00042 void SetLabelWidth(Int_t w) { fLabelWidth = w; }
00043 void SetAlignRight(Bool_t a) { fAlignRight = a; }
00044 void SetShowSlider(Bool_t s=kTRUE) { fShowSlider = s; }
00045
00046 void SetNELength(Int_t l) { fNELength = l; }
00047 void SetNEHeight(Int_t h) { fNEHeight = h; }
00048
00049 TGLabel* GetLabel() {return fLabel;}
00050
00051 ClassDef(TEveGValuatorBase, 0);
00052 };
00053
00054
00055
00056
00057 class TEveGValuator: public TEveGValuatorBase
00058 {
00059 TEveGValuator(const TEveGValuator&);
00060 TEveGValuator& operator=(const TEveGValuator&);
00061
00062 protected:
00063 Float_t fValue;
00064 Float_t fMin;
00065 Float_t fMax;
00066
00067 Bool_t fSliderNewLine;
00068 Int_t fSliderDivs;
00069 TGNumberEntry* fEntry;
00070 TGHSlider* fSlider;
00071
00072 Int_t CalcSliderPos(Float_t v);
00073
00074 public:
00075 TEveGValuator(const TGWindow *p, const char* title, UInt_t w, UInt_t h, Int_t widgetId=-1);
00076 virtual ~TEveGValuator() {}
00077
00078 virtual void Build(Bool_t connect=kTRUE);
00079
00080 Float_t GetValue() const { return fValue; }
00081 virtual void SetValue(Float_t v, Bool_t emit=kFALSE);
00082
00083 void SliderCallback();
00084 void EntryCallback();
00085 void ValueSet(Double_t);
00086
00087 TGHSlider* GetSlider() { return fSlider; }
00088 TGNumberEntry* GetEntry() { return fEntry; }
00089
00090 void SetSliderNewLine(Bool_t nl) { fSliderNewLine = nl; }
00091
00092 void GetLimits(Float_t& min, Float_t& max) const { min = fMin; max = fMax; }
00093 Float_t GetLimitMin() const { return fMin; }
00094 Float_t GetLimitMax() const { return fMax; }
00095 void SetLimits(Int_t min, Int_t max);
00096 void SetLimits(Float_t min, Float_t max, Int_t npos,
00097 TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
00098
00099 void SetToolTip(const char* tip);
00100 void SetEnabled(Bool_t state);
00101
00102 ClassDef(TEveGValuator, 0);
00103 };
00104
00105
00106
00107
00108 class TEveGDoubleValuator: public TEveGValuatorBase
00109 {
00110 TEveGDoubleValuator(const TEveGDoubleValuator&);
00111 TEveGDoubleValuator& operator=(const TEveGDoubleValuator&);
00112
00113 protected:
00114 TGNumberEntry* fMinEntry;
00115 TGNumberEntry* fMaxEntry;
00116 TGDoubleHSlider* fSlider;
00117
00118 public:
00119 TEveGDoubleValuator(const TGWindow *p, const char* title, UInt_t w, UInt_t h, Int_t widgetId=-1);
00120 virtual ~TEveGDoubleValuator() {}
00121
00122 virtual void Build(Bool_t connect=kTRUE);
00123
00124 void MinEntryCallback();
00125 void MaxEntryCallback();
00126 void SliderCallback();
00127 void ValueSet();
00128
00129 TGDoubleHSlider* GetSlider() { return fSlider; }
00130 TGNumberEntry* GetMinEntry() { return fMinEntry; }
00131 TGNumberEntry* GetMaxEntry() { return fMaxEntry; }
00132
00133 void SetLimits(Int_t min, Int_t max);
00134 void SetLimits(Float_t min, Float_t max, TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
00135 void SetValues(Float_t min, Float_t max, Bool_t emit=kFALSE);
00136
00137 void GetValues(Float_t& min, Float_t& max) const
00138 { min = fMinEntry->GetNumber(); max = fMaxEntry->GetNumber(); }
00139 Float_t GetMin() const { return fMinEntry->GetNumber(); }
00140 Float_t GetMax() const { return fMaxEntry->GetNumber(); }
00141 Float_t GetLimitMin() const { return fMinEntry->GetNumMin(); }
00142 Float_t GetLimitMax() const { return fMaxEntry->GetNumMax(); }
00143
00144 ClassDef(TEveGDoubleValuator, 0);
00145 };
00146
00147
00148
00149
00150 class TEveGTriVecValuator : public TGCompositeFrame, public TGWidget
00151 {
00152 TEveGTriVecValuator(const TEveGTriVecValuator&);
00153 TEveGTriVecValuator& operator=(const TEveGTriVecValuator&);
00154
00155 protected:
00156 TEveGValuator* fVal[3];
00157
00158
00159 UInt_t fLabelWidth;
00160 Int_t fNELength;
00161 Int_t fNEHeight;
00162
00163 public:
00164 TEveGTriVecValuator(const TGWindow *p, const char* name, UInt_t w, UInt_t h, Int_t widgetId=-1);
00165 virtual ~TEveGTriVecValuator() {}
00166
00167 void Build(Bool_t vertical, const char* lab0, const char* lab1, const char* lab2);
00168
00169 TEveGValuator* GetValuator(Int_t i) const { return fVal[i]; }
00170
00171 Float_t GetValue(Int_t i) const { return fVal[i]->GetValue(); }
00172 void SetValue(Int_t i, Float_t v) { fVal[i]->SetValue(v); }
00173
00174 void GetValues(Float_t& v0, Float_t& v1, Float_t& v2) const
00175 { v0 = GetValue(0); v1 = GetValue(1); v2 = GetValue(2); }
00176 void GetValues(Float_t v[3]) const
00177 { v[0] = GetValue(0); v[1] = GetValue(1); v[2] = GetValue(2); }
00178 void GetValues(Double_t v[3]) const
00179 { v[0] = GetValue(0); v[1] = GetValue(1); v[2] = GetValue(2); }
00180
00181 void SetValues(Float_t v0, Float_t v1, Float_t v2)
00182 { SetValue(0, v0); SetValue(1, v1); SetValue(2, v2); }
00183 void SetValues(Float_t v[3])
00184 { SetValue(0, v[0]); SetValue(1, v[1]); SetValue(2, v[2]); }
00185 void SetValues(Double_t v[3])
00186 { SetValue(0, v[0]); SetValue(1, v[1]); SetValue(2, v[2]); }
00187
00188 void ValueSet();
00189
00190
00191 void SetLabelWidth(Int_t w) { fLabelWidth = w; }
00192 void SetNELength(Int_t l) { fNELength = l; }
00193 void SetNEHeight(Int_t h) { fNEHeight = h; }
00194
00195 void SetLimits(Int_t min, Int_t max);
00196 void SetLimits(Float_t min, Float_t max,
00197 TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
00198
00199 ClassDef(TEveGTriVecValuator, 0);
00200 };
00201
00202 #endif