Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGTripleSlider.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot 20/01/06
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/** \class TGTripleVSlider
26 \ingroup guiwidgets
27
28TripleSlider inherit from DoubleSlider widgets and allow easy
29selection of a min, max and pointer value out of a range.
30The pointer position can be constrained to edges of slider and / or
31can be relative to the slider position.
32
33To change the min value press the mouse near to the left / bottom
34edge of the slider.
35To change the max value press the mouse near to the right / top
36edge of the slider.
37To change both values simultaneously press the mouse near to the
38center of the slider.
39To change pointer value press the mouse on the pointer and drag it
40to the desired position
41
42Dragging the slider will generate the event:
43 - kC_VSLIDER, kSL_POS, slider id, 0
44
45Pressing the mouse will generate the event:
46 - kC_VSLIDER, kSL_PRESS, slider id, 0
47
48Releasing the mouse will generate the event:
49 - kC_VSLIDER, kSL_RELEASE, slider id, 0
50
51Moving the pointer will generate the event:
52 - kC_VSLIDER, kSL_POINTER, slider id, 0
53
54Use the functions GetMinPosition(), GetMaxPosition() and
55GetPosition() to retrieve the position of the slider.
56Use the function GetPointerPosition() to retrieve the position of
57the pointer
58
59*/
60
61
62/** \class TGTripleHSlider
63 \ingroup guiwidgets
64TripleSlider inherit from DoubleSlider widgets and allow easy
65selection of a min, max and pointer value out of a range.
66The pointer position can be constrained to edges of slider and / or
67can be relative to the slider position.
68
69To change the min value press the mouse near to the left / bottom
70edge of the slider.
71To change the max value press the mouse near to the right / top
72edge of the slider.
73To change both values simultaneously press the mouse near to the
74center of the slider.
75To change pointer value press the mouse on the pointer and drag it
76to the desired position
77
78Dragging the slider will generate the event:
79 - kC_HSLIDER, kSL_POS, slider id, 0
80
81Pressing the mouse will generate the event:
82 - kC_HSLIDER, kSL_PRESS, slider id, 0
83
84Releasing the mouse will generate the event:
85 - kC_HSLIDER, kSL_RELEASE, slider id, 0
86
87Moving the pointer will generate the event:
88 - kC_HSLIDER, kSL_POINTER, slider id, 0
89
90Use the functions GetMinPosition(), GetMaxPosition() and
91GetPosition() to retrieve the position of the slider.
92Use the function GetPointerPosition() to retrieve the position of
93the pointer
94
95*/
96
97
98#include "TGTripleSlider.h"
99#include "TGPicture.h"
100#include "TSystem.h"
101#include "TVirtualX.h"
102
103#include <iostream>
104#include <cstdlib>
105
108
109////////////////////////////////////////////////////////////////////////////////
110/// Create a vertical slider widget.
111
113 UInt_t options, ULong_t back,
114 Bool_t reversed, Bool_t mark_ends,
115 Bool_t constrained, Bool_t relative)
116 : TGDoubleVSlider(p, h, type, id, options, back, reversed, mark_ends)
117{
118 fPointerPic = fClient->GetPicture("slider1h.xpm");
119 if (!fPointerPic)
120 Error("TGTripleVSlider", "slider1h.xpm not found");
121 fConstrained = constrained;
122 fRelative = relative;
123 fCz = 0;
124 fSCz = 0;
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Delete vertical slider widget.
131
133{
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Redraw vertical slider widget.
139
141{
143 // Draw Pointer
144 DrawPointer();
145}
146
147////////////////////////////////////////////////////////////////////////////////
148/// Draw slider pointer
149
151{
153}
154
155////////////////////////////////////////////////////////////////////////////////
156/// Handle mouse button event in vertical slider.
157
159{
160 if (event->fType == kButtonPress && event->fCode == kButton1) {
161 // constrain to the slider width
162 if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
163 return kTRUE;
164 }
165 fPressPoint = event->fY;
168
169 int relMin = (int)((fHeight-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
170 int relMax = (int)((fHeight-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
171 if (fPressPoint > (fCz - 5) && fPressPoint < (fCz + 5) &&
172 event->fX > ((Int_t)fWidth / 2) - 7 && event->fX < ((Int_t)fWidth / 2) + 5)
173 // move pointer
174 fMove = 4;
175 else if (fPressPoint < (relMax - relMin) / 4 + relMin)
176 // move only min value
177 fMove = 1;
178 else if (fPressPoint > (relMax - relMin) / 4 * 3 + relMin)
179 // move only max value
180 fMove = 2;
181 else
182 // move min and max value
183 fMove = 3;
184
187 Pressed();
188
189 // last argument kFALSE forces all specified events to this window
192 kTRUE, kFALSE);
193 } else if (event->fType == kButtonRelease && event->fCode == kButton1) {
196 Released();
197 fMove = 0;
198 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
199 } else
200 fMove = 0;
201
202 return kTRUE;
203}
204
205////////////////////////////////////////////////////////////////////////////////
206/// Handles resize events for this widget.
207
209{
212 return kTRUE;
213}
214
215////////////////////////////////////////////////////////////////////////////////
216/// Handle mouse motion event in vertical slider.
217
219{
220 if (fMove < 3) {
221 // if the mouse pointer is on the cursor,
222 // and we are not moving anything,
223 // set the cursor shape as Pointer
224 if (event->fY > (fCz - 5) && event->fY < (fCz + 5) &&
225 event->fX > ((Int_t)fWidth / 2) - 7 &&
226 event->fX < ((Int_t)fWidth / 2) + 5 &&
227 fMove == 0)
228 gVirtualX->SetCursor(fId, kNone);
229 else
231 }
232 static int oldDiff = 0;
233 static Long64_t was = gSystem->Now();
234 Long64_t now = gSystem->Now();
235
236 if (fMove == 0) return kTRUE;
237 if ((now-was) < 50) return kTRUE;
238 was = now;
239
240 int diff;
241 Double_t oldMin, oldMax;
242
243 diff = event->fY - fPressPoint;
244 oldMin = fSmin;
245 oldMax = fSmax;
246
247 if (fMove == 1) {
248 // change of min value
249 oldDiff = 0;
250 fSmin = fPressSmin + diff * (fVmax - fVmin) / (fHeight-16);
251 if (fSmin < fVmin) fSmin = fVmin;
252 if (fSmin > fSmax) fSmin = fSmax;
253 } else if (fMove == 2) {
254 // change of max value
255 oldDiff = 0;
256 fSmax = fPressSmax + diff * (fVmax - fVmin) / (fHeight-16);
257 if (fSmax > fVmax) fSmax = fVmax;
258 if (fSmax < fSmin) fSmax = fSmin;
259 } else if (fMove == 3) {
260 // change of min and of max value
261 Double_t logicalDiff;
262 logicalDiff = diff * (fVmax - fVmin) / (fHeight-16);
263 if (fPressSmax + logicalDiff > fVmax)
264 logicalDiff = fVmax - fPressSmax;
265 if (fPressSmin + logicalDiff < fVmin)
266 logicalDiff = fVmin - fPressSmin;
267 fSmax = fPressSmax + logicalDiff;
268 fSmin = fPressSmin + logicalDiff;
269 if (fRelative) {
270 if (abs(diff) < 3) oldDiff = diff;
271 SetPointerPos(diff - oldDiff, 3);
272 oldDiff = diff;
273 }
274 }
275 else if (fMove == 4) {
276 // change pointer position
277 oldDiff = 0;
278 SetPointerPos(event->fY, 1);
279 }
280 if (fMove != 4){
281 SetPointerPos(0, 2);
282 }
283 // check if position has changed
284 if (fMove != 0 && (fSmax != oldMax || fSmin != oldMin)) {
285 fClient->NeedRedraw(this);
289 }
290 return kTRUE;
291}
292
293////////////////////////////////////////////////////////////////////////////////
294/// Set pointer position constrained in the slider range.
295
297{
299
300 if (fConstrained) {
303 else if (GetPointerPosition() >= GetMaxPosition())
305 }
306}
307
308////////////////////////////////////////////////////////////////////////////////
309/// Set slider pointer position in pixel value.
310
312{
313 static Long64_t was = gSystem->Now();
314 Bool_t lcheck = (opt == 1);
315 Int_t oldPos = fCz;
316
317 if (opt < 2) {
318 fCz = z;
319
320 if (fCz < 7)
321 fCz = 7;
322 else if (fCz >= (Int_t)fHeight - 7)
323 fCz = (Int_t)fHeight - 7;
324 }
325 if (opt == 3) {
326 lcheck = kTRUE;
327 fCz += z;
328 if (fCz < 7)
329 fCz = 7;
330 else if (fCz >= (Int_t)fHeight-7)
331 fCz = (Int_t)fHeight - 7;
332 }
333 if (fConstrained) {
334 int relMin = (int)((fHeight-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
335 int relMax = (int)((fHeight-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
336 if(fCz < relMin+7) {
337 fCz = relMin+7;
338 lcheck = kTRUE;
339 }
340 if(fCz > relMax-7) {
341 fCz = relMax-7;
342 lcheck = kTRUE;
343 }
344 }
345 if (lcheck)
346 fSCz = fVmin + ((Double_t)(fCz-8) * (fVmax - fVmin) / (Double_t)(fHeight-16));
347 if(fSCz < fVmin) fSCz = fVmin;
348 if(fSCz > fVmax) fSCz = fVmax;
349 if (fConstrained) {
350 if(fSCz < fSmin) fSCz = fSmin;
351 if(fSCz > fSmax) fSCz = fSmax;
352 }
353
354 DrawPointer();
355 fClient->NeedRedraw(this);
356 if (fCz != oldPos) {
357 Long64_t now = gSystem->Now();
358 if ((fMove != 4) && ((now-was) < 150)) return;
359 was = now;
363 fClient->NeedRedraw(this);
364 }
365}
366
367////////////////////////////////////////////////////////////////////////////////
368/// Set pointer position in scaled (real) value
369
371{
372 if (fReversedScale) {
373 fSCz = fVmin + fVmax - pos;
374 }
375 else {
376 fSCz = pos;
377 }
378 Double_t absPos = (fSCz - fVmin) * (fHeight-16) / (fVmax - fVmin);
379 SetPointerPos((int)(absPos+5.0), 0);
380}
381
382////////////////////////////////////////////////////////////////////////////////
383/// Create horizontal slider widget.
384
386 UInt_t options, ULong_t back,
387 Bool_t reversed, Bool_t mark_ends,
388 Bool_t constrained, Bool_t relative)
389 : TGDoubleHSlider(p, w, type, id, options, back, reversed, mark_ends)
390{
391 fPointerPic = fClient->GetPicture("slider1v.xpm");
392 if (!fPointerPic)
393 Error("TGTripleVSlider", "slider1v.xpm not found");
394 fConstrained = constrained;
395 fRelative = relative;
396 fCz = 0;
397 fSCz = 0;
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// Delete a horizontal slider widget.
404
406{
408}
409
410////////////////////////////////////////////////////////////////////////////////
411/// Redraw horizontal slider widget.
412
414{
416 // Draw Pointer
417 DrawPointer();
418}
419
420////////////////////////////////////////////////////////////////////////////////
421/// Draw slider pointer
422
424{
426}
427
428////////////////////////////////////////////////////////////////////////////////
429/// Handle mouse button event in horizontal slider widget.
430
432{
433 if (event->fType == kButtonPress && event->fCode == kButton1) {
434 // constrain to the slider height
435 if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
436 return kTRUE;
437 }
438 fPressPoint = event->fX;
441
442 int relMin = (int)((fWidth-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
443 int relMax = (int)((fWidth-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
444 if (fPressPoint > (fCz - 5) && fPressPoint < (fCz + 5) &&
445 event->fY > ((Int_t)fHeight / 2) - 7 && event->fY < ((Int_t)fHeight / 2) + 5)
446 // move pointer
447 fMove = 4;
448 else if (fPressPoint < (relMax - relMin) / 4 + relMin)
449 // move only min value
450 fMove = 1;
451 else if (fPressPoint > (relMax - relMin) / 4 * 3 + relMin)
452 // move only max value
453 fMove = 2;
454 else
455 // move min and max value
456 fMove = 3;
457
460 Pressed();
461
462 // last argument kFALSE forces all specified events to this window
465 kTRUE, kFALSE);
466 } else if (event->fType == kButtonRelease && event->fCode == kButton1) {
469 Released();
470 fMove = 0;
471 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
472 } else
473 fMove = 0;
474
475 return kTRUE;
476}
477
478////////////////////////////////////////////////////////////////////////////////
479/// Handles resize events for this widget.
480
482{
485 return kTRUE;
486}
487
488////////////////////////////////////////////////////////////////////////////////
489/// Handle mouse motion event in horizontal slide widget.
490
492{
493 if (fMove < 3) {
494 // if the mouse pointer is on the cursor,
495 // and we are not moving anything,
496 // set the cursor shape as Pointer
497 if (event->fX > (fCz - 5) && event->fX < (fCz + 5) &&
498 event->fY > ((Int_t)fHeight / 2) - 7 &&
499 event->fY < ((Int_t)fHeight / 2) + 5 &&
500 fMove == 0)
501 gVirtualX->SetCursor(fId, kNone);
502 else
504 }
505 static int oldDiff = 0;
506 static Long64_t was = gSystem->Now();
507 Long64_t now = gSystem->Now();
508
509 if (fMove == 0) return kTRUE;
510 if ((now-was) < 50) return kTRUE;
511 was = now;
512
513 int diff;
514 Double_t oldMin, oldMax;
515
516 diff = event->fX - fPressPoint;
517 oldMin = fSmin;
518 oldMax = fSmax;
519
520 if (fMove == 1) {
521 // change of min value
522 oldDiff = 0;
523 fSmin = fPressSmin + diff * (fVmax - fVmin) / (fWidth-16);
524 if (fSmin < fVmin) fSmin = fVmin;
525 if (fSmin > fSmax) fSmin = fSmax;
526 } else if (fMove == 2) {
527 // change of max value
528 oldDiff = 0;
529 fSmax = fPressSmax + diff * (fVmax - fVmin) / (fWidth-16);
530 if (fSmax > fVmax) fSmax = fVmax;
531 if (fSmax < fSmin) fSmax = fSmin;
532 } else if (fMove == 3) {
533 // change of min and of max value
534 Double_t logicalDiff;
535 logicalDiff = diff * (fVmax - fVmin) / (fWidth-16);
536 if (fPressSmax + logicalDiff > fVmax)
537 logicalDiff = fVmax - fPressSmax;
538 if (fPressSmin + logicalDiff < fVmin)
539 logicalDiff = fVmin - fPressSmin;
540 fSmax = fPressSmax + logicalDiff;
541 fSmin = fPressSmin + logicalDiff;
542 if (fRelative) {
543 if (abs(diff) < 3) oldDiff = diff;
544 SetPointerPos(diff - oldDiff, 3);
545 oldDiff = diff;
546 }
547 }
548 else if (fMove == 4) {
549 // change pointer position
550 oldDiff = 0;
551 SetPointerPos(event->fX, 1);
552 }
553 if (fMove != 4) {
554 SetPointerPos(0, 2);
555 }
556 // check if position has changed
557 if (fMove != 0 && (fSmax != oldMax || fSmin != oldMin)) {
558 fClient->NeedRedraw(this);
562 }
563 return kTRUE;
564}
565
566////////////////////////////////////////////////////////////////////////////////
567/// Set pointer position constrained in the slider range.
568
570{
572
573 if (fConstrained) {
576 else if (GetPointerPosition() >= GetMaxPosition())
578 }
579}
580
581////////////////////////////////////////////////////////////////////////////////
582/// Set slider pointer position in pixel value.
583
585{
586 static Long64_t was = gSystem->Now();
587 Bool_t lcheck = (opt == 1);
588 Int_t oldPos = fCz;
589
590 if (opt < 2) {
591 fCz = z;
592
593 if (fCz < 7)
594 fCz = 7;
595 else if (fCz >= (Int_t)fWidth-7)
596 fCz = (Int_t)fWidth-7;
597 }
598 if (opt == 3) {
599 lcheck = kTRUE;
600 fCz += z;
601 if (fCz < 7)
602 fCz = 7;
603 else if (fCz >= (Int_t)fWidth-7)
604 fCz = (Int_t)fWidth-7;
605 }
606 if (fConstrained) {
607 int relMin = (int)((fWidth-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
608 int relMax = (int)((fWidth-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
609 if(fCz < relMin+7) {
610 fCz = relMin+7;
611 lcheck = kTRUE;
612 }
613 if(fCz > relMax-7) {
614 fCz = relMax-7;
615 lcheck = kTRUE;
616 }
617 }
618 if (lcheck)
619 fSCz = fVmin + ((Double_t)(fCz-8) * (fVmax - fVmin) / (Double_t)(fWidth-16));
620 if(fSCz < fVmin) fSCz = fVmin;
621 if(fSCz > fVmax) fSCz = fVmax;
622 if (fConstrained) {
623 if(fSCz < fSmin) fSCz = fSmin;
624 if(fSCz > fSmax) fSCz = fSmax;
625 }
626
627 DrawPointer();
628 fClient->NeedRedraw(this);
629 if (fCz != oldPos) {
630 Long64_t now = gSystem->Now();
631 if ((fMove != 4) && ((now-was) < 150)) return;
632 was = now;
636 fClient->NeedRedraw(this);
637 }
638}
639
640////////////////////////////////////////////////////////////////////////////////
641/// Set pointer position in scaled (real) value
642
644{
645 if (fReversedScale) {
646 fSCz = fVmin + fVmax - pos;
647 }
648 else {
649 fSCz = pos;
650 }
651 Double_t absPos = (fSCz - fVmin) * (fWidth-16) / (fVmax - fVmin);
652 SetPointerPos((int)(absPos+5.0), 0);
653}
654
655////////////////////////////////////////////////////////////////////////////////
656/// Save an horizontal slider as a C++ statement(s) on output stream out.
657
658void TGTripleHSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
659{
660 SaveUserColor(out, option);
661
662 out <<" TGTripleHSlider *";
663 out << GetName() << " = new TGTripleHSlider(" << fParent->GetName()
664 << "," << GetWidth() << ",";
665 out << GetSString() << "," << WidgetId() << ",";
666 out << GetOptionString() << ",ucolor";
667 if (fMarkEnds) {
668 if (fReversedScale)
669 out << ",kTRUE,kTRUE";
670 else
671 out << ",kFALSE,kTRUE";
672 } else if (fReversedScale) {
673 out << ",kTRUE,kFALSE";
674 } else {
675 out << ",kFALSE,kFALSE";
676 }
677 if (!fConstrained) {
678 if (fRelative)
679 out << ",kFALSE,kTRUE);" << std::endl;
680 else
681 out << ",kFALSE,kFALSE);" << std::endl;
682 }
683 else if (fRelative) {
684 out << ",kTRUE);" << std::endl;
685 }
686 else {
687 out << ");" << std::endl;
688 }
689 if (option && strstr(option, "keep_names"))
690 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
691
692 if (fVmin != 0 || fVmax != (Int_t)fWidth)
693 out << " " << GetName() << "->SetRange(" << fVmin << "," << fVmax
694 << ");" << std::endl;
695
696 if (fSmin != fWidth/8*3 || fSmax != fWidth/8*5)
697 out << " " << GetName() << "->SetPosition(" << GetMinPosition()
698 << "," << GetMaxPosition() << ");" << std::endl;
699
700 if (fScale != 10)
701 out << " " << GetName() << "->SetScale(" << fScale << ");" << std::endl;
702
703 out << " " << GetName() << "->SetPointerPosition(" << fSCz << ");" << std::endl;
704}
705
706////////////////////////////////////////////////////////////////////////////////
707/// Save an horizontal slider as a C++ statement(s) on output stream out.
708
709void TGTripleVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
710{
711 SaveUserColor(out, option);
712
713 out<<" TGTripleVSlider *";
714 out << GetName() << " = new TGTripleVSlider("<< fParent->GetName()
715 << "," << GetHeight() << ",";
716 out << GetSString() << "," << WidgetId() << ",";
717 out << GetOptionString() << ",ucolor";
718 if (fMarkEnds) {
719 if (fReversedScale)
720 out << ",kTRUE,kTRUE";
721 else
722 out << ",kFALSE,kTRUE";
723 } else if (fReversedScale) {
724 out << ",kTRUE,kFALSE";
725 } else {
726 out << ",kFALSE,kFALSE";
727 }
728 if (!fConstrained) {
729 if (fRelative)
730 out << ",kFALSE,kTRUE);" << std::endl;
731 else
732 out << ",kFALSE,kFALSE);" << std::endl;
733 }
734 else if (fRelative) {
735 out << ",kTRUE);" << std::endl;
736 }
737 else {
738 out << ");" << std::endl;
739 }
740 if (option && strstr(option, "keep_names"))
741 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
742
743 if (fVmin != 0 || fVmax != (Int_t)fHeight)
744 out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax
745 << ");" << std::endl;
746
747 if (fSmin != fHeight/8*3 || fSmax != fHeight/8*5)
748 out << " " << GetName() << "->SetPosition(" << GetMinPosition()
749 << "," << GetMaxPosition() << ");" << std::endl;
750
751 if (fScale != 10)
752 out << " " << GetName() << "->SetScale(" << fScale << ");" << std::endl;
753
754 out << " " << GetName() << "->SetPointerPosition(" << fSCz << ");" << std::endl;
755}
@ kButtonRelease
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:166
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
@ kButton1
Definition GuiTypes.h:214
#define h(i)
Definition RSha256.hxx:106
unsigned long ULong_t
Definition RtypesCore.h:55
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
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
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
#define gVirtualX
Definition TVirtualX.h:338
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
@ kSL_RELEASE
@ kSL_POS
@ kC_HSLIDER
@ kSL_PRESS
@ kSL_POINTER
@ kC_VSLIDER
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2)
Execute string "cmd" via the interpreter.
Definition TGClient.cxx:914
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
Dragging the slider will generate the event:
void DoRedraw() override
Redraw horizontal slider widget.
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
Double_t fPressSmax
logical max position at button press event
virtual void PositionChanged()
Double_t fSmax
logical position of max value of Slider
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
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
TString GetSString() const
returns scaling type as string
Dragging the slider will generate the event:
void DoRedraw() override
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:339
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:443
UInt_t fHeight
frame height
Definition TGFrame.h:88
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2506
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:645
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:225
UInt_t GetWidth() const
Definition TGFrame.h:224
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2479
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:775
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
void Draw(Option_t *="") override
Default Draw method for all objects.
Definition TGPicture.h:46
TripleSlider inherit from DoubleSlider widgets and allow easy selection of a min, max and pointer val...
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an horizontal slider as a C++ statement(s) on output stream out.
Bool_t fConstrained
kTRUE if pointer is constrained to slider edges
Int_t fCz
horizontal pointer position in pixel coordinates
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in horizontal slider widget.
const TGPicture * fPointerPic
picture to draw pointer
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in horizontal slide widget.
Double_t fSCz
vertical pointer position
virtual void PointerPositionChanged()
~TGTripleHSlider() override
Delete a horizontal slider widget.
Bool_t fRelative
kTRUE if pointer position is relative to slider
virtual Float_t GetPointerPosition() const
void DoRedraw() override
Redraw horizontal slider widget.
virtual void DrawPointer()
Draw slider pointer.
virtual void SetPointerPos(Int_t z, Int_t opt=0)
Set slider pointer position in pixel value.
virtual void SetPointerPosition(Double_t pos)
Set pointer position in scaled (real) value.
virtual void SetConstrained(Bool_t on=kTRUE)
Set pointer position constrained in the slider range.
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
TGTripleHSlider(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, Bool_t constrained=kTRUE, Bool_t relative=kFALSE)
Create horizontal slider widget.
TripleSlider inherit from DoubleSlider widgets and allow easy selection of a min, max and pointer val...
virtual void SetPointerPos(Int_t z, Int_t opt=0)
Set slider pointer position in pixel value.
virtual void SetPointerPosition(Double_t pos)
Set pointer position in scaled (real) value.
Double_t fSCz
vertical pointer position
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in vertical slider.
~TGTripleVSlider() override
Delete vertical slider widget.
Int_t fCz
vertical pointer position in pixel coordinates
virtual void DrawPointer()
Draw slider pointer.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an horizontal slider as a C++ statement(s) on output stream out.
virtual void PointerPositionChanged()
virtual void SetConstrained(Bool_t on=kTRUE)
Set pointer position constrained in the slider range.
Bool_t fRelative
kTRUE if pointer position is relative to slider
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
void DoRedraw() override
Redraw vertical slider widget.
TGTripleVSlider(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, Bool_t constrained=kTRUE, Bool_t relative=kFALSE)
Create a vertical slider widget.
const TGPicture * fPointerPic
picture to draw pointer
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in vertical slider.
virtual Float_t GetPointerPosition() const
Bool_t fConstrained
kTRUE if pointer is constrained to slider edges
Int_t fWidgetId
the widget id (used for event processing)
Definition TGWidget.h:46
TString fCommand
command to be executed
Definition TGWidget.h:49
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:129
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition TSystem.cxx:450
Event structure.
Definition GuiTypes.h:174