3 #ifndef REVE_RGValuators_H
4 #define REVE_RGValuators_H
6 #include <TGNumberEntry.h>
10 class TGDoubleHSlider;
15 class RGValuatorBase: public TGCompositeFrame
17 RGValuatorBase(const RGValuatorBase&); // Not implemented
18 RGValuatorBase& operator=(const RGValuatorBase&); // Not implemented
25 Int_t fNELength; // Number-entry length (in characters)
26 Int_t fNEHeight; // Number-entry height (in pixels)
31 RGValuatorBase(const TGWindow *p, const char* title, UInt_t w, UInt_t h);
32 virtual ~RGValuatorBase() {}
34 virtual void Build(Bool_t connect=kTRUE) = 0;
36 void SetLabelWidth(Int_t w) { fLabelWidth = w; }
37 void SetAlignRight(Bool_t a) { fAlignRight = a; }
38 void SetShowSlider(Bool_t s=kTRUE) { fShowSlider = s; }
40 void SetNELength(Int_t l) { fNELength = l; }
41 void SetNEHeight(Int_t h) { fNEHeight = h; }
43 ClassDef(RGValuatorBase, 0);
44 }; // endclass RGValuatorBase
46 /**************************************************************************/
48 class RGValuator: public RGValuatorBase
50 RGValuator(const RGValuator&); // Not implemented
51 RGValuator& operator=(const RGValuator&); // Not implemented
58 Bool_t fSliderNewLine;
60 TGNumberEntry* fEntry;
63 Int_t CalcSliderPos(Float_t v);
66 RGValuator(const TGWindow *p, const char* title, UInt_t w, UInt_t h);
67 virtual ~RGValuator() {}
69 virtual void Build(Bool_t connect=kTRUE);
71 Float_t GetValue() const { return fValue; }
72 virtual void SetValue(Float_t v, Bool_t emit=kFALSE);
74 void SliderCallback();
76 void ValueSet(Double_t); //*SIGNAL*
78 TGHSlider* GetSlider() { return fSlider; }
79 TGNumberEntry* GetEntry() { return fEntry; }
81 void SetSliderNewLine(Bool_t nl) { fSliderNewLine = nl; }
83 void GetLimits(Float_t& min, Float_t& max) const { min = fMin; max = fMax; }
84 Float_t GetLimitMin() const { return fMin; }
85 Float_t GetLimitMax() const { return fMax; }
86 void SetLimits(Int_t min, Int_t max);
87 void SetLimits(Float_t min, Float_t max, Int_t npos,
88 TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
90 void SetToolTip(const Text_t* tip);
91 void SetEnabled(Bool_t state);
93 ClassDef(RGValuator, 0);
94 }; // endclass RGValuator
96 /**************************************************************************/
98 class RGDoubleValuator: public RGValuatorBase
100 RGDoubleValuator(const RGDoubleValuator&); // Not implemented
101 RGDoubleValuator& operator=(const RGDoubleValuator&); // Not implemented
104 TGNumberEntry* fMinEntry;
105 TGNumberEntry* fMaxEntry;
106 TGDoubleHSlider* fSlider;
109 RGDoubleValuator(const TGWindow *p, const char* title, UInt_t w, UInt_t h);
110 virtual ~RGDoubleValuator() {}
112 virtual void Build(Bool_t connect=kTRUE);
114 void MinEntryCallback();
115 void MaxEntryCallback();
116 void SliderCallback();
117 void ValueSet(); //*SIGNAL*
119 TGDoubleHSlider* GetSlider() { return fSlider; }
120 TGNumberEntry* GetMinEntry() { return fMinEntry; }
121 TGNumberEntry* GetMaxEntry() { return fMaxEntry; }
123 void SetLimits(Int_t min, Int_t max);
124 void SetLimits(Float_t min, Float_t max, TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
125 void SetValues(Float_t min, Float_t max, Bool_t emit=kFALSE);
127 void GetValues(Float_t& min, Float_t& max) const
128 { min = fMinEntry->GetNumber(); max = fMaxEntry->GetNumber(); }
129 Float_t GetMin() const { return fMinEntry->GetNumber(); }
130 Float_t GetMax() const { return fMaxEntry->GetNumber(); }
131 Float_t GetLimitMin() const { return fMinEntry->GetNumMin(); }
132 Float_t GetLimitMax() const { return fMaxEntry->GetNumMax(); }
134 ClassDef(RGDoubleValuator, 0);
135 }; // endclass RGDoubleValuator
137 /**************************************************************************/
139 class RGTriVecValuator : public TGCompositeFrame
141 RGTriVecValuator(const RGTriVecValuator&); // Not implemented
142 RGTriVecValuator& operator=(const RGTriVecValuator&); // Not implemented
147 // Weed-size vars from RGValuator; copied.
149 Int_t fNELength; // Number-entry length (in characters)
150 Int_t fNEHeight; // Number-entry height (in pixels)
153 RGTriVecValuator(const TGWindow *p, const char* name, UInt_t w, UInt_t h);
154 virtual ~RGTriVecValuator();
156 void Build(Bool_t vertical, const char* lab0, const char* lab1, const char* lab2);
158 RGValuator* GetValuator(Int_t i) const { return fVal[i]; }
160 Float_t GetValue(Int_t i) const { return fVal[i]->GetValue(); }
161 void SetValue(Int_t i, Float_t v) { fVal[i]->SetValue(v); }
163 void GetValues(Float_t& v0, Float_t& v1, Float_t& v2) const
164 { v0 = GetValue(0); v1 = GetValue(1); v2 = GetValue(2); }
165 void GetValues(Float_t v[3]) const
166 { v[0] = GetValue(0); v[1] = GetValue(1); v[2] = GetValue(2); }
167 void GetValues(Double_t v[3]) const
168 { v[0] = GetValue(0); v[1] = GetValue(1); v[2] = GetValue(2); }
170 void SetValues(Float_t v0, Float_t v1, Float_t v2)
171 { SetValue(0, v0); SetValue(1, v1); SetValue(2, v2); }
172 void SetValues(Float_t v[3])
173 { SetValue(0, v[0]); SetValue(1, v[1]); SetValue(2, v[2]); }
174 void SetValues(Double_t v[3])
175 { SetValue(0, v[0]); SetValue(1, v[1]); SetValue(2, v[2]); }
177 void ValueSet(); //*SIGNAL*
179 // Weed-size vars from RGValuator; copied.
180 void SetLabelWidth(Int_t w) { fLabelWidth = w; }
181 void SetNELength(Int_t l) { fNELength = l; }
182 void SetNEHeight(Int_t h) { fNEHeight = h; }
184 void SetLimits(Int_t min, Int_t max);
185 void SetLimits(Float_t min, Float_t max,
186 TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
188 ClassDef(RGTriVecValuator, 0)