Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/** \class TGDoubleSlider
25 \ingroup guiwidgets
26
27DoubleSlider widgets allow easy selection of a min and a max value
28out of a range.
29DoubleSliders can be either horizontal or vertical oriented and
30there is a choice of three different types of tick marks.
31
32To change the min value press the mouse near to the left / bottom
33edge of the slider.
34To change the max value press the mouse near to the right / top
35edge of the slider.
36To change both values simultaneously press the mouse near to the
37center of the slider.
38
39TGDoubleSlider is an abstract base class. Use the concrete
40TGDoubleVSlider and TGDoubleHSlider.
41
42
43\class TGDoubleVSlider
44\ingroup guiwidgets
45
46Dragging the slider will generate the event:
47 - kC_VSLIDER, kSL_POS, slider id, 0
48
49Pressing the mouse will generate the event:
50 - kC_VSLIDER, kSL_PRESS, slider id, 0
51
52Releasing the mouse will generate the event:
53 - kC_VSLIDER, kSL_RELEASE, slider id, 0
54
55Use the functions GetMinPosition(), GetMaxPosition() and
56GetPosition() to retrieve the position of the slider.
57
58
59\class TGDoubleHSlider
60\ingroup guiwidgets
61
62Dragging the slider will generate the event:
63 - kC_HSLIDER, kSL_POS, slider id, 0
64
65Pressing the mouse will generate the event:
66 - kC_HSLIDER, kSL_PRESS, slider id, 0
67
68Releasing the mouse will generate the event:
69 - kC_HSLIDER, kSL_RELEASE, slider id, 0
70
71Use the functions GetMinPosition(), GetMaxPosition() and
72GetPosition() to retrieve the position of the slider.
73
74*/
75
76
77#include "TGDoubleSlider.h"
78#include "TGPicture.h"
79#include "TSystem.h"
80#include "TVirtualX.h"
81
82#include <iostream>
83
84
85
86////////////////////////////////////////////////////////////////////////////////
87/// Slider constructor.
88
90 UInt_t options, Pixel_t back,
92 : TGFrame(p, w, h, options, back)
93{
94 fSliderPic = 0;
95
96 fWidgetId = id;
98 fMsgWindow = p;
99
101 fScale = 10;
102 fMove = 0;
103
104 fPos = fSmin = fSmax = 0.0;
105 fRelPos = 0;
106 fVmin = fVmax = 0.0;
107 fPressPoint = 0;
108 fPressSmin = fPressSmax = 0.0;
109
112
113 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
118}
119
120////////////////////////////////////////////////////////////////////////////////
121/// Avoid boundaries to be equal.
122
124{
125 if (min > max) min = max;
126
127 Double_t eps = 1e-6;
128 if (max - min < eps) {
129 if (max == 0)
130 max += eps;
131 else
132 max += max*eps;
133 if (min == 0)
134 min -= eps;
135 else
136 min -= min*eps;
137 }
138}
139
140////////////////////////////////////////////////////////////////////////////////
141/// Returns the slider type as a string - used in SavePrimitive()
142
144{
145 TString stype;
146
147 if (fScaleType) {
149 if (stype.Length() == 0)
150 stype = "kDoubleScaleNo";
151 else
152 stype += " | kDoubleScaleNo";
153 }
155 if (stype.Length() == 0)
156 stype = "kDoubleScaleDownRight";
157 else
158 stype += " | kDoubleScaleDownRight";
159 }
161 if (stype.Length() == 0)
162 stype = "kDoubleScaleBoth";
163 else
164 stype += " | kDoubleScaleBoth";
165 }
166 }
167 return stype;
168}
169
170////////////////////////////////////////////////////////////////////////////////
171/// Change the cursor shape depending on the slider area.
172
174{
175 static Cursor_t topCur = kNone, leftCur = kNone;
176 static Cursor_t botCur = kNone, rightCur = kNone;
177 Int_t hw = 0, wh = 0, xy = 0, yx = 0;
179
180 if (topCur == kNone)
181 topCur = gVirtualX->CreateCursor(kTopSide);
182 if (leftCur == kNone)
183 leftCur = gVirtualX->CreateCursor(kLeftSide);
184 if (botCur == kNone)
185 botCur = gVirtualX->CreateCursor(kBottomSide);
186 if (rightCur == kNone)
187 rightCur = gVirtualX->CreateCursor(kRightSide);
188 if (GetOptions() & kVerticalFrame) {
189 hw = (Int_t)fWidth;
190 wh = (Int_t)fHeight;
191 xy = (Int_t)event->fX;
192 yx = (Int_t)event->fY;
193 minCur = topCur;
194 maxCur = botCur;
195 }
196 else if (GetOptions() & kHorizontalFrame) {
197 hw = (Int_t)fHeight;
198 wh = (Int_t)fWidth;
199 xy = (Int_t)event->fY;
200 yx = (Int_t)event->fX;
201 minCur = leftCur;
203 }
204 else return;
205
206 Int_t relMin = (Int_t)((wh-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
207 Int_t relMax = (Int_t)((wh-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
208 // constrain to the slider width
209 if (xy > hw/2-7 && xy < hw/2+7 && fMove != 3) {
210 // if the mouse pointer is in the top resizing zone,
211 // and we are not already moving the bottom side,
212 // set the cursor shape as TopSide
213 if ((yx <= (relMax - relMin) / 4 + relMin) &&
214 (yx >= relMin) && (fMove != 2))
215 gVirtualX->SetCursor(fId, minCur);
216 // if the mouse pointer is in the bottom resizing zone,
217 // and we are not already moving the top side,
218 // set the cursor shape as BottomSide
219 else if ((yx >= (relMax - relMin) / 4 * 3 + relMin) &&
220 (yx <= relMax) && (fMove != 1))
221 gVirtualX->SetCursor(fId, maxCur);
222 // if we are not moving any side, restore the cursor
223 else if ((fMove < 1) || (fMove > 2))
224 gVirtualX->SetCursor(fId, kNone);
225 }
226 // if we are not inside the slider, and not moving any side,
227 // restore the cursor
228 else if ((fMove < 1) || (fMove > 2))
229 gVirtualX->SetCursor(fId, kNone);
230}
231
232////////////////////////////////////////////////////////////////////////////////
233/// Create a vertical slider widget.
234
236 UInt_t options, ULong_t back,
238 : TGDoubleSlider(p, kDoubleSliderWidth, h, type, id, options, back,
240{
241 fYp = 0;
242 fSliderPic = fClient->GetPicture("sliderv.xpm");
243
244 if (!fSliderPic)
245 Error("TGDoubleVSlider", "sliderv.xpm not found");
246 // set initial values
247 fSmin = h/8*3; fSmax = h/8*5; fVmin = 0; fVmax = h;
250}
251
252////////////////////////////////////////////////////////////////////////////////
253/// Delete vertical slider widget.
254
259
260////////////////////////////////////////////////////////////////////////////////
261/// Redraw vertical slider widget.
262
264{
266
267 // cleanup the drawable
268 gVirtualX->ClearWindow(fId);
269
270 if (fSmin < fVmin) fSmin = fVmin;
271 if (fSmax < fVmin) fSmax = fVmin;
272 if (fSmin > fVmax) fSmin = fVmax;
273 if (fSmax > fVmax) fSmax = fVmax;
274 if (fSmin > fSmax) fSmin = fSmax = (fSmin + fSmax) / 2;
275
276 int relMin = (int)((fHeight-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
277 int relMax = (int)((fHeight-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
278
279 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2-6, relMin, fWidth/2+5, relMin);
280 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2-6, relMin, fWidth/2-6, relMax);
281 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+5, relMax, fWidth/2-6, relMax);
282 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+5, relMax, fWidth/2+5, relMin);
283
284 if (relMin-1 > 8) {
285 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, 8, fWidth/2-1, relMin-1);
286 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, 8, fWidth/2+1, relMin-1);
287 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2, 8, fWidth/2, relMin-1);
288 }
289 if (relMax+1 < (int)fHeight-8) {
290 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, relMax+1, fWidth/2-1, fHeight-8);
291 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, relMax+1, fWidth/2+1, fHeight-8);
292 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2, relMax+1, fWidth/2, fHeight-8);
293 }
294
295 // check scale
296 if (fScale == 1) fScale++;
297 if (fScale * 2 > (int)fHeight) fScale = 0;
298 if (fScale > 0 && !(fScaleType & kDoubleScaleNo)) {
299 int lines = ((int)fHeight-16) / fScale;
300 int remain = ((int)fHeight-16) % fScale;
301 if (lines < 1) lines = 1;
302 for (int i = 0; i <= lines; i++) {
303 int y = i * fScale + (i * remain) / lines;
304 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+8, y+7, fWidth/2+10, y+7);
306 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-9, y+7, fWidth/2-11, y+7);
307 }
308 }
309
310 if (fSliderPic) {
311 Int_t xpos = (fWidth/2) - (fSliderPic->GetWidth()/2);
312 Int_t ypos = relMin + 2;
313 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
314 ypos = relMax - fSliderPic->GetHeight() - 2;
315 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
316 }
317 if (fMarkEnds) {
318 // Draw scaling zones.
319 int y1 = (relMax - relMin) / 4 + relMin;
320 int y2 = (relMax - relMin) / 4 * 3 + relMin;
321 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-6, y1, fWidth/2+5, y1);
322 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-6, y2, fWidth/2+5, y2);
323 }
324}
325
326////////////////////////////////////////////////////////////////////////////////
327/// Handle mouse button event in vertical slider.
328
330{
331 if (event->fType == kButtonPress && event->fCode == kButton1) {
332 // constrain to the slider width
333 if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
334 return kTRUE;
335 }
336 fPressPoint = event->fY;
339
340 int relMin = (int)((fHeight-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
341 int relMax = (int)((fHeight-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
342 if (fPressPoint < (relMax - relMin) / 4 + relMin)
343 // move only min value
344 fMove = 1;
345 else if (fPressPoint > (relMax - relMin) / 4 * 3 + relMin)
346 // move only max value
347 fMove = 2;
348 else
349 // move min and max value
350 fMove = 3;
351
354 Pressed();
355
356 // last argument kFALSE forces all specified events to this window
359 kTRUE, kFALSE);
360 } else if (event->fType == kButtonRelease && event->fCode == kButton1) {
363 Released();
364 fMove = 0;
365
366 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
367 } else
368 fMove = 0;
369
370 return kTRUE;
371}
372
373////////////////////////////////////////////////////////////////////////////////
374/// Handle mouse motion event in vertical slider.
375
377{
378 ChangeCursor(event);
379 if (fMove == 0) return kTRUE;
380
381 static Long64_t was = gSystem->Now();
382 Long64_t now = gSystem->Now();
383
384 if ((now-was) < 50) return kTRUE;
385 was = now;
386
387 int diff;
389
390 diff = event->fY - fPressPoint;
391 oldMin = fSmin;
392 oldMax = fSmax;
393
394 if (fMove == 1) {
395 // change of min value
396 fSmin = fPressSmin + diff * (fVmax - fVmin) / (fHeight-16);
397 if (fSmin < fVmin) fSmin = fVmin;
398 if (fSmin > fSmax) fSmin = fSmax;
399 } else if (fMove == 2) {
400 // change of max value
401 fSmax = fPressSmax + diff * (fVmax - fVmin) / (fHeight-16);
402 if (fSmax > fVmax) fSmax = fVmax;
403 if (fSmax < fSmin) fSmax = fSmin;
404 } else if (fMove == 3) {
405 // change of min and of max value
407 logicalDiff = diff * (fVmax - fVmin) / (fHeight-16);
414 }
415
416 // check if position has changed
417 if (fMove != 0 && (fSmax != oldMax || fSmin != oldMin)) {
418 fClient->NeedRedraw(this);
422 }
423 return kTRUE;
424}
425
426////////////////////////////////////////////////////////////////////////////////
427/// Create horizontal slider widget.
428
430 UInt_t options, ULong_t back,
432 : TGDoubleSlider(p, w, kDoubleSliderHeight, type, id, options, back,
434{
435 fXp = 0;
436 fSliderPic = fClient->GetPicture("sliderh.xpm");
437
438 if (!fSliderPic)
439 Error("TGDoubleHSlider", "sliderh.xpm not found");
440 // set initial values
441 fSmin = w/8*3; fSmax = w/8*5; fVmin = 0; fVmax = w;
444}
445
446////////////////////////////////////////////////////////////////////////////////
447/// Delete a horizontal slider widget.
448
453
454////////////////////////////////////////////////////////////////////////////////
455/// Redraw horizontal slider widget.
456
458{
460
461 // cleanup drawable
462 gVirtualX->ClearWindow(fId);
463
464 if (fSmin < fVmin) fSmin = fVmin;
465 if (fSmax > fVmax) fSmax = fVmax;
466 if (fSmin > fSmax) fSmin = fSmax = (fSmin + fSmax) / 2;
467
468 int relMin = (int)((fWidth-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
469 int relMax = (int)((fWidth-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
470
471 gVirtualX->DrawLine(fId, GetHilightGC()(), relMin, fHeight/2-6, relMin, fHeight/2+5);
472 gVirtualX->DrawLine(fId, GetHilightGC()(), relMax, fHeight/2-6, relMin, fHeight/2-6);
473 gVirtualX->DrawLine(fId, GetBlackGC()(), relMax, fHeight/2+5, relMax, fHeight/2-6);
474 gVirtualX->DrawLine(fId, GetBlackGC()(), relMin, fHeight/2+5, relMax, fHeight/2+5);
475
476 if (relMin-1 > 8) {
477 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2-1, relMin-1, fHeight/2-1);
478 gVirtualX->DrawLine(fId, GetHilightGC()(), 8, fHeight/2+1, relMin-1, fHeight/2+1);
479 gVirtualX->DrawLine(fId, GetBlackGC()(), 8, fHeight/2, relMin-1, fHeight/2);
480 }
481 if (relMax+1 < (int)fWidth-8) {
482 gVirtualX->DrawLine(fId, GetShadowGC()(), relMax+1, fHeight/2-1, fWidth-8, fHeight/2-1);
483 gVirtualX->DrawLine(fId, GetHilightGC()(), relMax+1, fHeight/2+1, fWidth-8, fHeight/2+1);
484 gVirtualX->DrawLine(fId, GetBlackGC()(), relMax+1, fHeight/2, fWidth-8, fHeight/2);
485 }
486
487 if (fScale == 1) fScale++;
488 if (fScale * 2 > (int)fWidth) fScale = 0;
489 if (fScale > 0 && !(fScaleType & kDoubleScaleNo)) {
490 int lines = ((int)fWidth-16) / fScale;
491 int remain = ((int)fWidth-16) % fScale;
492 if (lines < 1) lines = 1;
493 for (int i = 0; i <= lines; i++) {
494 int x = i * fScale + (i * remain) / lines;
495 gVirtualX->DrawLine(fId, GetBlackGC()(), x+7, fHeight/2+8, x+7, fHeight/2+10);
497 gVirtualX->DrawLine(fId, GetBlackGC()(), x+7, fHeight/2-9, x+7, fHeight/2-11);
498 }
499 }
500
501 if (fSliderPic) {
502 Int_t ypos = (fHeight/2) - (fSliderPic->GetHeight()/2);
503 Int_t xpos = relMin + 2;
504 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
505 xpos = relMax - fSliderPic->GetWidth() - 2;
506 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
507 }
508 if (fMarkEnds) {
509 // Draw scaling zones.
510 int x1 = (relMax - relMin) / 4 + relMin;
511 int x2 = (relMax - relMin) / 4 * 3 + relMin;
512 gVirtualX->DrawLine(fId, GetBlackGC()(), x1, fHeight/2-6, x1, fHeight/2+5);
513 gVirtualX->DrawLine(fId, GetBlackGC()(), x2, fHeight/2-6, x2, fHeight/2+5);
514 }
515}
516
517////////////////////////////////////////////////////////////////////////////////
518/// Handle mouse button event in horizontal slider widget.
519
521{
522 if (event->fType == kButtonPress && event->fCode == kButton1) {
523 // constrain to the slider height
524 if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
525 return kTRUE;
526 }
527 fPressPoint = event->fX;
530
531 int relMin = (int)((fWidth-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
532 int relMax = (int)((fWidth-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
533 if (fPressPoint < (relMax - relMin) / 4 + relMin)
534 // move only min value
535 fMove = 1;
536 else if (fPressPoint > (relMax - relMin) / 4 * 3 + relMin)
537 // move only max value
538 fMove = 2;
539 else
540 // move min and max value
541 fMove = 3;
542
545 Pressed();
546
547 // last argument kFALSE forces all specified events to this window
550 kTRUE, kFALSE);
551 } else if (event->fType == kButtonRelease && event->fCode == kButton1) {
554 Released();
555 fMove = 0;
556
557 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
558 } else
559 fMove = 0;
560
561 return kTRUE;
562}
563
564////////////////////////////////////////////////////////////////////////////////
565/// Handle mouse motion event in horizontal slide widget.
566
568{
569 ChangeCursor(event);
570 if (fMove == 0) return kTRUE;
571
572 static Long64_t was = gSystem->Now();
573 Long64_t now = gSystem->Now();
574
575 if ((now-was) < 50) return kTRUE;
576 was = now;
577
578 int diff;
580
581 diff = event->fX - fPressPoint;
582 oldMin = fSmin;
583 oldMax = fSmax;
584
585 if (fMove == 1) {
586 // change of min value
587 fSmin = fPressSmin + diff * (fVmax - fVmin) / (fWidth-16);
588 if (fSmin < fVmin) fSmin = fVmin;
589 if (fSmin > fSmax) fSmin = fSmax;
590 } else if (fMove == 2) {
591 // change of max value
592 fSmax = fPressSmax + diff * (fVmax - fVmin) / (fWidth-16);
593 if (fSmax > fVmax) fSmax = fVmax;
594 if (fSmax < fSmin) fSmax = fSmin;
595 } else if (fMove == 3) {
596 // change of min and of max value
598 logicalDiff = diff * (fVmax - fVmin) / (fWidth-16);
605 }
606
607 // check if position has changed
608 if (fMove != 0 && (fSmax != oldMax || fSmin != oldMin)) {
609 fClient->NeedRedraw(this);
613 }
614 return kTRUE;
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Save an horizontal slider as a C++ statement(s) on output stream out.
619
620void TGDoubleHSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
621{
622 SaveUserColor(out, option);
623
624 out << " TGDoubleHSlider *" << GetName() << " = new TGDoubleHSlider(" << fParent->GetName() << "," << GetWidth()
625 << ", " << GetSString() << ", " << WidgetId() << ", " << GetOptionString() << ", ucolor";
626 if (fMarkEnds) {
627 if (fReversedScale)
628 out << ", kTRUE, kTRUE);\n";
629 else
630 out << ", kFALSE, kTRUE);\n";
631 } else if (fReversedScale) {
632 out << ", kTRUE);\n";
633 } else {
634 out << ");\n";
635 }
636 if (option && strstr(option, "keep_names"))
637 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
638
639 if (fVmin != 0 || fVmax != (Int_t)fWidth)
640 out << " " << GetName() << "->SetRange(" << fVmin << "," << fVmax << ");\n";
641
642 if (fSmin != fWidth / 8 * 3 || fSmax != fWidth / 8 * 5)
643 out << " " << GetName() << "->SetPosition(" << GetMinPosition() << "," << GetMaxPosition() << ");\n";
644
645 if (fScale != 10)
646 out << " " << GetName() << "->SetScale(" << fScale << ");\n";
647}
648
649////////////////////////////////////////////////////////////////////////////////
650/// Save an horizontal slider as a C++ statement(s) on output stream out.
651
652void TGDoubleVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
653{
654 SaveUserColor(out, option);
655
656 out << " TGDoubleVSlider *" << GetName() << " = new TGDoubleVSlider(" << fParent->GetName() << "," << GetHeight()
657 << "," << GetSString() << "," << WidgetId() << "," << GetOptionString() << ", ucolor";
658 if (fMarkEnds) {
659 if (fReversedScale)
660 out << ",kTRUE,kTRUE);\n";
661 else
662 out << ",kFALSE,kTRUE);\n";
663 } else if (fReversedScale) {
664 out << ",kTRUE);\n";
665 } else {
666 out << ");\n";
667 }
668 if (option && strstr(option, "keep_names"))
669 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
670
671 if (fVmin != 0 || fVmax != (Int_t)fHeight)
672 out << " " << GetName() << "->SetRange(" << fVmin << "," << fVmax << ");\n";
673
674 if (fSmin != fHeight / 8 * 3 || fSmax != fHeight / 8 * 5)
675 out << " " << GetName() << "->SetPosition(" << GetMinPosition() << "," << GetMaxPosition() << ");\n";
676
677 if (fScale != 10)
678 out << " " << GetName() << "->SetScale(" << fScale << ");\n";
679}
@ kButtonRelease
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
@ kRightSide
Definition GuiTypes.h:373
@ kBottomSide
Definition GuiTypes.h:373
@ kTopSide
Definition GuiTypes.h:373
@ kLeftSide
Definition GuiTypes.h:373
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kAnyModifier
Definition GuiTypes.h:210
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton1
Definition GuiTypes.h:214
@ kAnyButton
Definition GuiTypes.h:214
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
@ kDoubleScaleBoth
@ kDoubleScaleDownRight
@ kDoubleScaleNo
@ kDoubleSliderWidth
@ kDoubleSliderHeight
@ kWidgetWantFocus
Definition TGWidget.h:35
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint xy
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void xpos
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void ypos
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
#define gVirtualX
Definition TVirtualX.h:337
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:922
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:380
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:316
void DoRedraw() override
Redraw horizontal slider widget.
TGDoubleHSlider(const TGWindow *p=nullptr, 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.
Int_t fXp
horizontal slider x position in pixel coordinates
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in horizontal slide widget.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an horizontal slider as a C++ statement(s) on output stream out.
~TGDoubleHSlider() override
Delete a horizontal slider widget.
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in horizontal slider widget.
DoubleSlider widgets allow easy selection of a min and a max value out of a range.
void ChangeCursor(Event_t *event)
Change the cursor shape depending on the slider area.
virtual Float_t GetMaxPosition() const
Double_t fSmin
logical position of min value of Slider
Int_t fScaleType
tick mark scale type (no, downright, both)
Double_t fPressSmax
logical max position at button press event
virtual void PositionChanged()
TGDoubleSlider(const TGDoubleSlider &)=delete
Double_t fSmax
logical position of max value of Slider
static void FixBounds(Double_t &min, Double_t &max)
Avoid boundaries to be equal.
Double_t fVmax
logical upper limit of slider
Int_t fScale
tick mark scale
Double_t fVmin
logical lower limit of slider
Int_t fMove
1: move min value 2: move max value 3: move min and max value 0: don't move any value
Int_t fRelPos
slider position in pixel coordinates
Double_t fPos
logical position between fVmin and fVmax
virtual Float_t GetMinPosition() const
Bool_t fReversedScale
reverse which end is min and max
Double_t fPressSmin
logical min position at button press event
virtual void Released()
Bool_t fMarkEnds
lines marking where stretch zones begin
virtual void Pressed()
Int_t fPressPoint
mouse position at button press event
const TGPicture * fSliderPic
picture to draw slider ends
TString GetSString() const
returns scaling type as string
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in vertical slider.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an horizontal slider as a C++ statement(s) on output stream out.
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in vertical slider.
TGDoubleVSlider(const TGWindow *p=nullptr, 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.
~TGDoubleVSlider() override
Delete vertical slider widget.
Int_t fYp
vertical slider y position in pixel coordinates
void DoRedraw() override
Redraw vertical slider widget.
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:331
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:727
UInt_t fHeight
frame height
Definition TGFrame.h:88
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:747
virtual UInt_t GetOptions() const
Definition TGFrame.h:199
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2512
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:637
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:757
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:227
UInt_t GetWidth() const
Definition TGFrame.h:226
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2471
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:767
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
Int_t fWidgetId
the widget id (used for event processing)
Definition TGWidget.h:46
TString fCommand
command to be executed
Definition TGWidget.h:49
Int_t fWidgetFlags
widget status flags (OR of EWidgetStatus)
Definition TGWidget.h:47
const TGWindow * fMsgWindow
window which handles widget events
Definition TGWidget.h:48
Int_t WidgetId() const
Definition TGWidget.h:68
ROOT GUI Window base class.
Definition TGWindow.h:23
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
virtual void SetWindowName(const char *name=nullptr)
Set window name.
Definition TGWindow.cxx:127
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:334
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:425
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
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition GuiTypes.h:178
Int_t fX
Definition GuiTypes.h:178
UInt_t fCode
key or button code
Definition GuiTypes.h:180