Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGSlider.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 14/01/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 TGSlider
25 \ingroup guiwidgets
26
27Slider widgets allow easy selection of a range.
28Sliders can be either horizontal or vertical oriented and there is
29a choice of two different slider types and three different types
30of tick marks.
31
32TGSlider is an abstract base class. Use the concrete TGVSlider and
33TGHSlider.
34
35\class TGVSlider
36\ingroup guiwidgets
37Concrete class for vertical slider.
38
39Dragging the slider will generate the event:
40 - kC_VSLIDER, kSL_POS, slider id, position (for vertical slider)
41
42Pressing the mouse will generate the event:
43 - kC_VSLIDER, kSL_PRESS, slider id, 0 (for vertical slider)
44
45Releasing the mouse will generate the event:
46 - kC_VSLIDER, kSL_RELEASE, slider id, 0 (for vertical slider)
47
48\class TGHSlider
49\ingroup guiwidgets
50Concrete class for horizontal slider.
51
52Dragging the slider will generate the event:
53 - kC_HSLIDER, kSL_POS, slider id, position (for horizontal slider)
54
55Pressing the mouse will generate the event:
56 - kC_HSLIDER, kSL_PRESS, slider id, 0 (for horizontal slider)
57
58Releasing the mouse will generate the event:
59 - kC_HSLIDER, kSL_RELEASE, slider id, 0 (for horizontal slider)
60
61*/
62
63
64#include "TGSlider.h"
65#include "TGPicture.h"
66#include "TImage.h"
67#include "TEnv.h"
68#include "TVirtualX.h"
69
70#include <iostream>
71
72
73
74////////////////////////////////////////////////////////////////////////////////
75/// Slider constructor.
76
78 UInt_t options, Pixel_t back)
79 : TGFrame(p, w, h, options, back)
80{
81 fDisabledPic = 0;
82 fWidgetId = id;
84 fMsgWindow = p;
85
86 fType = type;
87 fScale = 10;
89 fPos = fRelPos = 0;
90 fVmax = fVmin = 0;
91 fSliderPic = nullptr;
92}
93
94////////////////////////////////////////////////////////////////////////////////
95/// Set slider range
97{
98 if (max > min) {
99 fVmin = min;
100 fVmax = max;
101 } else
102 Warning("SetRange", "Incorrect range boundaries [%d,%d]", min, max);
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// Set slider position
108{
109 if ((pos >= fVmin) && (pos <= fVmax)) {
110 fPos = pos;
111 fClient->NeedRedraw(this);
112 } else
113 Warning("SetPosition", "The position (%d) is out of range [%d,%d]", pos, fVmin, fVmax);
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Change slider picture
124
125////////////////////////////////////////////////////////////////////////////////
126/// Creates disabled picture.
127
129{
130 if (!fSliderPic) return;
131
133 if (!img) return;
135 if (!img2) {
136 if (img) delete img;
137 return;
138 }
139 TString back = gEnv->GetValue("Gui.BackgroundColor", "#c0c0c0");
140 img2->FillRectangle(back.Data(), 0, 0, fSliderPic->GetWidth(),
141 fSliderPic->GetHeight());
142 img->SetImage(fSliderPic->GetPicture(), fSliderPic->GetMask());
143 Pixmap_t mask = img->GetMask();
144 img2->Merge(img, "overlay");
145
146 TString name = "disbl_";
147 name += fSliderPic->GetName();
149 img2->GetPixmap(), mask);
150 delete img;
151 delete img2;
152}
153
154////////////////////////////////////////////////////////////////////////////////
155/// Set state of widget. If kTRUE=enabled, kFALSE=disabled.
156
158{
159 if (state) {
161 } else {
163 }
164 fClient->NeedRedraw(this);
165}
166
167////////////////////////////////////////////////////////////////////////////////
168/// Create a vertical slider widget.
169
171 UInt_t options, ULong_t back) :
172 TGSlider(p, kSliderWidth, h, type, id, options, back)
173{
174 if ((fType & kSlider1))
175 fSliderPic = fClient->GetPicture("slider1h.xpm");
176 else
177 fSliderPic = fClient->GetPicture("slider2h.xpm");
178
179 if (!fSliderPic)
180 Error("TGVSlider", "slider?h.xpm not found");
181
183
184 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
187
189 // set initial values
190 fPos = h/2; fVmin = 0; fVmax = h; fYp = 0;
192
193 if (!p && fClient->IsEditable()) {
194 Resize(GetDefaultWidth(), 100);
195 }
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Delete vertical slider widget.
200
206
207////////////////////////////////////////////////////////////////////////////////
208/// Redraw vertical slider widget.
209
211{
212 // cleanup the drawable
213 gVirtualX->ClearWindow(fId);
214
216
217 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2, 8, fWidth/2-1, 8);
218 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, 8, fWidth/2-1, fHeight-9);
219 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, 8, fWidth/2+1, fHeight-8);
220 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, fHeight-8, fWidth/2, fHeight-8);
221 gVirtualX->DrawLine(fId, drawGC, fWidth/2, 9, fWidth/2, fHeight-9);
222
223 // check scale
224 if (fScale == 1) fScale++;
225 if (fScale * 2 > (int)fHeight) fScale = 0;
226 if (fScale > 0 && !(fType & kScaleNo)) {
227 int lines = ((int)fHeight-16) / fScale;
228 int remain = ((int)fHeight-16) % fScale;
229 if (lines < 1) lines = 1;
230 for (int i = 0; i <= lines; i++) {
231 int y = i * fScale + (i * remain) / lines;
232 gVirtualX->DrawLine(fId, drawGC, fWidth/2+8, y+7, fWidth/2+10, y+7);
233 if ((fType & kSlider2) && (fType & kScaleBoth))
234 gVirtualX->DrawLine(fId, drawGC, fWidth/2-9, y+7, fWidth/2-11, y+7);
235 }
236 }
237 if (fPos < fVmin) fPos = fVmin;
238 if (fPos > fVmax) fPos = fVmax;
239
240 // calc slider-picture position
241 fRelPos = (((int)fHeight-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
242 const TGPicture *pic = fSliderPic;
243 if (!IsEnabled()) {
246 }
247 if (pic) pic->Draw(fId, GetBckgndGC()(), fWidth/2-7, fRelPos-6);
248}
249
250////////////////////////////////////////////////////////////////////////////////
251/// Handle mouse button event in vertical slider.
252
254{
255 if (!IsEnabled()) return kTRUE;
256 if (event->fCode == kButton4 || event->fCode == kButton5) {
257 Int_t oldPos = fPos;
258 int m = (fVmax - fVmin) / (fWidth-16);
259 if (event->fCode == kButton4)
260 fPos -= ((m) ? m : 1);
261 else if (event->fCode == kButton5)
262 fPos += ((m) ? m : 1);
263 if (fPos > fVmax) fPos = fVmax;
264 if (fPos < fVmin) fPos = fVmin;
266 fWidgetId, fPos);
268 fWidgetId, fPos);
269 if (fPos != oldPos) {
271 fClient->NeedRedraw(this);
272 }
273 return kTRUE;
274 }
275 if (event->fType == kButtonPress) {
276 // constrain to the slider width
277 if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
278 return kTRUE;
279 }
280 // last argument kFALSE forces all specified events to this window
283 kTRUE, kFALSE);
284
285 if (event->fY >= fRelPos - 7 && event->fY <= fRelPos + 7) {
286 // slider selected
288 fYp = event->fY - (fRelPos-7);
291 Pressed();
292 } else {
293 if (event->fCode == kButton1) {
294 // scroll up or down
295 int m = (fVmax - fVmin) / (fHeight-16);
296 if (event->fY < fRelPos) {
297 fPos -= ((m) ? m : 1);
298 }
299 if (event->fY > fRelPos) {
300 fPos += ((m) ? m : 1);
301 }
302 } else if (event->fCode == kButton2) {
303 // set absolute position
304 fPos = ((fVmax - fVmin) * event->fY) / (fHeight-16) + fVmin;
305 }
306 if (fPos > fVmax) fPos = fVmax;
307 if (fPos < fVmin) fPos = fVmin;
309 fWidgetId, fPos);
311 fWidgetId, fPos);
313 }
314 fClient->NeedRedraw(this);
315
316 } else {
317 // ButtonRelease
319 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
320
323 Released();
324 }
325 return kTRUE;
326}
327
328////////////////////////////////////////////////////////////////////////////////
329/// Handle mouse motion event in vertical slider.
330
332{
333 if (fDragging) {
334 int old = fPos;
335 fPos = ((fVmax - fVmin) * (event->fY - fYp)) / ((int)fHeight-16) + fVmin;
336 if (fPos > fVmax) fPos = fVmax;
337 if (fPos < fVmin) fPos = fVmin;
338
339 // check if position changed
340 if (old != fPos) {
341 fClient->NeedRedraw(this);
343 fWidgetId, fPos);
345 fWidgetId, fPos);
347 }
348 }
349 return kTRUE;
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Handles resize events for this widget.
354
361
362////////////////////////////////////////////////////////////////////////////////
363/// Create horizontal slider widget.
364
366 UInt_t options, ULong_t back) :
367 TGSlider(p, w, kSliderHeight, type, id, options, back)
368{
369 if ((fType & kSlider1))
370 fSliderPic = fClient->GetPicture("slider1v.xpm");
371 else
372 fSliderPic = fClient->GetPicture("slider2v.xpm");
373
374 if (!fSliderPic)
375 Error("TGHSlider", "slider?v.xpm not found");
376
378
379 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
382
384 // set initial values
385 fPos = w/2; fVmin = 0; fVmax = w; fXp = 0;
387
388 if (!p && fClient->IsEditable()) {
389 Resize(100, GetDefaultHeight());
390 }
391}
392
393////////////////////////////////////////////////////////////////////////////////
394/// Delete a horizontal slider widget.
395
401
402////////////////////////////////////////////////////////////////////////////////
403/// Redraw horizontal slider widget.
404
406{
407 // cleanup drawable
408 gVirtualX->ClearWindow(fId);
409
411
412 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2, 8, fHeight/2-1);
413 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2-1, fWidth-9, fHeight/2-1);
414 gVirtualX->DrawLine(fId, GetHilightGC()(), 8, fHeight/2+1, fWidth-8, fHeight/2+1);
415 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-8, fHeight/2+1, fWidth-8, fHeight/2);
416 gVirtualX->DrawLine(fId, drawGC, 9, fHeight/2, fWidth-9, fHeight/2);
417
418 if (fScale == 1) fScale++;
419 if (fScale * 2 > (int)fWidth) fScale = 0;
420 if (fScale > 0 && !(fType & kScaleNo)) {
421 int lines = ((int)fWidth-16) / fScale;
422 int remain = ((int)fWidth-16) % fScale;
423 if (lines < 1) lines = 1;
424 for (int i = 0; i <= lines; i++) {
425 int x = i * fScale + (i * remain) / lines;
426 gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2+8, x+7, fHeight/2+10);
427 if ((fType & kSlider2) && (fType & kScaleBoth))
428 gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2-9, x+7, fHeight/2-11);
429 }
430 }
431 if (fPos < fVmin) fPos = fVmin;
432 if (fPos > fVmax) fPos = fVmax;
433
434 // calc slider-picture position
435 fRelPos = (((int)fWidth-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
436 const TGPicture *pic = fSliderPic;
437 if (!IsEnabled()) {
440 }
441 if (pic) pic->Draw(fId, GetBckgndGC()(), fRelPos-6, fHeight/2-7);
442}
443
444////////////////////////////////////////////////////////////////////////////////
445/// Handle mouse button event in horizontal slider widget.
446
448{
449 if (!IsEnabled()) return kTRUE;
450 if (event->fCode == kButton4 || event->fCode == kButton5) {
451 Int_t oldPos = fPos;
452 int m = (fVmax - fVmin) / (fWidth-16);
453 if (event->fCode == kButton4)
454 fPos += ((m) ? m : 1);
455 else if (event->fCode == kButton5)
456 fPos -= ((m) ? m : 1);
457 if (fPos > fVmax) fPos = fVmax;
458 if (fPos < fVmin) fPos = fVmin;
460 fWidgetId, fPos);
462 fWidgetId, fPos);
463 if (fPos != oldPos) {
465 fClient->NeedRedraw(this);
466 }
467 return kTRUE;
468 }
469 if (event->fType == kButtonPress) {
470 // constrain to the slider height
471 if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
472 return kTRUE;
473 }
474 if (event->fX >= fRelPos - 7 && event->fX <= fRelPos + 7) {
475 // slider selected
477 fXp = event->fX - (fRelPos-7);
480 Pressed();
481 } else {
482 if (event->fCode == kButton1) {
483 int m = (fVmax - fVmin) / (fWidth-16);
484 if (event->fX < fRelPos) {
485 fPos -= ((m) ? m : 1);
486 }
487 if (event->fX > fRelPos) {
488 fPos += ((m) ? m : 1);
489 }
490 } else if (event->fCode == kButton2) {
491 fPos = ((fVmax - fVmin) * event->fX) / (fWidth-16) + fVmin;
492 }
493 if (fPos > fVmax) fPos = fVmax;
494 if (fPos < fVmin) fPos = fVmin;
496 fWidgetId, fPos);
498 fWidgetId, fPos);
500 }
501 fClient->NeedRedraw(this);
502
503 // last argument kFALSE forces all specified events to this window
506 } else {
507 // ButtonRelease
509 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
510
513 Released();
514 }
515 return kTRUE;
516}
517
518////////////////////////////////////////////////////////////////////////////////
519/// Handle mouse motion event in horizontal slide widget.
520
522{
523 if (fDragging) {
524 int old = fPos;
525 fPos = ((fVmax - fVmin) * (event->fX - fXp)) / ((int)fWidth-16) + fVmin;
526 if (fPos > fVmax) fPos = fVmax;
527 if (fPos < fVmin) fPos = fVmin;
528
529 // check if position changed
530 if (old != fPos) {
531 fClient->NeedRedraw(this);
533 fWidgetId, fPos);
535 fWidgetId, fPos);
537 }
538 }
539 return kTRUE;
540}
541
542////////////////////////////////////////////////////////////////////////////////
543/// Handles resize events for this widget.
544
551
552////////////////////////////////////////////////////////////////////////////////
553/// Returns the slider type as a string - used in SavePrimitive().
554
556{
557 TString stype;
558
559 if (fType) {
560 if (fType & kSlider1) {
561 if (stype.Length() == 0) stype = "kSlider1";
562 else stype += " | kSlider1";
563 }
564 if (fType & kSlider2) {
565 if (stype.Length() == 0) stype = "kSlider2";
566 else stype += " | kSlider2";
567 }
568 if (fType & kScaleNo) {
569 if (stype.Length() == 0) stype = "kScaleNo";
570 else stype += " | kScaleNo";
571 }
572 if (fType & kScaleDownRight) {
573 if (stype.Length() == 0) stype = "kScaleDownRight";
574 else stype += " | kScaleDownRight";
575 }
576 if (fType & kScaleBoth) {
577 if (stype.Length() == 0) stype = "kScaleBoth";
578 else stype += " | kScaleBoth";
579 }
580 }
581
582 if (stype.Length() == 0)
583 stype = "0";
584 return stype;
585}
586
587////////////////////////////////////////////////////////////////////////////////
588/// Save an horizontal slider as a C++ statement(s) on output stream out.
589
590void TGHSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
591{
592 // save options and color if not default
593 auto extra_args = SaveCtorArgs(out);
594
595 out <<" TGHSlider *" << GetName() << " = new TGHSlider(" << fParent->GetName()
596 << "," << GetWidth() << "," << GetTypeString() << "," << WidgetId() << extra_args << ");\n";
597
598 if (option && strstr(option, "keep_names"))
599 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
600
601 if (fVmin != 0 || fVmax != (Int_t)fWidth)
602 out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax << ");\n";
603
604 if (fPos != (Int_t)fWidth/2)
605 out << " " << GetName() <<"->SetPosition(" << GetPosition() << ");\n";
606
607 if (fScale != 10)
608 out << " " << GetName() <<"->SetScale(" << fScale << ");\n";
609
610 if (!IsEnabled())
611 out << " " << GetName() <<"->SetState(kFALSE);\n";
612}
613
614////////////////////////////////////////////////////////////////////////////////
615/// Save an horizontal slider as a C++ statement(s) on output stream out.
616
617void TGVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
618{
619 // save options and color if not default
620 auto extra_args = SaveCtorArgs(out);
621
622 out << " TGVSlider *" << GetName() << " = new TGVSlider(" << fParent->GetName() << "," << GetHeight() << ","
623 << GetTypeString() << "," << WidgetId() << extra_args << ");\n";
624
625 if (option && strstr(option, "keep_names"))
626 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
627
628 if (fVmin != 0 || fVmax != (Int_t)fHeight)
629 out << " " << GetName() << "->SetRange(" << fVmin << "," << fVmax << ");\n";
630
631 if (fPos != (Int_t)fHeight / 2)
632 out << " " << GetName() << "->SetPosition(" << GetPosition() << ");\n";
633
634 if (fScale != 10)
635 out << " " << GetName() << "->SetScale(" << fScale << ");\n";
636
637 if (!IsEnabled())
638 out << " " << GetName() << "->SetState(kFALSE);\n";
639}
@ kButtonPress
Definition GuiTypes.h:60
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kAnyModifier
Definition GuiTypes.h:210
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
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
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton4
Definition GuiTypes.h:215
@ kButton2
Definition GuiTypes.h:214
@ kButton5
Definition GuiTypes.h:215
@ kButton1
Definition GuiTypes.h:214
@ kAnyButton
Definition GuiTypes.h:214
#define h(i)
Definition RSha256.hxx:106
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.
R__EXTERN TEnv * gEnv
Definition TEnv.h:170
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
@ kSliderWidth
Definition TGSlider.h:23
@ kSliderHeight
Definition TGSlider.h:24
@ kScaleNo
Definition TGSlider.h:34
@ kScaleBoth
Definition TGSlider.h:36
@ kSlider2
Definition TGSlider.h:31
@ kSlider1
Definition TGSlider.h:30
@ kScaleDownRight
Definition TGSlider.h:35
@ kWidgetIsEnabled
Definition TGWidget.h:37
@ 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 void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
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 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
char name[80]
Definition TGX11.cxx:110
#define gVirtualX
Definition TVirtualX.h:337
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
@ kSL_RELEASE
@ kSL_POS
@ kC_HSLIDER
@ kSL_PRESS
@ kC_VSLIDER
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:490
Bool_t IsEditable() const
Definition TGClient.h:89
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
TGPicturePool * GetPicturePool() const
Definition TGClient.h:126
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:316
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
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:435
UInt_t fHeight
frame height
Definition TGFrame.h:88
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:192
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:193
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:747
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
TString SaveCtorArgs(std::ostream &out, UInt_t dflt_options=kChildFrame, Bool_t check_white_pixel=kFALSE)
Return options and custom color as constructor args Used in the SavePrimitive methods,...
Definition TGFrame.cxx:2493
UInt_t GetWidth() const
Definition TGFrame.h:226
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:767
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in horizontal slide widget.
Definition TGSlider.cxx:521
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
Definition TGSlider.cxx:545
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in horizontal slider widget.
Definition TGSlider.cxx:447
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an horizontal slider as a C++ statement(s) on output stream out.
Definition TGSlider.cxx:590
void DoRedraw() override
Redraw horizontal slider widget.
Definition TGSlider.cxx:405
Int_t fXp
horizontal slider x position in pixel coordinates
Definition TGSlider.h:122
void Resize(UInt_t w, UInt_t h) override
Resize the frame.
Definition TGSlider.h:138
~TGHSlider() override
Delete a horizontal slider widget.
Definition TGSlider.cxx:396
TGHSlider(const TGWindow *p=nullptr, UInt_t w=40, UInt_t type=kSlider1|kScaleBoth, Int_t id=-1, UInt_t options=kHorizontalFrame, Pixel_t back=GetDefaultFrameBackground())
Create horizontal slider widget.
Definition TGSlider.cxx:365
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
Definition TGPicture.cxx:80
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
Slider widgets allow easy selection of a range.
Definition TGSlider.h:40
Int_t fPos
logical position between fVmin and fVmax
Definition TGSlider.h:43
Int_t fRelPos
slider position in pixel coordinates
Definition TGSlider.h:44
virtual void CreateDisabledPicture()
Creates disabled picture.
Definition TGSlider.cxx:128
virtual void Released()
Definition TGSlider.h:86
virtual void Pressed()
Definition TGSlider.h:85
virtual Int_t GetPosition() const
Definition TGSlider.h:77
virtual void SetPosition(Int_t pos)
Set slider position.
Definition TGSlider.cxx:107
const TGPicture * fSliderPic
picture to draw slider
Definition TGSlider.h:50
virtual void SetRange(Int_t min, Int_t max)
Set slider range.
Definition TGSlider.cxx:96
Int_t fVmin
logical lower limit of slider
Definition TGSlider.h:45
Int_t fType
slider type bits
Definition TGSlider.h:47
TString GetTypeString() const
used in SavePrimitive
Definition TGSlider.cxx:555
TGSlider(const TGSlider &)=delete
Bool_t fDragging
true if in dragging mode
Definition TGSlider.h:49
Int_t fScale
tick mark scale
Definition TGSlider.h:48
virtual void ChangeSliderPic(const char *name)
Change slider picture.
Definition TGSlider.cxx:118
const TGPicture * fDisabledPic
picture to draw disabled slider
Definition TGSlider.h:51
virtual void PositionChanged(Int_t pos)
Definition TGSlider.h:84
Int_t fVmax
logical upper limit of slider
Definition TGSlider.h:46
virtual void SetState(Bool_t state)
Set state of widget. If kTRUE=enabled, kFALSE=disabled.
Definition TGSlider.cxx:157
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in vertical slider.
Definition TGSlider.cxx:331
void DoRedraw() override
Redraw vertical slider widget.
Definition TGSlider.cxx:210
~TGVSlider() override
Delete vertical slider widget.
Definition TGSlider.cxx:201
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
Definition TGSlider.cxx:355
void Resize(UInt_t w, UInt_t h) override
Resize the frame.
Definition TGSlider.h:111
Int_t fYp
vertical slider y position in pixel coordinates
Definition TGSlider.h:95
TGVSlider(const TGWindow *p=nullptr, UInt_t h=40, UInt_t type=kSlider1|kScaleBoth, Int_t id=-1, UInt_t options=kVerticalFrame, Pixel_t back=GetDefaultFrameBackground())
Create a vertical slider widget.
Definition TGSlider.cxx:170
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an horizontal slider as a C++ statement(s) on output stream out.
Definition TGSlider.cxx:617
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in vertical slider.
Definition TGSlider.cxx:253
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 ClearFlags(Int_t flags)
Definition TGWidget.h:59
Int_t fWidgetFlags
widget status flags (OR of EWidgetStatus)
Definition TGWidget.h:47
Int_t SetFlags(Int_t flags)
Definition TGWidget.h:58
const TGWindow * fMsgWindow
window which handles widget events
Definition TGWidget.h:48
Bool_t IsEnabled() const
Definition TGWidget.h:69
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
@ kEditDisableHeight
window height cannot be edited
Definition TGWindow.h:62
@ kEditDisableWidth
window width cannot be edited
Definition TGWindow.h:63
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:334
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
An abstract interface to image processing library.
Definition TImage.h:29
static TImage * Create()
Create an image.
Definition TImage.cxx:34
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1057
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:425
const char * Data() const
Definition TString.h:384
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
TMarker m
Definition textangle.C:8