Logo ROOT  
Reference Guide
TGDoubleSlider.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Reiner Rohlfs 30/09/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11/**************************************************************************
12
13 This source is based on Xclass95, a Win95-looking GUI toolkit.
14 Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15
16 Xclass95 is free software; you can redistribute it and/or
17 modify it under the terms of the GNU Library General Public
18 License as published by the Free Software Foundation; either
19 version 2 of the License, or (at your option) any later version.
20
21**************************************************************************/
22
23//////////////////////////////////////////////////////////////////////////
24// //
25// TGDoubleSlider, TGDoubleVSlider and TGDoubleHSlider //
26// //
27// DoubleSlider widgets allow easy selection of a min and a max value //
28// out of a range. //
29// DoubleSliders can be either horizontal or vertical oriented and //
30// there is a choice of three different types of tick marks. //
31// //
32// To change the min value press the mouse near to the left / bottom //
33// edge of the slider. //
34// To change the max value press the mouse near to the right / top //
35// edge of the slider. //
36// To change both values simultaneously press the mouse near to the //
37// center of the slider. //
38// //
39// TGDoubleSlider is an abstract base class. Use the concrete //
40// TGDoubleVSlider and TGDoubleHSlider. //
41// //
42// Dragging the slider will generate the event: //
43// kC_VSLIDER, kSL_POS, slider id, 0 (for vertical slider) //
44// kC_HSLIDER, kSL_POS, slider id, 0 (for horizontal slider) //
45// //
46// Pressing the mouse will generate the event: //
47// kC_VSLIDER, kSL_PRESS, slider id, 0 (for vertical slider) //
48// kC_HSLIDER, kSL_PRESS, slider id, 0 (for horizontal slider) //
49// //
50// Releasing the mouse will generate the event: //
51// kC_VSLIDER, kSL_RELEASE, slider id, 0 (for vertical slider) //
52// kC_HSLIDER, kSL_RELEASE, slider id, 0 (for horizontal slider) //
53// //
54// Use the functions GetMinPosition(), GetMaxPosition() and //
55// GetPosition() to retrieve the position of the slider. //
56// //
57//////////////////////////////////////////////////////////////////////////
58
59#include "TGDoubleSlider.h"
60#include "TGPicture.h"
61#include "Riostream.h"
62#include "TSystem.h"
63#include "TVirtualX.h"
64
65
69
70////////////////////////////////////////////////////////////////////////////////
71/// Slider constructor.
72
74 UInt_t options, ULong_t back,
75 Bool_t reversed, Bool_t mark_ends)
76 : TGFrame(p, w, h, options, back)
77{
78 fSliderPic = 0;
79
80 fWidgetId = id;
82 fMsgWindow = p;
83
85 fScale = 10;
86 fMove = 0;
87
88 fPos = fSmin = fSmax = 0.0;
89 fRelPos = 0;
90 fVmin = fVmax = 0.0;
91 fPressPoint = 0;
92 fPressSmin = fPressSmax = 0.0;
93
94 fReversedScale = reversed;
95 fMarkEnds = mark_ends;
96
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// Avoid boundaries to be equal.
106
108{
109 if (min > max) min = max;
110
111 Float_t eps = 1e-6;
112 if (max - min < eps) {
113 if (max == 0)
114 max += eps;
115 else
116 max += max*eps;
117 if (min == 0)
118 min -= eps;
119 else
120 min -= min*eps;
121 }
122}
123
124////////////////////////////////////////////////////////////////////////////////
125/// Returns the slider type as a string - used in SavePrimitive()
126
128{
129 TString stype;
130
131 if (fScaleType) {
133 if (stype.Length() == 0)
134 stype = "kDoubleScaleNo";
135 else
136 stype += " | kDoubleScaleNo";
137 }
139 if (stype.Length() == 0)
140 stype = "kDoubleScaleDownRight";
141 else
142 stype += " | kDoubleScaleDownRight";
143 }
145 if (stype.Length() == 0)
146 stype = "kDoubleScaleBoth";
147 else
148 stype += " | kDoubleScaleBoth";
149 }
150 }
151 return stype;
152}
153
154////////////////////////////////////////////////////////////////////////////////
155/// Change the cursor shape depending on the slider area.
156
158{
159 static Cursor_t topCur = kNone, leftCur = kNone;
160 static Cursor_t botCur = kNone, rightCur = kNone;
161 Int_t hw = 0, wh = 0, xy = 0, yx = 0;
162 Cursor_t minCur = kNone, maxCur = kNone;
163
164 if (topCur == kNone)
165 topCur = gVirtualX->CreateCursor(kTopSide);
166 if (leftCur == kNone)
167 leftCur = gVirtualX->CreateCursor(kLeftSide);
168 if (botCur == kNone)
169 botCur = gVirtualX->CreateCursor(kBottomSide);
170 if (rightCur == kNone)
171 rightCur = gVirtualX->CreateCursor(kRightSide);
172 if (GetOptions() & kVerticalFrame) {
173 hw = (Int_t)fWidth;
174 wh = (Int_t)fHeight;
175 xy = (Int_t)event->fX;
176 yx = (Int_t)event->fY;
177 minCur = topCur;
178 maxCur = botCur;
179 }
180 else if (GetOptions() & kHorizontalFrame) {
181 hw = (Int_t)fHeight;
182 wh = (Int_t)fWidth;
183 xy = (Int_t)event->fY;
184 yx = (Int_t)event->fX;
185 minCur = leftCur;
186 maxCur = rightCur;
187 }
188 else return;
189
190 Int_t relMin = (Int_t)((wh-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
191 Int_t relMax = (Int_t)((wh-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
192 // constrain to the slider width
193 if (xy > hw/2-7 && xy < hw/2+7 && fMove != 3) {
194 // if the mouse pointer is in the top resizing zone,
195 // and we are not already moving the the bottom side,
196 // set the cursor shape as TopSide
197 if ((yx <= (relMax - relMin) / 4 + relMin) &&
198 (yx >= relMin) && (fMove != 2))
199 gVirtualX->SetCursor(fId, minCur);
200 // if the mouse pointer is in the bottom resizing zone,
201 // and we are not already moving the the top side,
202 // set the cursor shape as BottomSide
203 else if ((yx >= (relMax - relMin) / 4 * 3 + relMin) &&
204 (yx <= relMax) && (fMove != 1))
205 gVirtualX->SetCursor(fId, maxCur);
206 // if we are not moving any side, restore the cursor
207 else if ((fMove < 1) || (fMove > 2))
208 gVirtualX->SetCursor(fId, kNone);
209 }
210 // if we are not inside the slider, and not moving any side,
211 // restore the cursor
212 else if ((fMove < 1) || (fMove > 2))
213 gVirtualX->SetCursor(fId, kNone);
214}
215
216////////////////////////////////////////////////////////////////////////////////
217/// Create a vertical slider widget.
218
220 UInt_t options, ULong_t back,
221 Bool_t reversed, Bool_t mark_ends)
222 : TGDoubleSlider(p, kDoubleSliderWidth, h, type, id, options, back,
223 reversed, mark_ends)
224{
225 fYp = 0;
226 fSliderPic = fClient->GetPicture("sliderv.xpm");
227
228 if (!fSliderPic)
229 Error("TGDoubleVSlider", "sliderv.xpm not found");
230 // set initial values
231 fSmin = h/8*3; fSmax = h/8*5; fVmin = 0; fVmax = h;
234}
235
236////////////////////////////////////////////////////////////////////////////////
237/// Delete vertical slider widget.
238
240{
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Redraw vertical slider widget.
246
248{
250
251 // cleanup the drawable
252 gVirtualX->ClearWindow(fId);
253
254 if (fSmin < fVmin) fSmin = fVmin;
255 if (fSmax < fVmin) fSmax = fVmin;
256 if (fSmin > fVmax) fSmin = fVmax;
257 if (fSmax > fVmax) fSmax = fVmax;
258 if (fSmin > fSmax) fSmin = fSmax = (fSmin + fSmax) / 2;
259
260 int relMin = (int)((fHeight-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
261 int relMax = (int)((fHeight-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
262
263 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2-6, relMin, fWidth/2+5, relMin);
264 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2-6, relMin, fWidth/2-6, relMax);
265 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+5, relMax, fWidth/2-6, relMax);
266 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+5, relMax, fWidth/2+5, relMin);
267
268 if (relMin-1 > 8) {
269 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, 8, fWidth/2-1, relMin-1);
270 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, 8, fWidth/2+1, relMin-1);
271 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2, 8, fWidth/2, relMin-1);
272 }
273 if (relMax+1 < (int)fHeight-8) {
274 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, relMax+1, fWidth/2-1, fHeight-8);
275 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, relMax+1, fWidth/2+1, fHeight-8);
276 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2, relMax+1, fWidth/2, fHeight-8);
277 }
278
279 // check scale
280 if (fScale == 1) fScale++;
281 if (fScale * 2 > (int)fHeight) fScale = 0;
282 if (fScale > 0 && !(fScaleType & kDoubleScaleNo)) {
283 int lines = ((int)fHeight-16) / fScale;
284 int remain = ((int)fHeight-16) % fScale;
285 if (lines < 1) lines = 1;
286 for (int i = 0; i <= lines; i++) {
287 int y = i * fScale + (i * remain) / lines;
288 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+8, y+7, fWidth/2+10, y+7);
290 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-9, y+7, fWidth/2-11, y+7);
291 }
292 }
293
294 if (fSliderPic) {
295 Int_t xpos = (fWidth/2) - (fSliderPic->GetWidth()/2);
296 Int_t ypos = relMin + 2;
297 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
298 ypos = relMax - fSliderPic->GetHeight() - 2;
299 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
300 }
301 if (fMarkEnds) {
302 // Draw scaling zones.
303 int y1 = (relMax - relMin) / 4 + relMin;
304 int y2 = (relMax - relMin) / 4 * 3 + relMin;
305 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-6, y1, fWidth/2+5, y1);
306 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-6, y2, fWidth/2+5, y2);
307 }
308}
309
310////////////////////////////////////////////////////////////////////////////////
311/// Handle mouse button event in vertical slider.
312
314{
315 if (event->fType == kButtonPress && event->fCode == kButton1) {
316 // constrain to the slider width
317 if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
318 return kTRUE;
319 }
320 fPressPoint = event->fY;
323
324 int relMin = (int)((fHeight-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
325 int relMax = (int)((fHeight-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
326 if (fPressPoint < (relMax - relMin) / 4 + relMin)
327 // move only min value
328 fMove = 1;
329 else if (fPressPoint > (relMax - relMin) / 4 * 3 + relMin)
330 // move only max value
331 fMove = 2;
332 else
333 // move min and max value
334 fMove = 3;
335
338 Pressed();
339
340 // last argument kFALSE forces all specified events to this window
343 kTRUE, kFALSE);
344 } else if (event->fType == kButtonRelease && event->fCode == kButton1) {
347 Released();
348 fMove = 0;
349
350 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
351 } else
352 fMove = 0;
353
354 return kTRUE;
355}
356
357////////////////////////////////////////////////////////////////////////////////
358/// Handle mouse motion event in vertical slider.
359
361{
362 ChangeCursor(event);
363 if (fMove == 0) return kTRUE;
364
365 static Long64_t was = gSystem->Now();
366 Long64_t now = gSystem->Now();
367
368 if ((now-was) < 50) return kTRUE;
369 was = now;
370
371 int diff;
372 Float_t oldMin, oldMax;
373
374 diff = event->fY - fPressPoint;
375 oldMin = fSmin;
376 oldMax = fSmax;
377
378 if (fMove == 1) {
379 // change of min value
380 fSmin = fPressSmin + diff * (fVmax - fVmin) / (fHeight-16);
381 if (fSmin < fVmin) fSmin = fVmin;
382 if (fSmin > fSmax) fSmin = fSmax;
383 } else if (fMove == 2) {
384 // change of max value
385 fSmax = fPressSmax + diff * (fVmax - fVmin) / (fHeight-16);
386 if (fSmax > fVmax) fSmax = fVmax;
387 if (fSmax < fSmin) fSmax = fSmin;
388 } else if (fMove == 3) {
389 // change of min and of max value
390 Float_t logicalDiff;
391 logicalDiff = diff * (fVmax - fVmin) / (fHeight-16);
392 if (fPressSmax + logicalDiff > fVmax)
393 logicalDiff = fVmax - fPressSmax;
394 if (fPressSmin + logicalDiff < fVmin)
395 logicalDiff = fVmin - fPressSmin;
396 fSmax = fPressSmax + logicalDiff;
397 fSmin = fPressSmin + logicalDiff;
398 }
399
400 // check if position has changed
401 if (fMove != 0 && (fSmax != oldMax || fSmin != oldMin)) {
402 fClient->NeedRedraw(this);
406 }
407 return kTRUE;
408}
409
410////////////////////////////////////////////////////////////////////////////////
411/// Create horizontal slider widget.
412
414 UInt_t options, ULong_t back,
415 Bool_t reversed, Bool_t mark_ends)
416 : TGDoubleSlider(p, w, kDoubleSliderHeight, type, id, options, back,
417 reversed, mark_ends)
418{
419 fXp = 0;
420 fSliderPic = fClient->GetPicture("sliderh.xpm");
421
422 if (!fSliderPic)
423 Error("TGDoubleHSlider", "sliderh.xpm not found");
424 // set initial values
425 fSmin = w/8*3; fSmax = w/8*5; fVmin = 0; fVmax = w;
428}
429
430////////////////////////////////////////////////////////////////////////////////
431/// Delete a horizontal slider widget.
432
434{
436}
437
438////////////////////////////////////////////////////////////////////////////////
439/// Redraw horizontal slider widget.
440
442{
444
445 // cleanup drawable
446 gVirtualX->ClearWindow(fId);
447
448 if (fSmin < fVmin) fSmin = fVmin;
449 if (fSmax > fVmax) fSmax = fVmax;
450 if (fSmin > fSmax) fSmin = fSmax = (fSmin + fSmax) / 2;
451
452 int relMin = (int)((fWidth-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
453 int relMax = (int)((fWidth-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
454
455 gVirtualX->DrawLine(fId, GetHilightGC()(), relMin, fHeight/2-6, relMin, fHeight/2+5);
456 gVirtualX->DrawLine(fId, GetHilightGC()(), relMax, fHeight/2-6, relMin, fHeight/2-6);
457 gVirtualX->DrawLine(fId, GetBlackGC()(), relMax, fHeight/2+5, relMax, fHeight/2-6);
458 gVirtualX->DrawLine(fId, GetBlackGC()(), relMin, fHeight/2+5, relMax, fHeight/2+5);
459
460 if (relMin-1 > 8) {
461 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2-1, relMin-1, fHeight/2-1);
462 gVirtualX->DrawLine(fId, GetHilightGC()(), 8, fHeight/2+1, relMin-1, fHeight/2+1);
463 gVirtualX->DrawLine(fId, GetBlackGC()(), 8, fHeight/2, relMin-1, fHeight/2);
464 }
465 if (relMax+1 < (int)fWidth-8) {
466 gVirtualX->DrawLine(fId, GetShadowGC()(), relMax+1, fHeight/2-1, fWidth-8, fHeight/2-1);
467 gVirtualX->DrawLine(fId, GetHilightGC()(), relMax+1, fHeight/2+1, fWidth-8, fHeight/2+1);
468 gVirtualX->DrawLine(fId, GetBlackGC()(), relMax+1, fHeight/2, fWidth-8, fHeight/2);
469 }
470
471 if (fScale == 1) fScale++;
472 if (fScale * 2 > (int)fWidth) fScale = 0;
473 if (fScale > 0 && !(fScaleType & kDoubleScaleNo)) {
474 int lines = ((int)fWidth-16) / fScale;
475 int remain = ((int)fWidth-16) % fScale;
476 if (lines < 1) lines = 1;
477 for (int i = 0; i <= lines; i++) {
478 int x = i * fScale + (i * remain) / lines;
479 gVirtualX->DrawLine(fId, GetBlackGC()(), x+7, fHeight/2+8, x+7, fHeight/2+10);
481 gVirtualX->DrawLine(fId, GetBlackGC()(), x+7, fHeight/2-9, x+7, fHeight/2-11);
482 }
483 }
484
485 if (fSliderPic) {
486 Int_t ypos = (fHeight/2) - (fSliderPic->GetHeight()/2);
487 Int_t xpos = relMin + 2;
488 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
489 xpos = relMax - fSliderPic->GetWidth() - 2;
490 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
491 }
492 if (fMarkEnds) {
493 // Draw scaling zones.
494 int x1 = (relMax - relMin) / 4 + relMin;
495 int x2 = (relMax - relMin) / 4 * 3 + relMin;
496 gVirtualX->DrawLine(fId, GetBlackGC()(), x1, fHeight/2-6, x1, fHeight/2+5);
497 gVirtualX->DrawLine(fId, GetBlackGC()(), x2, fHeight/2-6, x2, fHeight/2+5);
498 }
499}
500
501////////////////////////////////////////////////////////////////////////////////
502/// Handle mouse button event in horizontal slider widget.
503
505{
506 if (event->fType == kButtonPress && event->fCode == kButton1) {
507 // constrain to the slider height
508 if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
509 return kTRUE;
510 }
511 fPressPoint = event->fX;
514
515 int relMin = (int)((fWidth-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
516 int relMax = (int)((fWidth-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
517 if (fPressPoint < (relMax - relMin) / 4 + relMin)
518 // move only min value
519 fMove = 1;
520 else if (fPressPoint > (relMax - relMin) / 4 * 3 + relMin)
521 // move only max value
522 fMove = 2;
523 else
524 // move min and max value
525 fMove = 3;
526
529 Pressed();
530
531 // last argument kFALSE forces all specified events to this window
534 kTRUE, kFALSE);
535 } else if (event->fType == kButtonRelease && event->fCode == kButton1) {
538 Released();
539 fMove = 0;
540
541 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
542 } else
543 fMove = 0;
544
545 return kTRUE;
546}
547
548////////////////////////////////////////////////////////////////////////////////
549/// Handle mouse motion event in horizontal slide widget.
550
552{
553 ChangeCursor(event);
554 if (fMove == 0) return kTRUE;
555
556 static Long64_t was = gSystem->Now();
557 Long64_t now = gSystem->Now();
558
559 if ((now-was) < 50) return kTRUE;
560 was = now;
561
562 int diff;
563 Float_t oldMin, oldMax;
564
565 diff = event->fX - fPressPoint;
566 oldMin = fSmin;
567 oldMax = fSmax;
568
569 if (fMove == 1) {
570 // change of min value
571 fSmin = fPressSmin + diff * (fVmax - fVmin) / (fWidth-16);
572 if (fSmin < fVmin) fSmin = fVmin;
573 if (fSmin > fSmax) fSmin = fSmax;
574 } else if (fMove == 2) {
575 // change of max value
576 fSmax = fPressSmax + diff * (fVmax - fVmin) / (fWidth-16);
577 if (fSmax > fVmax) fSmax = fVmax;
578 if (fSmax < fSmin) fSmax = fSmin;
579 } else if (fMove == 3) {
580 // change of min and of max value
581 Float_t logicalDiff;
582 logicalDiff = diff * (fVmax - fVmin) / (fWidth-16);
583 if (fPressSmax + logicalDiff > fVmax)
584 logicalDiff = fVmax - fPressSmax;
585 if (fPressSmin + logicalDiff < fVmin)
586 logicalDiff = fVmin - fPressSmin;
587 fSmax = fPressSmax + logicalDiff;
588 fSmin = fPressSmin + logicalDiff;
589 }
590
591 // check if position has changed
592 if (fMove != 0 && (fSmax != oldMax || fSmin != oldMin)) {
593 fClient->NeedRedraw(this);
597 }
598 return kTRUE;
599}
600
601////////////////////////////////////////////////////////////////////////////////
602/// Save an horizontal slider as a C++ statement(s) on output stream out.
603
604void TGDoubleHSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
605{
606 SaveUserColor(out, option);
607
608 out <<" TGDoubleHSlider *";
609 out << GetName() << " = new TGDoubleHSlider(" << fParent->GetName()
610 << "," << GetWidth() << ",";
611 out << GetSString() << "," << WidgetId() << ",";
612 out << GetOptionString() << ",ucolor";
613 if (fMarkEnds) {
614 if (fReversedScale)
615 out << ",kTRUE,kTRUE);" << std::endl;
616 else
617 out << ",kFALSE,kTRUE);" << std::endl;
618 } else if (fReversedScale) {
619 out << ",kTRUE);" << std::endl;
620 } else {
621 out << ");" << std::endl;
622 }
623 if (option && strstr(option, "keep_names"))
624 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
625
626 if (fVmin != 0 || fVmax != (Int_t)fWidth)
627 out << " " << GetName() << "->SetRange(" << fVmin << "," << fVmax
628 << ");" << std::endl;
629
630 if (fSmin != fWidth/8*3 || fSmax != fWidth/8*5)
631 out << " " << GetName() << "->SetPosition(" << GetMinPosition()
632 << "," << GetMaxPosition() << ");" << std::endl;
633
634 if (fScale != 10)
635 out << " " << GetName() << "->SetScale(" << fScale << ");" << std::endl;
636
637}
638
639////////////////////////////////////////////////////////////////////////////////
640/// Save an horizontal slider as a C++ statement(s) on output stream out.
641
642void TGDoubleVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
643{
644 SaveUserColor(out, option);
645
646 out<<" TGDoubleVSlider *";
647 out << GetName() << " = new TGDoubleVSlider("<< fParent->GetName()
648 << "," << GetHeight() << ",";
649 out << GetSString() << "," << WidgetId() << ",";
650 out << GetOptionString() << ",ucolor";
651 if (fMarkEnds) {
652 if (fReversedScale)
653 out << ",kTRUE,kTRUE);" << std::endl;
654 else
655 out << ",kFALSE,kTRUE);" << std::endl;
656 } else if (fReversedScale) {
657 out << ",kTRUE);" << std::endl;
658 } else {
659 out << ");" << std::endl;
660 }
661 if (option && strstr(option, "keep_names"))
662 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
663
664 if (fVmin != 0 || fVmax != (Int_t)fHeight)
665 out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax
666 << ");" << std::endl;
667
668
669 if (fSmin != fHeight/8*3 || fSmax != fHeight/8*5)
670 out << " " << GetName() << "->SetPosition(" << GetMinPosition()
671 << "," << GetMaxPosition() << ");" << std::endl;
672
673
674 if (fScale != 10)
675 out << " " << GetName() << "->SetScale(" << fScale << ");" << std::endl;
676
677}
@ kButtonRelease
Definition: GuiTypes.h:59
@ kButtonPress
Definition: GuiTypes.h:59
Handle_t Cursor_t
Definition: GuiTypes.h:33
const Mask_t kButtonPressMask
Definition: GuiTypes.h:160
const Mask_t kAnyModifier
Definition: GuiTypes.h:209
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:162
@ kVerticalFrame
Definition: GuiTypes.h:381
@ kHorizontalFrame
Definition: GuiTypes.h:382
const Handle_t kNone
Definition: GuiTypes.h:87
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:161
@ kRightSide
Definition: GuiTypes.h:372
@ kBottomSide
Definition: GuiTypes.h:372
@ kTopSide
Definition: GuiTypes.h:372
@ kLeftSide
Definition: GuiTypes.h:372
@ kButton1
Definition: GuiTypes.h:213
@ kAnyButton
Definition: GuiTypes.h:213
#define h(i)
Definition: RSha256.hxx:106
#define e(i)
Definition: RSha256.hxx:103
static const double x2[5]
static const double x1[5]
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
unsigned long ULong_t
Definition: RtypesCore.h:53
long long Long64_t
Definition: RtypesCore.h:71
float Float_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassImp(name)
Definition: Rtypes.h:361
@ kDoubleScaleBoth
@ kDoubleScaleDownRight
@ kDoubleScaleNo
@ kDoubleSliderWidth
@ kDoubleSliderHeight
@ kWidgetWantFocus
Definition: TGWidget.h:46
XFontStruct * id
Definition: TGX11.cxx:108
int type
Definition: TGX11.cxx:120
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
R__EXTERN TSystem * gSystem
Definition: TSystem.h:556
#define gVirtualX
Definition: TVirtualX.h:338
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
@ kSL_RELEASE
@ kSL_POS
@ kC_HSLIDER
@ kSL_PRESS
@ kC_VSLIDER
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2)
Execute string "cmd" via the interpreter.
Definition: TGClient.cxx:913
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:289
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:372
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:308
TGDoubleHSlider(const TGWindow *p=0, UInt_t w=1, UInt_t type=1, Int_t id=-1, UInt_t options=kHorizontalFrame, Pixel_t back=GetDefaultFrameBackground(), Bool_t reversed=kFALSE, Bool_t mark_ends=kFALSE)
Create horizontal slider widget.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an horizontal slider as a C++ statement(s) on output stream out.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in horizontal slide widget.
virtual ~TGDoubleHSlider()
Delete a horizontal slider widget.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in horizontal slider widget.
virtual void DoRedraw()
Redraw horizontal slider widget.
void ChangeCursor(Event_t *event)
Change the cursor shape depending on the slider area.
virtual Float_t GetMaxPosition() const
virtual void PositionChanged()
static void FixBounds(Float_t &min, Float_t &max)
Avoid boundaries to be equal.
virtual Float_t GetMinPosition() const
TGDoubleSlider(const TGDoubleSlider &)
Bool_t fReversedScale
Float_t fPressSmax
virtual void Released()
virtual void Pressed()
const TGPicture * fSliderPic
TString GetSString() const
Returns the slider type as a string - used in SavePrimitive()
Float_t fPressSmin
TGDoubleVSlider(const TGWindow *p=0, UInt_t h=1, UInt_t type=1, Int_t id=-1, UInt_t options=kVerticalFrame, Pixel_t back=GetDefaultFrameBackground(), Bool_t reversed=kFALSE, Bool_t mark_ends=kFALSE)
Create a vertical slider widget.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical slider.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an horizontal slider as a C++ statement(s) on output stream out.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical slider.
virtual ~TGDoubleVSlider()
Delete vertical slider widget.
virtual void DoRedraw()
Redraw vertical slider widget.
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:323
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:719
UInt_t fHeight
Definition: TGFrame.h:113
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:739
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:629
virtual UInt_t GetOptions() const
Definition: TGFrame.h:222
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2464
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:749
UInt_t fWidth
Definition: TGFrame.h:112
UInt_t GetHeight() const
Definition: TGFrame.h:250
UInt_t GetWidth() const
Definition: TGFrame.h:249
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2437
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:759
TGClient * fClient
Definition: TGObject.h:37
Handle_t fId
Definition: TGObject.h:36
UInt_t GetHeight() const
Definition: TGPicture.h:64
void Draw(Option_t *="")
Default Draw method for all objects.
Definition: TGPicture.h:57
UInt_t GetWidth() const
Definition: TGPicture.h:63
Int_t fWidgetId
Definition: TGWidget.h:58
TString fCommand
Definition: TGWidget.h:61
Int_t fWidgetFlags
Definition: TGWidget.h:59
const TGWindow * fMsgWindow
Definition: TGWidget.h:60
Int_t WidgetId() const
Definition: TGWidget.h:80
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:119
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:326
const TGWindow * fParent
Definition: TGWindow.h:36
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition: TSystem.cxx:461
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
EGEventType fType
Definition: GuiTypes.h:174
Int_t fY
Definition: GuiTypes.h:177
Int_t fX
Definition: GuiTypes.h:177
UInt_t fCode
Definition: GuiTypes.h:179