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
132 TImage *img = TImage::Create();
133 if (!img) return;
134 TImage *img2 = TImage::Create();
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(),
144 img2->Merge(img, "overlay");
145
146 TString name = "disbl_";
147 name += fSliderPic->GetName();
149 delete img;
150 delete img2;
151}
152
153////////////////////////////////////////////////////////////////////////////////
154/// Set state of widget. If kTRUE=enabled, kFALSE=disabled.
155
157{
158 if (state) {
160 } else {
162 }
163 fClient->NeedRedraw(this);
164}
165
166////////////////////////////////////////////////////////////////////////////////
167/// Create a vertical slider widget.
168
170 UInt_t options, ULong_t back) :
171 TGSlider(p, kSliderWidth, h, type, id, options, back)
172{
173 if ((fType & kSlider1))
174 fSliderPic = fClient->GetPicture("slider1h.xpm");
175 else
176 fSliderPic = fClient->GetPicture("slider2h.xpm");
177
178 if (!fSliderPic)
179 Error("TGVSlider", "slider?h.xpm not found");
180
182
183 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
186
188 // set initial values
189 fPos = h/2; fVmin = 0; fVmax = h; fYp = 0;
191
192 if (!p && fClient->IsEditable()) {
193 Resize(GetDefaultWidth(), 100);
194 }
195}
196
197////////////////////////////////////////////////////////////////////////////////
198/// Delete vertical slider widget.
199
205
206////////////////////////////////////////////////////////////////////////////////
207/// Redraw vertical slider widget.
208
210{
211 // cleanup the drawable
212 gVirtualX->ClearWindow(fId);
213
214 GContext_t drawGC = IsEnabled() ? GetBlackGC()() : GetShadowGC()();
215
216 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2, 8, fWidth/2-1, 8);
217 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, 8, fWidth/2-1, fHeight-9);
218 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, 8, fWidth/2+1, fHeight-8);
219 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, fHeight-8, fWidth/2, fHeight-8);
220 gVirtualX->DrawLine(fId, drawGC, fWidth/2, 9, fWidth/2, fHeight-9);
221
222 // check scale
223 if (fScale == 1) fScale++;
224 if (fScale * 2 > (int)fHeight) fScale = 0;
225 if (fScale > 0 && !(fType & kScaleNo)) {
226 int lines = ((int)fHeight-16) / fScale;
227 int remain = ((int)fHeight-16) % fScale;
228 if (lines < 1) lines = 1;
229 for (int i = 0; i <= lines; i++) {
230 int y = i * fScale + (i * remain) / lines;
231 gVirtualX->DrawLine(fId, drawGC, fWidth/2+8, y+7, fWidth/2+10, y+7);
232 if ((fType & kSlider2) && (fType & kScaleBoth))
233 gVirtualX->DrawLine(fId, drawGC, fWidth/2-9, y+7, fWidth/2-11, y+7);
234 }
235 }
236 if (fPos < fVmin) fPos = fVmin;
237 if (fPos > fVmax) fPos = fVmax;
238
239 // calc slider-picture position
240 fRelPos = (((int)fHeight-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
241 const TGPicture *pic = fSliderPic;
242 if (!IsEnabled()) {
245 }
246 if (pic) pic->Draw(fId, GetBckgndGC()(), fWidth/2-7, fRelPos-6);
247}
248
249////////////////////////////////////////////////////////////////////////////////
250/// Handle mouse button event in vertical slider.
251
253{
254 if (!IsEnabled()) return kTRUE;
255 if (event->fCode == kButton4 || event->fCode == kButton5) {
256 Int_t oldPos = fPos;
257 int m = (fVmax - fVmin) / (fWidth-16);
258 if (event->fCode == kButton4)
259 fPos -= ((m) ? m : 1);
260 else if (event->fCode == kButton5)
261 fPos += ((m) ? m : 1);
262 if (fPos > fVmax) fPos = fVmax;
263 if (fPos < fVmin) fPos = fVmin;
265 fWidgetId, fPos);
267 fWidgetId, fPos);
268 if (fPos != oldPos) {
270 fClient->NeedRedraw(this);
271 }
272 return kTRUE;
273 }
274 if (event->fType == kButtonPress) {
275 // constrain to the slider width
276 if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
277 return kTRUE;
278 }
279 // last argument kFALSE forces all specified events to this window
282 kTRUE, kFALSE);
283
284 if (event->fY >= fRelPos - 7 && event->fY <= fRelPos + 7) {
285 // slider selected
287 fYp = event->fY - (fRelPos-7);
290 Pressed();
291 } else {
292 if (event->fCode == kButton1) {
293 // scroll up or down
294 int m = (fVmax - fVmin) / (fHeight-16);
295 if (event->fY < fRelPos) {
296 fPos -= ((m) ? m : 1);
297 }
298 if (event->fY > fRelPos) {
299 fPos += ((m) ? m : 1);
300 }
301 } else if (event->fCode == kButton2) {
302 // set absolute position
303 fPos = ((fVmax - fVmin) * event->fY) / (fHeight-16) + fVmin;
304 }
305 if (fPos > fVmax) fPos = fVmax;
306 if (fPos < fVmin) fPos = fVmin;
308 fWidgetId, fPos);
310 fWidgetId, fPos);
312 }
313 fClient->NeedRedraw(this);
314
315 } else {
316 // ButtonRelease
318 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
319
322 Released();
323 }
324 return kTRUE;
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Handle mouse motion event in vertical slider.
329
331{
332 if (fDragging) {
333 int old = fPos;
334 fPos = ((fVmax - fVmin) * (event->fY - fYp)) / ((int)fHeight-16) + fVmin;
335 if (fPos > fVmax) fPos = fVmax;
336 if (fPos < fVmin) fPos = fVmin;
337
338 // check if position changed
339 if (old != fPos) {
340 fClient->NeedRedraw(this);
342 fWidgetId, fPos);
344 fWidgetId, fPos);
346 }
347 }
348 return kTRUE;
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// Handles resize events for this widget.
353
360
361////////////////////////////////////////////////////////////////////////////////
362/// Create horizontal slider widget.
363
365 UInt_t options, ULong_t back) :
366 TGSlider(p, w, kSliderHeight, type, id, options, back)
367{
368 if ((fType & kSlider1))
369 fSliderPic = fClient->GetPicture("slider1v.xpm");
370 else
371 fSliderPic = fClient->GetPicture("slider2v.xpm");
372
373 if (!fSliderPic)
374 Error("TGHSlider", "slider?v.xpm not found");
375
377
378 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
381
383 // set initial values
384 fPos = w/2; fVmin = 0; fVmax = w; fXp = 0;
386
387 if (!p && fClient->IsEditable()) {
388 Resize(100, GetDefaultHeight());
389 }
390}
391
392////////////////////////////////////////////////////////////////////////////////
393/// Delete a horizontal slider widget.
394
400
401////////////////////////////////////////////////////////////////////////////////
402/// Redraw horizontal slider widget.
403
405{
406 // cleanup drawable
407 gVirtualX->ClearWindow(fId);
408
409 GContext_t drawGC = IsEnabled() ? GetBlackGC()() : GetShadowGC()();
410
411 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2, 8, fHeight/2-1);
412 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2-1, fWidth-9, fHeight/2-1);
413 gVirtualX->DrawLine(fId, GetHilightGC()(), 8, fHeight/2+1, fWidth-8, fHeight/2+1);
414 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-8, fHeight/2+1, fWidth-8, fHeight/2);
415 gVirtualX->DrawLine(fId, drawGC, 9, fHeight/2, fWidth-9, fHeight/2);
416
417 if (fScale == 1) fScale++;
418 if (fScale * 2 > (int)fWidth) fScale = 0;
419 if (fScale > 0 && !(fType & kScaleNo)) {
420 int lines = ((int)fWidth-16) / fScale;
421 int remain = ((int)fWidth-16) % fScale;
422 if (lines < 1) lines = 1;
423 for (int i = 0; i <= lines; i++) {
424 int x = i * fScale + (i * remain) / lines;
425 gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2+8, x+7, fHeight/2+10);
426 if ((fType & kSlider2) && (fType & kScaleBoth))
427 gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2-9, x+7, fHeight/2-11);
428 }
429 }
430 if (fPos < fVmin) fPos = fVmin;
431 if (fPos > fVmax) fPos = fVmax;
432
433 // calc slider-picture position
434 fRelPos = (((int)fWidth-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
435 const TGPicture *pic = fSliderPic;
436 if (!IsEnabled()) {
439 }
440 if (pic) pic->Draw(fId, GetBckgndGC()(), fRelPos-6, fHeight/2-7);
441}
442
443////////////////////////////////////////////////////////////////////////////////
444/// Handle mouse button event in horizontal slider widget.
445
447{
448 if (!IsEnabled()) return kTRUE;
449 if (event->fCode == kButton4 || event->fCode == kButton5) {
450 Int_t oldPos = fPos;
451 int m = (fVmax - fVmin) / (fWidth-16);
452 if (event->fCode == kButton4)
453 fPos += ((m) ? m : 1);
454 else if (event->fCode == kButton5)
455 fPos -= ((m) ? m : 1);
456 if (fPos > fVmax) fPos = fVmax;
457 if (fPos < fVmin) fPos = fVmin;
459 fWidgetId, fPos);
461 fWidgetId, fPos);
462 if (fPos != oldPos) {
464 fClient->NeedRedraw(this);
465 }
466 return kTRUE;
467 }
468 if (event->fType == kButtonPress) {
469 // constrain to the slider height
470 if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
471 return kTRUE;
472 }
473 if (event->fX >= fRelPos - 7 && event->fX <= fRelPos + 7) {
474 // slider selected
476 fXp = event->fX - (fRelPos-7);
479 Pressed();
480 } else {
481 if (event->fCode == kButton1) {
482 int m = (fVmax - fVmin) / (fWidth-16);
483 if (event->fX < fRelPos) {
484 fPos -= ((m) ? m : 1);
485 }
486 if (event->fX > fRelPos) {
487 fPos += ((m) ? m : 1);
488 }
489 } else if (event->fCode == kButton2) {
490 fPos = ((fVmax - fVmin) * event->fX) / (fWidth-16) + fVmin;
491 }
492 if (fPos > fVmax) fPos = fVmax;
493 if (fPos < fVmin) fPos = fVmin;
495 fWidgetId, fPos);
497 fWidgetId, fPos);
499 }
500 fClient->NeedRedraw(this);
501
502 // last argument kFALSE forces all specified events to this window
505 } else {
506 // ButtonRelease
508 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
509
512 Released();
513 }
514 return kTRUE;
515}
516
517////////////////////////////////////////////////////////////////////////////////
518/// Handle mouse motion event in horizontal slide widget.
519
521{
522 if (fDragging) {
523 int old = fPos;
524 fPos = ((fVmax - fVmin) * (event->fX - fXp)) / ((int)fWidth-16) + fVmin;
525 if (fPos > fVmax) fPos = fVmax;
526 if (fPos < fVmin) fPos = fVmin;
527
528 // check if position changed
529 if (old != fPos) {
530 fClient->NeedRedraw(this);
532 fWidgetId, fPos);
534 fWidgetId, fPos);
536 }
537 }
538 return kTRUE;
539}
540
541////////////////////////////////////////////////////////////////////////////////
542/// Handles resize events for this widget.
543
550
551////////////////////////////////////////////////////////////////////////////////
552/// Returns the slider type as a string - used in SavePrimitive().
553
555{
556 TString stype;
557
558 if (fType) {
559 if (fType & kSlider1) {
560 if (stype.Length() == 0) stype = "kSlider1";
561 else stype += " | kSlider1";
562 }
563 if (fType & kSlider2) {
564 if (stype.Length() == 0) stype = "kSlider2";
565 else stype += " | kSlider2";
566 }
567 if (fType & kScaleNo) {
568 if (stype.Length() == 0) stype = "kScaleNo";
569 else stype += " | kScaleNo";
570 }
571 if (fType & kScaleDownRight) {
572 if (stype.Length() == 0) stype = "kScaleDownRight";
573 else stype += " | kScaleDownRight";
574 }
575 if (fType & kScaleBoth) {
576 if (stype.Length() == 0) stype = "kScaleBoth";
577 else stype += " | kScaleBoth";
578 }
579 }
580
581 if (stype.Length() == 0)
582 stype = "0";
583 return stype;
584}
585
586////////////////////////////////////////////////////////////////////////////////
587/// Save an horizontal slider as a C++ statement(s) on output stream out.
588
589void TGHSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
590{
591 // save options and color if not default
592 auto extra_args = SaveCtorArgs(out);
593
594 out <<" TGHSlider *" << GetName() << " = new TGHSlider(" << fParent->GetName()
595 << "," << GetWidth() << "," << GetTypeString() << "," << WidgetId() << extra_args << ");\n";
596
597 if (option && strstr(option, "keep_names"))
598 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
599
600 if (fVmin != 0 || fVmax != (Int_t)fWidth)
601 out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax << ");\n";
602
603 if (fPos != (Int_t)fWidth/2)
604 out << " " << GetName() <<"->SetPosition(" << GetPosition() << ");\n";
605
606 if (fScale != 10)
607 out << " " << GetName() <<"->SetScale(" << fScale << ");\n";
608
609 if (!IsEnabled())
610 out << " " << GetName() <<"->SetState(kFALSE);\n";
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// Save an horizontal slider as a C++ statement(s) on output stream out.
615
616void TGVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
617{
618 // save options and color if not default
619 auto extra_args = SaveCtorArgs(out);
620
621 out << " TGVSlider *" << GetName() << " = new TGVSlider(" << fParent->GetName() << "," << GetHeight() << ","
622 << GetTypeString() << "," << WidgetId() << extra_args << ");\n";
623
624 if (option && strstr(option, "keep_names"))
625 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
626
627 if (fVmin != 0 || fVmax != (Int_t)fHeight)
628 out << " " << GetName() << "->SetRange(" << fVmin << "," << fVmax << ");\n";
629
630 if (fPos != (Int_t)fHeight / 2)
631 out << " " << GetName() << "->SetPosition(" << GetPosition() << ");\n";
632
633 if (fScale != 10)
634 out << " " << GetName() << "->SetScale(" << fScale << ");\n";
635
636 if (!IsEnabled())
637 out << " " << GetName() << "->SetState(kFALSE);\n";
638}
@ kButtonPress
Definition GuiTypes.h:61
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:31
const Mask_t kButtonPressMask
Definition GuiTypes.h:162
const Mask_t kAnyModifier
Definition GuiTypes.h:211
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:39
const Mask_t kPointerMotionMask
Definition GuiTypes.h:164
const Handle_t kNone
Definition GuiTypes.h:89
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:167
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:163
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
@ kButton4
Definition GuiTypes.h:216
@ kButton2
Definition GuiTypes.h:215
@ kButton5
Definition GuiTypes.h:216
@ kButton1
Definition GuiTypes.h:215
@ kAnyButton
Definition GuiTypes.h:215
#define h(i)
Definition RSha256.hxx:106
cudaEvent_t event
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:70
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
R__EXTERN TEnv * gEnv
Definition TEnv.h:126
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:142
#define gVirtualX
Definition TVirtualX.h:379
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:511
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:923
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:381
TGPicturePool * GetPicturePool() const
Definition TGClient.h:126
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:317
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:332
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:728
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:436
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:748
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:638
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:758
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:768
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in horizontal slide widget.
Definition TGSlider.cxx:520
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
Definition TGSlider.cxx:544
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in horizontal slider widget.
Definition TGSlider.cxx:446
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:589
void DoRedraw() override
Redraw horizontal slider widget.
Definition TGSlider.cxx:404
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:395
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:364
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
Pixmap_t GetMask() const
Definition TGPicture.h:55
void Draw(Option_t *="") override
Default Draw method for all objects.
Definition TGPicture.h:46
UInt_t GetHeight() const
Definition TGPicture.h:53
const char * GetName() const override
Returns name of object.
Definition TGPicture.h:51
Pixmap_t GetPicture() const
Definition TGPicture.h:54
UInt_t GetWidth() const
Definition TGPicture.h:52
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:554
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:156
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in vertical slider.
Definition TGSlider.cxx:330
void DoRedraw() override
Redraw vertical slider widget.
Definition TGSlider.cxx:209
~TGVSlider() override
Delete vertical slider widget.
Definition TGSlider.cxx:200
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
Definition TGSlider.cxx:354
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:169
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:616
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in vertical slider.
Definition TGSlider.cxx:252
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:24
static Pixmap_t GetImagePixmap(TImage *img)
Returns image pixmap.
Definition TGWindow.cxx:409
const TGWindow * fParent
Parent window.
Definition TGWindow.h:29
@ kEditDisableHeight
window height cannot be edited
Definition TGWindow.h:63
@ kEditDisableWidth
window width cannot be edited
Definition TGWindow.h:64
static Pixmap_t GetImageMask(TImage *img)
Returns image mask pixmap (alpha channel).
Definition TGWindow.cxx:434
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:33
An abstract interface to image processing library.
Definition TImage.h:30
static TImage * Create()
Create an image.
Definition TImage.cxx:34
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=nullptr)
Definition TImage.h:120
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1082
Basic string class.
Definition TString.h:137
Ssiz_t Length() const
Definition TString.h:426
const char * Data() const
Definition TString.h:385
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:175
TMarker m
Definition textangle.C:8