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// //
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 "TSystem.h"
62#include "TVirtualX.h"
63
64#include <iostream>
65
66
70
71////////////////////////////////////////////////////////////////////////////////
72/// Slider constructor.
73
75 UInt_t options, ULong_t back,
76 Bool_t reversed, Bool_t mark_ends)
77 : TGFrame(p, w, h, options, back)
78{
79 fSliderPic = 0;
80
81 fWidgetId = id;
83 fMsgWindow = p;
84
86 fScale = 10;
87 fMove = 0;
88
89 fPos = fSmin = fSmax = 0.0;
90 fRelPos = 0;
91 fVmin = fVmax = 0.0;
92 fPressPoint = 0;
93 fPressSmin = fPressSmax = 0.0;
94
95 fReversedScale = reversed;
96 fMarkEnds = mark_ends;
97
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// Avoid boundaries to be equal.
107
109{
110 if (min > max) min = max;
111
112 Double_t eps = 1e-6;
113 if (max - min < eps) {
114 if (max == 0)
115 max += eps;
116 else
117 max += max*eps;
118 if (min == 0)
119 min -= eps;
120 else
121 min -= min*eps;
122 }
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Returns the slider type as a string - used in SavePrimitive()
127
129{
130 TString stype;
131
132 if (fScaleType) {
134 if (stype.Length() == 0)
135 stype = "kDoubleScaleNo";
136 else
137 stype += " | kDoubleScaleNo";
138 }
140 if (stype.Length() == 0)
141 stype = "kDoubleScaleDownRight";
142 else
143 stype += " | kDoubleScaleDownRight";
144 }
146 if (stype.Length() == 0)
147 stype = "kDoubleScaleBoth";
148 else
149 stype += " | kDoubleScaleBoth";
150 }
151 }
152 return stype;
153}
154
155////////////////////////////////////////////////////////////////////////////////
156/// Change the cursor shape depending on the slider area.
157
159{
160 static Cursor_t topCur = kNone, leftCur = kNone;
161 static Cursor_t botCur = kNone, rightCur = kNone;
162 Int_t hw = 0, wh = 0, xy = 0, yx = 0;
163 Cursor_t minCur = kNone, maxCur = kNone;
164
165 if (topCur == kNone)
166 topCur = gVirtualX->CreateCursor(kTopSide);
167 if (leftCur == kNone)
168 leftCur = gVirtualX->CreateCursor(kLeftSide);
169 if (botCur == kNone)
170 botCur = gVirtualX->CreateCursor(kBottomSide);
171 if (rightCur == kNone)
172 rightCur = gVirtualX->CreateCursor(kRightSide);
173 if (GetOptions() & kVerticalFrame) {
174 hw = (Int_t)fWidth;
175 wh = (Int_t)fHeight;
176 xy = (Int_t)event->fX;
177 yx = (Int_t)event->fY;
178 minCur = topCur;
179 maxCur = botCur;
180 }
181 else if (GetOptions() & kHorizontalFrame) {
182 hw = (Int_t)fHeight;
183 wh = (Int_t)fWidth;
184 xy = (Int_t)event->fY;
185 yx = (Int_t)event->fX;
186 minCur = leftCur;
187 maxCur = rightCur;
188 }
189 else return;
190
191 Int_t relMin = (Int_t)((wh-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
192 Int_t relMax = (Int_t)((wh-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
193 // constrain to the slider width
194 if (xy > hw/2-7 && xy < hw/2+7 && fMove != 3) {
195 // if the mouse pointer is in the top resizing zone,
196 // and we are not already moving the the bottom side,
197 // set the cursor shape as TopSide
198 if ((yx <= (relMax - relMin) / 4 + relMin) &&
199 (yx >= relMin) && (fMove != 2))
200 gVirtualX->SetCursor(fId, minCur);
201 // if the mouse pointer is in the bottom resizing zone,
202 // and we are not already moving the the top side,
203 // set the cursor shape as BottomSide
204 else if ((yx >= (relMax - relMin) / 4 * 3 + relMin) &&
205 (yx <= relMax) && (fMove != 1))
206 gVirtualX->SetCursor(fId, maxCur);
207 // if we are not moving any side, restore the cursor
208 else if ((fMove < 1) || (fMove > 2))
209 gVirtualX->SetCursor(fId, kNone);
210 }
211 // if we are not inside the slider, and not moving any side,
212 // restore the cursor
213 else if ((fMove < 1) || (fMove > 2))
214 gVirtualX->SetCursor(fId, kNone);
215}
216
217////////////////////////////////////////////////////////////////////////////////
218/// Create a vertical slider widget.
219
221 UInt_t options, ULong_t back,
222 Bool_t reversed, Bool_t mark_ends)
223 : TGDoubleSlider(p, kDoubleSliderWidth, h, type, id, options, back,
224 reversed, mark_ends)
225{
226 fYp = 0;
227 fSliderPic = fClient->GetPicture("sliderv.xpm");
228
229 if (!fSliderPic)
230 Error("TGDoubleVSlider", "sliderv.xpm not found");
231 // set initial values
232 fSmin = h/8*3; fSmax = h/8*5; fVmin = 0; fVmax = h;
235}
236
237////////////////////////////////////////////////////////////////////////////////
238/// Delete vertical slider widget.
239
241{
243}
244
245////////////////////////////////////////////////////////////////////////////////
246/// Redraw vertical slider widget.
247
249{
251
252 // cleanup the drawable
253 gVirtualX->ClearWindow(fId);
254
255 if (fSmin < fVmin) fSmin = fVmin;
256 if (fSmax < fVmin) fSmax = fVmin;
257 if (fSmin > fVmax) fSmin = fVmax;
258 if (fSmax > fVmax) fSmax = fVmax;
259 if (fSmin > fSmax) fSmin = fSmax = (fSmin + fSmax) / 2;
260
261 int relMin = (int)((fHeight-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
262 int relMax = (int)((fHeight-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
263
264 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2-6, relMin, fWidth/2+5, relMin);
265 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2-6, relMin, fWidth/2-6, relMax);
266 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+5, relMax, fWidth/2-6, relMax);
267 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+5, relMax, fWidth/2+5, relMin);
268
269 if (relMin-1 > 8) {
270 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, 8, fWidth/2-1, relMin-1);
271 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, 8, fWidth/2+1, relMin-1);
272 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2, 8, fWidth/2, relMin-1);
273 }
274 if (relMax+1 < (int)fHeight-8) {
275 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, relMax+1, fWidth/2-1, fHeight-8);
276 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, relMax+1, fWidth/2+1, fHeight-8);
277 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2, relMax+1, fWidth/2, fHeight-8);
278 }
279
280 // check scale
281 if (fScale == 1) fScale++;
282 if (fScale * 2 > (int)fHeight) fScale = 0;
283 if (fScale > 0 && !(fScaleType & kDoubleScaleNo)) {
284 int lines = ((int)fHeight-16) / fScale;
285 int remain = ((int)fHeight-16) % fScale;
286 if (lines < 1) lines = 1;
287 for (int i = 0; i <= lines; i++) {
288 int y = i * fScale + (i * remain) / lines;
289 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2+8, y+7, fWidth/2+10, y+7);
291 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-9, y+7, fWidth/2-11, y+7);
292 }
293 }
294
295 if (fSliderPic) {
296 Int_t xpos = (fWidth/2) - (fSliderPic->GetWidth()/2);
297 Int_t ypos = relMin + 2;
298 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
299 ypos = relMax - fSliderPic->GetHeight() - 2;
300 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
301 }
302 if (fMarkEnds) {
303 // Draw scaling zones.
304 int y1 = (relMax - relMin) / 4 + relMin;
305 int y2 = (relMax - relMin) / 4 * 3 + relMin;
306 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-6, y1, fWidth/2+5, y1);
307 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth/2-6, y2, fWidth/2+5, y2);
308 }
309}
310
311////////////////////////////////////////////////////////////////////////////////
312/// Handle mouse button event in vertical slider.
313
315{
316 if (event->fType == kButtonPress && event->fCode == kButton1) {
317 // constrain to the slider width
318 if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
319 return kTRUE;
320 }
321 fPressPoint = event->fY;
324
325 int relMin = (int)((fHeight-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
326 int relMax = (int)((fHeight-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
327 if (fPressPoint < (relMax - relMin) / 4 + relMin)
328 // move only min value
329 fMove = 1;
330 else if (fPressPoint > (relMax - relMin) / 4 * 3 + relMin)
331 // move only max value
332 fMove = 2;
333 else
334 // move min and max value
335 fMove = 3;
336
339 Pressed();
340
341 // last argument kFALSE forces all specified events to this window
344 kTRUE, kFALSE);
345 } else if (event->fType == kButtonRelease && event->fCode == kButton1) {
348 Released();
349 fMove = 0;
350
351 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
352 } else
353 fMove = 0;
354
355 return kTRUE;
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Handle mouse motion event in vertical slider.
360
362{
363 ChangeCursor(event);
364 if (fMove == 0) return kTRUE;
365
366 static Long64_t was = gSystem->Now();
367 Long64_t now = gSystem->Now();
368
369 if ((now-was) < 50) return kTRUE;
370 was = now;
371
372 int diff;
373 Double_t oldMin, oldMax;
374
375 diff = event->fY - fPressPoint;
376 oldMin = fSmin;
377 oldMax = fSmax;
378
379 if (fMove == 1) {
380 // change of min value
381 fSmin = fPressSmin + diff * (fVmax - fVmin) / (fHeight-16);
382 if (fSmin < fVmin) fSmin = fVmin;
383 if (fSmin > fSmax) fSmin = fSmax;
384 } else if (fMove == 2) {
385 // change of max value
386 fSmax = fPressSmax + diff * (fVmax - fVmin) / (fHeight-16);
387 if (fSmax > fVmax) fSmax = fVmax;
388 if (fSmax < fSmin) fSmax = fSmin;
389 } else if (fMove == 3) {
390 // change of min and of max value
391 Double_t logicalDiff;
392 logicalDiff = diff * (fVmax - fVmin) / (fHeight-16);
393 if (fPressSmax + logicalDiff > fVmax)
394 logicalDiff = fVmax - fPressSmax;
395 if (fPressSmin + logicalDiff < fVmin)
396 logicalDiff = fVmin - fPressSmin;
397 fSmax = fPressSmax + logicalDiff;
398 fSmin = fPressSmin + logicalDiff;
399 }
400
401 // check if position has changed
402 if (fMove != 0 && (fSmax != oldMax || fSmin != oldMin)) {
403 fClient->NeedRedraw(this);
407 }
408 return kTRUE;
409}
410
411////////////////////////////////////////////////////////////////////////////////
412/// Create horizontal slider widget.
413
415 UInt_t options, ULong_t back,
416 Bool_t reversed, Bool_t mark_ends)
417 : TGDoubleSlider(p, w, kDoubleSliderHeight, type, id, options, back,
418 reversed, mark_ends)
419{
420 fXp = 0;
421 fSliderPic = fClient->GetPicture("sliderh.xpm");
422
423 if (!fSliderPic)
424 Error("TGDoubleHSlider", "sliderh.xpm not found");
425 // set initial values
426 fSmin = w/8*3; fSmax = w/8*5; fVmin = 0; fVmax = w;
429}
430
431////////////////////////////////////////////////////////////////////////////////
432/// Delete a horizontal slider widget.
433
435{
437}
438
439////////////////////////////////////////////////////////////////////////////////
440/// Redraw horizontal slider widget.
441
443{
445
446 // cleanup drawable
447 gVirtualX->ClearWindow(fId);
448
449 if (fSmin < fVmin) fSmin = fVmin;
450 if (fSmax > fVmax) fSmax = fVmax;
451 if (fSmin > fSmax) fSmin = fSmax = (fSmin + fSmax) / 2;
452
453 int relMin = (int)((fWidth-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
454 int relMax = (int)((fWidth-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
455
456 gVirtualX->DrawLine(fId, GetHilightGC()(), relMin, fHeight/2-6, relMin, fHeight/2+5);
457 gVirtualX->DrawLine(fId, GetHilightGC()(), relMax, fHeight/2-6, relMin, fHeight/2-6);
458 gVirtualX->DrawLine(fId, GetBlackGC()(), relMax, fHeight/2+5, relMax, fHeight/2-6);
459 gVirtualX->DrawLine(fId, GetBlackGC()(), relMin, fHeight/2+5, relMax, fHeight/2+5);
460
461 if (relMin-1 > 8) {
462 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2-1, relMin-1, fHeight/2-1);
463 gVirtualX->DrawLine(fId, GetHilightGC()(), 8, fHeight/2+1, relMin-1, fHeight/2+1);
464 gVirtualX->DrawLine(fId, GetBlackGC()(), 8, fHeight/2, relMin-1, fHeight/2);
465 }
466 if (relMax+1 < (int)fWidth-8) {
467 gVirtualX->DrawLine(fId, GetShadowGC()(), relMax+1, fHeight/2-1, fWidth-8, fHeight/2-1);
468 gVirtualX->DrawLine(fId, GetHilightGC()(), relMax+1, fHeight/2+1, fWidth-8, fHeight/2+1);
469 gVirtualX->DrawLine(fId, GetBlackGC()(), relMax+1, fHeight/2, fWidth-8, fHeight/2);
470 }
471
472 if (fScale == 1) fScale++;
473 if (fScale * 2 > (int)fWidth) fScale = 0;
474 if (fScale > 0 && !(fScaleType & kDoubleScaleNo)) {
475 int lines = ((int)fWidth-16) / fScale;
476 int remain = ((int)fWidth-16) % fScale;
477 if (lines < 1) lines = 1;
478 for (int i = 0; i <= lines; i++) {
479 int x = i * fScale + (i * remain) / lines;
480 gVirtualX->DrawLine(fId, GetBlackGC()(), x+7, fHeight/2+8, x+7, fHeight/2+10);
482 gVirtualX->DrawLine(fId, GetBlackGC()(), x+7, fHeight/2-9, x+7, fHeight/2-11);
483 }
484 }
485
486 if (fSliderPic) {
487 Int_t ypos = (fHeight/2) - (fSliderPic->GetHeight()/2);
488 Int_t xpos = relMin + 2;
489 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
490 xpos = relMax - fSliderPic->GetWidth() - 2;
491 fSliderPic->Draw(fId, GetBckgndGC()(), xpos, ypos);
492 }
493 if (fMarkEnds) {
494 // Draw scaling zones.
495 int x1 = (relMax - relMin) / 4 + relMin;
496 int x2 = (relMax - relMin) / 4 * 3 + relMin;
497 gVirtualX->DrawLine(fId, GetBlackGC()(), x1, fHeight/2-6, x1, fHeight/2+5);
498 gVirtualX->DrawLine(fId, GetBlackGC()(), x2, fHeight/2-6, x2, fHeight/2+5);
499 }
500}
501
502////////////////////////////////////////////////////////////////////////////////
503/// Handle mouse button event in horizontal slider widget.
504
506{
507 if (event->fType == kButtonPress && event->fCode == kButton1) {
508 // constrain to the slider height
509 if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
510 return kTRUE;
511 }
512 fPressPoint = event->fX;
515
516 int relMin = (int)((fWidth-16) * (fSmin - fVmin) / (fVmax - fVmin)) + 1;
517 int relMax = (int)((fWidth-16) * (fSmax - fVmin) / (fVmax - fVmin) + 15);
518 if (fPressPoint < (relMax - relMin) / 4 + relMin)
519 // move only min value
520 fMove = 1;
521 else if (fPressPoint > (relMax - relMin) / 4 * 3 + relMin)
522 // move only max value
523 fMove = 2;
524 else
525 // move min and max value
526 fMove = 3;
527
530 Pressed();
531
532 // last argument kFALSE forces all specified events to this window
535 kTRUE, kFALSE);
536 } else if (event->fType == kButtonRelease && event->fCode == kButton1) {
539 Released();
540 fMove = 0;
541
542 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
543 } else
544 fMove = 0;
545
546 return kTRUE;
547}
548
549////////////////////////////////////////////////////////////////////////////////
550/// Handle mouse motion event in horizontal slide widget.
551
553{
554 ChangeCursor(event);
555 if (fMove == 0) return kTRUE;
556
557 static Long64_t was = gSystem->Now();
558 Long64_t now = gSystem->Now();
559
560 if ((now-was) < 50) return kTRUE;
561 was = now;
562
563 int diff;
564 Double_t oldMin, oldMax;
565
566 diff = event->fX - fPressPoint;
567 oldMin = fSmin;
568 oldMax = fSmax;
569
570 if (fMove == 1) {
571 // change of min value
572 fSmin = fPressSmin + diff * (fVmax - fVmin) / (fWidth-16);
573 if (fSmin < fVmin) fSmin = fVmin;
574 if (fSmin > fSmax) fSmin = fSmax;
575 } else if (fMove == 2) {
576 // change of max value
577 fSmax = fPressSmax + diff * (fVmax - fVmin) / (fWidth-16);
578 if (fSmax > fVmax) fSmax = fVmax;
579 if (fSmax < fSmin) fSmax = fSmin;
580 } else if (fMove == 3) {
581 // change of min and of max value
582 Double_t logicalDiff;
583 logicalDiff = diff * (fVmax - fVmin) / (fWidth-16);
584 if (fPressSmax + logicalDiff > fVmax)
585 logicalDiff = fVmax - fPressSmax;
586 if (fPressSmin + logicalDiff < fVmin)
587 logicalDiff = fVmin - fPressSmin;
588 fSmax = fPressSmax + logicalDiff;
589 fSmin = fPressSmin + logicalDiff;
590 }
591
592 // check if position has changed
593 if (fMove != 0 && (fSmax != oldMax || fSmin != oldMin)) {
594 fClient->NeedRedraw(this);
598 }
599 return kTRUE;
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Save an horizontal slider as a C++ statement(s) on output stream out.
604
605void TGDoubleHSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
606{
607 SaveUserColor(out, option);
608
609 out <<" TGDoubleHSlider *";
610 out << GetName() << " = new TGDoubleHSlider(" << fParent->GetName()
611 << "," << GetWidth() << ",";
612 out << GetSString() << "," << WidgetId() << ",";
613 out << GetOptionString() << ",ucolor";
614 if (fMarkEnds) {
615 if (fReversedScale)
616 out << ",kTRUE,kTRUE);" << std::endl;
617 else
618 out << ",kFALSE,kTRUE);" << std::endl;
619 } else if (fReversedScale) {
620 out << ",kTRUE);" << std::endl;
621 } else {
622 out << ");" << std::endl;
623 }
624 if (option && strstr(option, "keep_names"))
625 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
626
627 if (fVmin != 0 || fVmax != (Int_t)fWidth)
628 out << " " << GetName() << "->SetRange(" << fVmin << "," << fVmax
629 << ");" << std::endl;
630
631 if (fSmin != fWidth/8*3 || fSmax != fWidth/8*5)
632 out << " " << GetName() << "->SetPosition(" << GetMinPosition()
633 << "," << GetMaxPosition() << ");" << std::endl;
634
635 if (fScale != 10)
636 out << " " << GetName() << "->SetScale(" << fScale << ");" << std::endl;
637
638}
639
640////////////////////////////////////////////////////////////////////////////////
641/// Save an horizontal slider as a C++ statement(s) on output stream out.
642
643void TGDoubleVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
644{
645 SaveUserColor(out, option);
646
647 out<<" TGDoubleVSlider *";
648 out << GetName() << " = new TGDoubleVSlider("<< fParent->GetName()
649 << "," << GetHeight() << ",";
650 out << GetSString() << "," << WidgetId() << ",";
651 out << GetOptionString() << ",ucolor";
652 if (fMarkEnds) {
653 if (fReversedScale)
654 out << ",kTRUE,kTRUE);" << std::endl;
655 else
656 out << ",kFALSE,kTRUE);" << std::endl;
657 } else if (fReversedScale) {
658 out << ",kTRUE);" << std::endl;
659 } else {
660 out << ");" << std::endl;
661 }
662 if (option && strstr(option, "keep_names"))
663 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
664
665 if (fVmin != 0 || fVmax != (Int_t)fHeight)
666 out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax
667 << ");" << std::endl;
668
669
670 if (fSmin != fHeight/8*3 || fSmax != fHeight/8*5)
671 out << " " << GetName() << "->SetPosition(" << GetMinPosition()
672 << "," << GetMaxPosition() << ");" << std::endl;
673
674
675 if (fScale != 10)
676 out << " " << GetName() << "->SetScale(" << fScale << ");" << std::endl;
677
678}
@ kButtonRelease
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
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
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
@ kRightSide
Definition GuiTypes.h:373
@ kBottomSide
Definition GuiTypes.h:373
@ kTopSide
Definition GuiTypes.h:373
@ kLeftSide
Definition GuiTypes.h:373
@ kButton1
Definition GuiTypes.h:214
@ kAnyButton
Definition GuiTypes.h:214
#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:45
const Bool_t kFALSE
Definition RtypesCore.h:92
unsigned long ULong_t
Definition RtypesCore.h:55
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:73
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
@ kDoubleScaleBoth
@ kDoubleScaleDownRight
@ kDoubleScaleNo
@ kDoubleSliderWidth
@ kDoubleSliderHeight
@ kWidgetWantFocus
Definition TGWidget.h:45
XFontStruct * id
Definition TGX11.cxx:109
int type
Definition TGX11.cxx:121
XPoint xy[kMAXMK]
Definition TGX11.cxx:123
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
#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:288
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:371
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:307
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
Double_t fPressSmax
virtual void PositionChanged()
TGDoubleSlider(const TGDoubleSlider &)=delete
static void FixBounds(Double_t &min, Double_t &max)
Avoid boundaries to be equal.
virtual Float_t GetMinPosition() const
Double_t fPressSmin
virtual void Released()
virtual void Pressed()
const TGPicture * fSliderPic
TString GetSString() const
Returns the slider type as a string - used in SavePrimitive()
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:324
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:720
UInt_t fHeight
Definition TGFrame.h:112
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:740
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition TGFrame.cxx:630
virtual UInt_t GetOptions() const
Definition TGFrame.h:221
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2465
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:750
UInt_t fWidth
Definition TGFrame.h:111
UInt_t GetHeight() const
Definition TGFrame.h:249
UInt_t GetWidth() const
Definition TGFrame.h:248
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2438
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:760
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:56
TString fCommand
Definition TGWidget.h:59
Int_t fWidgetFlags
Definition TGWidget.h:57
const TGWindow * fMsgWindow
Definition TGWidget.h:58
Int_t WidgetId() const
Definition TGWidget.h:78
virtual void SetWindowName(const char *name=0)
Set window name.
Definition TGWindow.cxx:128
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:335
const TGWindow * fParent
Definition TGWindow.h:36
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition TSystem.cxx:464
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