12 #ifndef ROOT_TGDoubleSlider
13 #define ROOT_TGDoubleSlider
57 enum EDoubleSliderSize {
59 kDoubleSliderWidth = 24,
60 kDoubleSliderHeight = kDoubleSliderWidth
64 enum EDoubleSliderScale {
66 kDoubleScaleNo = BIT(0),
67 kDoubleScaleDownRight = BIT(1),
68 kDoubleScaleBoth = BIT(2)
72 class TGDoubleSlider :
public TGFrame,
public TGWidget {
75 TGDoubleSlider(
const TGDoubleSlider&);
76 TGDoubleSlider& operator=(
const TGDoubleSlider&);
94 Bool_t fReversedScale;
96 const TGPicture *fSliderPic;
98 TString GetSString()
const;
100 static void FixBounds(Float_t &min, Float_t &max);
101 void ChangeCursor(Event_t *event);
104 TGDoubleSlider(
const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1, UInt_t type = 1, Int_t
id = -1,
105 UInt_t options = kChildFrame,
106 Pixel_t back = GetDefaultFrameBackground(),
107 Bool_t reversed = kFALSE,
108 Bool_t mark_ends = kFALSE);
110 virtual ~TGDoubleSlider() { }
112 virtual Bool_t HandleButton(Event_t *event) = 0;
113 virtual Bool_t HandleMotion(Event_t *event) = 0;
115 virtual void SetScale(Int_t scale) { fScale = scale; }
116 virtual void SetRange(Float_t min, Float_t max) {
117 fVmin = min; fVmax = max;
118 FixBounds(fVmin, fVmax);
121 virtual void SetPosition(Float_t min, Float_t max) {
122 if (fReversedScale) { fSmin = fVmin+fVmax-max; fSmax = fVmin+fVmax-min; }
123 else { fSmin = min; fSmax = max; }
124 fClient->NeedRedraw(
this);
127 virtual Float_t GetMinPosition()
const {
128 if (fReversedScale)
return fVmin+fVmax-fSmax;
131 virtual Float_t GetMaxPosition()
const {
132 if (fReversedScale)
return fVmin+fVmax-fSmin;
135 virtual void GetPosition(Float_t &min, Float_t &max)
const {
136 if (fReversedScale) { min = fVmin+fVmax-fSmax; max = fVmin+fVmax-fSmin; }
137 else { min = fSmin; max = fSmax; }
139 virtual void GetPosition(Float_t *min, Float_t *max)
const {
140 if (fReversedScale) { *min = fVmin+fVmax-fSmax; *max = fVmin+fVmax-fSmin; }
141 else { *min = fSmin; *max = fSmax; }
144 virtual void MapSubwindows() { TGWindow::MapSubwindows(); }
146 virtual void PositionChanged() { Emit(
"PositionChanged()"); }
147 virtual void Pressed() { Emit(
"Pressed()"); }
148 virtual void Released() { Emit(
"Released()"); }
150 ClassDef(TGDoubleSlider,0)
154 class TGDoubleVSlider :
public TGDoubleSlider {
159 virtual void DoRedraw();
162 TGDoubleVSlider(
const TGWindow *p = 0, UInt_t h = 1, UInt_t type = 1, Int_t
id = -1,
163 UInt_t options = kVerticalFrame,
164 Pixel_t back = GetDefaultFrameBackground(),
165 Bool_t reversed = kFALSE,
166 Bool_t mark_ends = kFALSE);
168 virtual ~TGDoubleVSlider();
170 virtual Bool_t HandleButton(Event_t *event);
171 virtual Bool_t HandleMotion(Event_t *event);
172 virtual TGDimension GetDefaultSize()
const
173 {
return TGDimension(kDoubleSliderWidth, fHeight); }
174 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
176 ClassDef(TGDoubleVSlider,0)
180 class TGDoubleHSlider :
public TGDoubleSlider {
185 virtual void DoRedraw();
188 TGDoubleHSlider(
const TGWindow *p = 0, UInt_t w = 1, UInt_t type = 1, Int_t
id = -1,
189 UInt_t options = kHorizontalFrame,
190 Pixel_t back = GetDefaultFrameBackground(),
191 Bool_t reversed = kFALSE,
192 Bool_t mark_ends = kFALSE);
194 virtual ~TGDoubleHSlider();
196 virtual Bool_t HandleButton(Event_t *event);
197 virtual Bool_t HandleMotion(Event_t *event);
198 virtual TGDimension GetDefaultSize()
const
199 {
return TGDimension(fWidth, kDoubleSliderHeight); }
200 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
202 ClassDef(TGDoubleHSlider,0)