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 SetLimits(Int_t min, Int_t max);
84 void SetLimits(Float_t min, Float_t max, Int_t npos,
85 TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
87 void SetToolTip(const Text_t* tip);
88 void SetEnabled(Bool_t state);
90 ClassDef(RGValuator, 0);
91 }; // endclass RGValuator
93 /**************************************************************************/
95 class RGDoubleValuator: public RGValuatorBase
97 RGDoubleValuator(const RGDoubleValuator&); // Not implemented
98 RGDoubleValuator& operator=(const RGDoubleValuator&); // Not implemented
101 TGNumberEntry* fMinEntry;
102 TGNumberEntry* fMaxEntry;
103 TGDoubleHSlider* fSlider;
106 RGDoubleValuator(const TGWindow *p, const char* title, UInt_t w, UInt_t h);
107 virtual ~RGDoubleValuator() {}
109 virtual void Build(Bool_t connect=kTRUE);
111 void MinEntryCallback();
112 void MaxEntryCallback();
113 void SliderCallback();
114 void ValueSet(); //*SIGNAL*
116 TGDoubleHSlider* GetSlider() { return fSlider; }
117 TGNumberEntry* GetMinEntry() { return fMinEntry; }
118 TGNumberEntry* GetMaxEntry() { return fMaxEntry; }
120 void SetLimits(Float_t min, Float_t max, TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
121 void SetValues(Float_t min, Float_t max, Bool_t emit=kFALSE);
123 void GetValues(Float_t& min, Float_t& max) const
124 { min = fMinEntry->GetNumber(); max = fMaxEntry->GetNumber(); }
125 Float_t GetMin() const { return fMinEntry->GetNumber(); }
126 Float_t GetMax() const { return fMaxEntry->GetNumber(); }
128 ClassDef(RGDoubleValuator, 0);
129 }; // endclass RGDoubleValuator
131 /**************************************************************************/
133 class RGTriVecValuator : public TGCompositeFrame
138 // Weed-size vars from RGValuator; copied.
140 Int_t fNELength; // Number-entry length (in characters)
141 Int_t fNEHeight; // Number-entry height (in pixels)
144 RGTriVecValuator(const TGWindow *p, const char* name, UInt_t w, UInt_t h);
145 virtual ~RGTriVecValuator();
147 void Build(Bool_t vertical, const char* lab0, const char* lab1, const char* lab2);
149 RGValuator* GetValuator(Int_t i) const { return fVal[i]; }
151 Float_t GetValue(Int_t i) const { return fVal[i]->GetValue(); }
152 void SetValue(Int_t i, Float_t v) { fVal[i]->SetValue(v); }
154 void GetValues(Float_t& v0, Float_t& v1, Float_t& v2) const
155 { v0 = GetValue(0); v1 = GetValue(1); v2 = GetValue(2); }
156 void GetValues(Float_t v[3]) const
157 { v[0] = GetValue(0); v[1] = GetValue(1); v[2] = GetValue(2); }
158 void GetValues(Double_t v[3]) const
159 { v[0] = GetValue(0); v[1] = GetValue(1); v[2] = GetValue(2); }
161 void SetValues(Float_t v0, Float_t v1, Float_t v2)
162 { SetValue(0, v0); SetValue(1, v1); SetValue(2, v2); }
163 void SetValues(Float_t v[3])
164 { SetValue(0, v[0]); SetValue(1, v[1]); SetValue(2, v[2]); }
165 void SetValues(Double_t v[3])
166 { SetValue(0, v[0]); SetValue(1, v[1]); SetValue(2, v[2]); }
168 void ValueSet(); //*SIGNAL*
170 // Weed-size vars from RGValuator; copied.
171 void SetLabelWidth(Int_t w) { fLabelWidth = w; }
172 void SetNELength(Int_t l) { fNELength = l; }
173 void SetNEHeight(Int_t h) { fNEHeight = h; }
175 void SetLimits(Int_t min, Int_t max);
176 void SetLimits(Float_t min, Float_t max,
177 TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo);
179 ClassDef(RGTriVecValuator, 0)