]>
Commit | Line | Data |
---|---|---|
5987168b | 1 | // $Header$ |
2 | ||
3 | #ifndef REVE_RGValuators_H | |
4 | #define REVE_RGValuators_H | |
5 | ||
6 | #include <TGNumberEntry.h> | |
7 | ||
8 | class TGLabel; | |
9 | class TGHSlider; | |
10 | class TGDoubleHSlider; | |
11 | ||
12 | ||
13 | namespace Reve { | |
14 | ||
15 | class RGValuatorBase: public TGCompositeFrame | |
16 | { | |
265ecb21 | 17 | RGValuatorBase(const RGValuatorBase&); // Not implemented |
18 | RGValuatorBase& operator=(const RGValuatorBase&); // Not implemented | |
19 | ||
5987168b | 20 | protected: |
21 | UInt_t fLabelWidth; | |
22 | Bool_t fAlignRight; | |
23 | Bool_t fShowSlider; | |
24 | ||
65b5c50a | 25 | Int_t fNELength; // Number-entry length (in characters) |
26 | Int_t fNEHeight; // Number-entry height (in pixels) | |
5987168b | 27 | |
28 | TGLabel* fLabel; | |
29 | ||
30 | public: | |
31 | RGValuatorBase(const TGWindow *p, const char* title, UInt_t w, UInt_t h); | |
32 | virtual ~RGValuatorBase() {} | |
33 | ||
65b5c50a | 34 | virtual void Build(Bool_t connect=kTRUE) = 0; |
5987168b | 35 | |
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; } | |
39 | ||
40 | void SetNELength(Int_t l) { fNELength = l; } | |
65b5c50a | 41 | void SetNEHeight(Int_t h) { fNEHeight = h; } |
5987168b | 42 | |
43 | ClassDef(RGValuatorBase, 0); | |
44 | }; // endclass RGValuatorBase | |
45 | ||
46 | /**************************************************************************/ | |
47 | ||
48 | class RGValuator: public RGValuatorBase | |
49 | { | |
265ecb21 | 50 | RGValuator(const RGValuator&); // Not implemented |
51 | RGValuator& operator=(const RGValuator&); // Not implemented | |
52 | ||
5987168b | 53 | protected: |
54 | Float_t fValue; | |
55 | Float_t fMin; | |
56 | Float_t fMax; | |
57 | ||
58 | Bool_t fSliderNewLine; | |
20d5c75e | 59 | Int_t fSliderDivs; |
5987168b | 60 | TGNumberEntry* fEntry; |
61 | TGHSlider* fSlider; | |
20d5c75e | 62 | |
63 | Int_t CalcSliderPos(Float_t v); | |
5987168b | 64 | |
65 | public: | |
66 | RGValuator(const TGWindow *p, const char* title, UInt_t w, UInt_t h); | |
67 | virtual ~RGValuator() {} | |
68 | ||
65b5c50a | 69 | virtual void Build(Bool_t connect=kTRUE); |
5987168b | 70 | |
71 | Float_t GetValue() const { return fValue; } | |
72 | virtual void SetValue(Float_t v, Bool_t emit=kFALSE); | |
73 | ||
74 | void SliderCallback(); | |
75 | void EntryCallback(); | |
76 | void ValueSet(Double_t); //*SIGNAL* | |
77 | ||
78 | TGHSlider* GetSlider() { return fSlider; } | |
79 | TGNumberEntry* GetEntry() { return fEntry; } | |
80 | ||
81 | void SetSliderNewLine(Bool_t nl) { fSliderNewLine = nl; } | |
82 | ||
5ab6fc5d | 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; } | |
5987168b | 86 | void SetLimits(Int_t min, Int_t max); |
20d5c75e | 87 | void SetLimits(Float_t min, Float_t max, Int_t npos, |
5987168b | 88 | TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo); |
89 | ||
90 | void SetToolTip(const Text_t* tip); | |
78cd2dc1 | 91 | void SetEnabled(Bool_t state); |
5987168b | 92 | |
93 | ClassDef(RGValuator, 0); | |
94 | }; // endclass RGValuator | |
95 | ||
96 | /**************************************************************************/ | |
97 | ||
98 | class RGDoubleValuator: public RGValuatorBase | |
99 | { | |
265ecb21 | 100 | RGDoubleValuator(const RGDoubleValuator&); // Not implemented |
101 | RGDoubleValuator& operator=(const RGDoubleValuator&); // Not implemented | |
102 | ||
5987168b | 103 | protected: |
104 | TGNumberEntry* fMinEntry; | |
105 | TGNumberEntry* fMaxEntry; | |
106 | TGDoubleHSlider* fSlider; | |
107 | ||
108 | public: | |
109 | RGDoubleValuator(const TGWindow *p, const char* title, UInt_t w, UInt_t h); | |
110 | virtual ~RGDoubleValuator() {} | |
111 | ||
65b5c50a | 112 | virtual void Build(Bool_t connect=kTRUE); |
5987168b | 113 | |
114 | void MinEntryCallback(); | |
115 | void MaxEntryCallback(); | |
116 | void SliderCallback(); | |
117 | void ValueSet(); //*SIGNAL* | |
118 | ||
119 | TGDoubleHSlider* GetSlider() { return fSlider; } | |
120 | TGNumberEntry* GetMinEntry() { return fMinEntry; } | |
121 | TGNumberEntry* GetMaxEntry() { return fMaxEntry; } | |
122 | ||
ae586c74 | 123 | void SetLimits(Int_t min, Int_t max); |
5987168b | 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); | |
126 | ||
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(); } | |
ae586c74 | 131 | Float_t GetLimitMin() const { return fMinEntry->GetNumMin(); } |
132 | Float_t GetLimitMax() const { return fMaxEntry->GetNumMax(); } | |
5987168b | 133 | |
134 | ClassDef(RGDoubleValuator, 0); | |
135 | }; // endclass RGDoubleValuator | |
136 | ||
65b5c50a | 137 | /**************************************************************************/ |
138 | ||
139 | class RGTriVecValuator : public TGCompositeFrame | |
140 | { | |
3c67f72c | 141 | RGTriVecValuator(const RGTriVecValuator&); // Not implemented |
142 | RGTriVecValuator& operator=(const RGTriVecValuator&); // Not implemented | |
143 | ||
65b5c50a | 144 | protected: |
145 | RGValuator* fVal[3]; | |
146 | ||
147 | // Weed-size vars from RGValuator; copied. | |
148 | UInt_t fLabelWidth; | |
149 | Int_t fNELength; // Number-entry length (in characters) | |
150 | Int_t fNEHeight; // Number-entry height (in pixels) | |
151 | ||
152 | public: | |
153 | RGTriVecValuator(const TGWindow *p, const char* name, UInt_t w, UInt_t h); | |
154 | virtual ~RGTriVecValuator(); | |
155 | ||
156 | void Build(Bool_t vertical, const char* lab0, const char* lab1, const char* lab2); | |
157 | ||
158 | RGValuator* GetValuator(Int_t i) const { return fVal[i]; } | |
159 | ||
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); } | |
162 | ||
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); } | |
169 | ||
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]); } | |
176 | ||
177 | void ValueSet(); //*SIGNAL* | |
178 | ||
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; } | |
183 | ||
184 | void SetLimits(Int_t min, Int_t max); | |
185 | void SetLimits(Float_t min, Float_t max, | |
186 | TGNumberFormat::EStyle nef=TGNumberFormat::kNESRealTwo); | |
187 | ||
188 | ClassDef(RGTriVecValuator, 0) | |
189 | }; | |
190 | ||
5987168b | 191 | } |
192 | ||
193 | #endif |