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 "TASUtils.h"
68#include "TEnv.h"
69#include "TVirtualX.h"
70
71#include <iostream>
72
73
74
75////////////////////////////////////////////////////////////////////////////////
76/// Slider constructor.
77
79 UInt_t options, Pixel_t back)
80 : TGFrame(p, w, h, options, back)
81{
82 fDisabledPic = 0;
83 fWidgetId = id;
85 fMsgWindow = p;
86
87 fType = type;
88 fScale = 10;
90 fPos = fRelPos = 0;
91 fVmax = fVmin = 0;
92 fSliderPic = nullptr;
93}
94
95////////////////////////////////////////////////////////////////////////////////
96/// Set slider range
98{
99 if (max > min) {
100 fVmin = min;
101 fVmax = max;
102 } else
103 Warning("SetRange", "Incorrect range boundaries [%d,%d]", min, max);
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Set slider position
109{
110 if ((pos >= fVmin) && (pos <= fVmax)) {
111 fPos = pos;
112 fClient->NeedRedraw(this);
113 } else
114 Warning("SetPosition", "The position (%d) is out of range [%d,%d]", pos, fVmin, fVmax);
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Change slider picture
125
126////////////////////////////////////////////////////////////////////////////////
127/// Creates disabled picture.
128
130{
131 if (!fSliderPic) return;
132
133 std::unique_ptr<TImage> img2(TImage::Create());
134 if (!img2)
135 return;
136 TString back = gEnv->GetValue("Gui.BackgroundColor", "#c0c0c0");
137 img2->FillRectangle(back.Data(), 0, 0, fSliderPic->GetWidth(),
140 if (!img)
141 return;
142 Pixmap_t mask = TASUtils::GetMask(img.get());
143 img2->Merge(img.get(), "overlay");
144
145 TString name = "disbl_";
146 name.Append(fSliderPic->GetName());
148}
149
150////////////////////////////////////////////////////////////////////////////////
151/// Set state of widget. If kTRUE=enabled, kFALSE=disabled.
152
154{
155 if (state) {
157 } else {
159 }
160 fClient->NeedRedraw(this);
161}
162
163////////////////////////////////////////////////////////////////////////////////
164/// Create a vertical slider widget.
165
167 UInt_t options, ULong_t back) :
168 TGSlider(p, kSliderWidth, h, type, id, options, back)
169{
170 if ((fType & kSlider1))
171 fSliderPic = fClient->GetPicture("slider1h.xpm");
172 else
173 fSliderPic = fClient->GetPicture("slider2h.xpm");
174
175 if (!fSliderPic)
176 Error("TGVSlider", "slider?h.xpm not found");
177
179
180 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
183
185 // set initial values
186 fPos = h/2; fVmin = 0; fVmax = h; fYp = 0;
188
189 if (!p && fClient->IsEditable()) {
190 Resize(GetDefaultWidth(), 100);
191 }
192}
193
194////////////////////////////////////////////////////////////////////////////////
195/// Delete vertical slider widget.
196
202
203////////////////////////////////////////////////////////////////////////////////
204/// Redraw vertical slider widget.
205
207{
208 // cleanup the drawable
209 gVirtualX->ClearWindow(fId);
210
211 GContext_t drawGC = IsEnabled() ? GetBlackGC()() : GetShadowGC()();
212
213 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2, 8, fWidth/2-1, 8);
214 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, 8, fWidth/2-1, fHeight-9);
215 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, 8, fWidth/2+1, fHeight-8);
216 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, fHeight-8, fWidth/2, fHeight-8);
217 gVirtualX->DrawLine(fId, drawGC, fWidth/2, 9, fWidth/2, fHeight-9);
218
219 // check scale
220 if (fScale == 1) fScale++;
221 if (fScale * 2 > (int)fHeight) fScale = 0;
222 if (fScale > 0 && !(fType & kScaleNo)) {
223 int lines = ((int)fHeight-16) / fScale;
224 int remain = ((int)fHeight-16) % fScale;
225 if (lines < 1) lines = 1;
226 for (int i = 0; i <= lines; i++) {
227 int y = i * fScale + (i * remain) / lines;
228 gVirtualX->DrawLine(fId, drawGC, fWidth/2+8, y+7, fWidth/2+10, y+7);
229 if ((fType & kSlider2) && (fType & kScaleBoth))
230 gVirtualX->DrawLine(fId, drawGC, fWidth/2-9, y+7, fWidth/2-11, y+7);
231 }
232 }
233 if (fPos < fVmin) fPos = fVmin;
234 if (fPos > fVmax) fPos = fVmax;
235
236 // calc slider-picture position
237 fRelPos = (((int)fHeight-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
238 const TGPicture *pic = fSliderPic;
239 if (!IsEnabled()) {
242 }
243 if (pic) pic->Draw(fId, GetBckgndGC()(), fWidth/2-7, fRelPos-6);
244}
245
246////////////////////////////////////////////////////////////////////////////////
247/// Handle mouse button event in vertical slider.
248
250{
251 if (!IsEnabled()) return kTRUE;
252 if (event->fCode == kButton4 || event->fCode == kButton5) {
253 Int_t oldPos = fPos;
254 int m = (fVmax - fVmin) / (fWidth-16);
255 if (event->fCode == kButton4)
256 fPos -= ((m) ? m : 1);
257 else if (event->fCode == kButton5)
258 fPos += ((m) ? m : 1);
259 if (fPos > fVmax) fPos = fVmax;
260 if (fPos < fVmin) fPos = fVmin;
262 fWidgetId, fPos);
264 fWidgetId, fPos);
265 if (fPos != oldPos) {
267 fClient->NeedRedraw(this);
268 }
269 return kTRUE;
270 }
271 if (event->fType == kButtonPress) {
272 // constrain to the slider width
273 if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
274 return kTRUE;
275 }
276 // last argument kFALSE forces all specified events to this window
279 kTRUE, kFALSE);
280
281 if (event->fY >= fRelPos - 7 && event->fY <= fRelPos + 7) {
282 // slider selected
284 fYp = event->fY - (fRelPos-7);
287 Pressed();
288 } else {
289 if (event->fCode == kButton1) {
290 // scroll up or down
291 int m = (fVmax - fVmin) / (fHeight-16);
292 if (event->fY < fRelPos) {
293 fPos -= ((m) ? m : 1);
294 }
295 if (event->fY > fRelPos) {
296 fPos += ((m) ? m : 1);
297 }
298 } else if (event->fCode == kButton2) {
299 // set absolute position
300 fPos = ((fVmax - fVmin) * event->fY) / (fHeight-16) + fVmin;
301 }
302 if (fPos > fVmax) fPos = fVmax;
303 if (fPos < fVmin) fPos = fVmin;
305 fWidgetId, fPos);
307 fWidgetId, fPos);
309 }
310 fClient->NeedRedraw(this);
311
312 } else {
313 // ButtonRelease
315 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
316
319 Released();
320 }
321 return kTRUE;
322}
323
324////////////////////////////////////////////////////////////////////////////////
325/// Handle mouse motion event in vertical slider.
326
328{
329 if (fDragging) {
330 int old = fPos;
331 fPos = ((fVmax - fVmin) * (event->fY - fYp)) / ((int)fHeight-16) + fVmin;
332 if (fPos > fVmax) fPos = fVmax;
333 if (fPos < fVmin) fPos = fVmin;
334
335 // check if position changed
336 if (old != fPos) {
337 fClient->NeedRedraw(this);
339 fWidgetId, fPos);
341 fWidgetId, fPos);
343 }
344 }
345 return kTRUE;
346}
347
348////////////////////////////////////////////////////////////////////////////////
349/// Handles resize events for this widget.
350
357
358////////////////////////////////////////////////////////////////////////////////
359/// Create horizontal slider widget.
360
362 UInt_t options, ULong_t back) :
363 TGSlider(p, w, kSliderHeight, type, id, options, back)
364{
365 if ((fType & kSlider1))
366 fSliderPic = fClient->GetPicture("slider1v.xpm");
367 else
368 fSliderPic = fClient->GetPicture("slider2v.xpm");
369
370 if (!fSliderPic)
371 Error("TGHSlider", "slider?v.xpm not found");
372
374
375 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
378
380 // set initial values
381 fPos = w/2; fVmin = 0; fVmax = w; fXp = 0;
383
384 if (!p && fClient->IsEditable()) {
385 Resize(100, GetDefaultHeight());
386 }
387}
388
389////////////////////////////////////////////////////////////////////////////////
390/// Delete a horizontal slider widget.
391
397
398////////////////////////////////////////////////////////////////////////////////
399/// Redraw horizontal slider widget.
400
402{
403 // cleanup drawable
404 gVirtualX->ClearWindow(fId);
405
406 GContext_t drawGC = IsEnabled() ? GetBlackGC()() : GetShadowGC()();
407
408 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2, 8, fHeight/2-1);
409 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2-1, fWidth-9, fHeight/2-1);
410 gVirtualX->DrawLine(fId, GetHilightGC()(), 8, fHeight/2+1, fWidth-8, fHeight/2+1);
411 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-8, fHeight/2+1, fWidth-8, fHeight/2);
412 gVirtualX->DrawLine(fId, drawGC, 9, fHeight/2, fWidth-9, fHeight/2);
413
414 if (fScale == 1) fScale++;
415 if (fScale * 2 > (int)fWidth) fScale = 0;
416 if (fScale > 0 && !(fType & kScaleNo)) {
417 int lines = ((int)fWidth-16) / fScale;
418 int remain = ((int)fWidth-16) % fScale;
419 if (lines < 1) lines = 1;
420 for (int i = 0; i <= lines; i++) {
421 int x = i * fScale + (i * remain) / lines;
422 gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2+8, x+7, fHeight/2+10);
423 if ((fType & kSlider2) && (fType & kScaleBoth))
424 gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2-9, x+7, fHeight/2-11);
425 }
426 }
427 if (fPos < fVmin) fPos = fVmin;
428 if (fPos > fVmax) fPos = fVmax;
429
430 // calc slider-picture position
431 fRelPos = (((int)fWidth-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
432 const TGPicture *pic = fSliderPic;
433 if (!IsEnabled()) {
436 }
437 if (pic) pic->Draw(fId, GetBckgndGC()(), fRelPos-6, fHeight/2-7);
438}
439
440////////////////////////////////////////////////////////////////////////////////
441/// Handle mouse button event in horizontal slider widget.
442
444{
445 if (!IsEnabled()) return kTRUE;
446 if (event->fCode == kButton4 || event->fCode == kButton5) {
447 Int_t oldPos = fPos;
448 int m = (fVmax - fVmin) / (fWidth-16);
449 if (event->fCode == kButton4)
450 fPos += ((m) ? m : 1);
451 else if (event->fCode == kButton5)
452 fPos -= ((m) ? m : 1);
453 if (fPos > fVmax) fPos = fVmax;
454 if (fPos < fVmin) fPos = fVmin;
456 fWidgetId, fPos);
458 fWidgetId, fPos);
459 if (fPos != oldPos) {
461 fClient->NeedRedraw(this);
462 }
463 return kTRUE;
464 }
465 if (event->fType == kButtonPress) {
466 // constrain to the slider height
467 if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
468 return kTRUE;
469 }
470 if (event->fX >= fRelPos - 7 && event->fX <= fRelPos + 7) {
471 // slider selected
473 fXp = event->fX - (fRelPos-7);
476 Pressed();
477 } else {
478 if (event->fCode == kButton1) {
479 int m = (fVmax - fVmin) / (fWidth-16);
480 if (event->fX < fRelPos) {
481 fPos -= ((m) ? m : 1);
482 }
483 if (event->fX > fRelPos) {
484 fPos += ((m) ? m : 1);
485 }
486 } else if (event->fCode == kButton2) {
487 fPos = ((fVmax - fVmin) * event->fX) / (fWidth-16) + fVmin;
488 }
489 if (fPos > fVmax) fPos = fVmax;
490 if (fPos < fVmin) fPos = fVmin;
492 fWidgetId, fPos);
494 fWidgetId, fPos);
496 }
497 fClient->NeedRedraw(this);
498
499 // last argument kFALSE forces all specified events to this window
502 } else {
503 // ButtonRelease
505 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
506
509 Released();
510 }
511 return kTRUE;
512}
513
514////////////////////////////////////////////////////////////////////////////////
515/// Handle mouse motion event in horizontal slide widget.
516
518{
519 if (fDragging) {
520 int old = fPos;
521 fPos = ((fVmax - fVmin) * (event->fX - fXp)) / ((int)fWidth-16) + fVmin;
522 if (fPos > fVmax) fPos = fVmax;
523 if (fPos < fVmin) fPos = fVmin;
524
525 // check if position changed
526 if (old != fPos) {
527 fClient->NeedRedraw(this);
529 fWidgetId, fPos);
531 fWidgetId, fPos);
533 }
534 }
535 return kTRUE;
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// Handles resize events for this widget.
540
547
548////////////////////////////////////////////////////////////////////////////////
549/// Returns the slider type as a string - used in SavePrimitive().
550
552{
553 TString stype;
554
555 if (fType) {
556 if (fType & kSlider1) {
557 if (stype.Length() == 0) stype = "kSlider1";
558 else stype += " | kSlider1";
559 }
560 if (fType & kSlider2) {
561 if (stype.Length() == 0) stype = "kSlider2";
562 else stype += " | kSlider2";
563 }
564 if (fType & kScaleNo) {
565 if (stype.Length() == 0) stype = "kScaleNo";
566 else stype += " | kScaleNo";
567 }
568 if (fType & kScaleDownRight) {
569 if (stype.Length() == 0) stype = "kScaleDownRight";
570 else stype += " | kScaleDownRight";
571 }
572 if (fType & kScaleBoth) {
573 if (stype.Length() == 0) stype = "kScaleBoth";
574 else stype += " | kScaleBoth";
575 }
576 }
577
578 if (stype.Length() == 0)
579 stype = "0";
580 return stype;
581}
582
583////////////////////////////////////////////////////////////////////////////////
584/// Save an horizontal slider as a C++ statement(s) on output stream out.
585
586void TGHSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
587{
588 // save options and color if not default
589 auto extra_args = SaveCtorArgs(out);
590
591 out <<" TGHSlider *" << GetName() << " = new TGHSlider(" << fParent->GetName()
592 << "," << GetWidth() << "," << GetTypeString() << "," << WidgetId() << extra_args << ");\n";
593
594 if (option && strstr(option, "keep_names"))
595 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
596
597 if (fVmin != 0 || fVmax != (Int_t)fWidth)
598 out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax << ");\n";
599
600 if (fPos != (Int_t)fWidth/2)
601 out << " " << GetName() <<"->SetPosition(" << GetPosition() << ");\n";
602
603 if (fScale != 10)
604 out << " " << GetName() <<"->SetScale(" << fScale << ");\n";
605
606 if (!IsEnabled())
607 out << " " << GetName() <<"->SetState(kFALSE);\n";
608}
609
610////////////////////////////////////////////////////////////////////////////////
611/// Save an horizontal slider as a C++ statement(s) on output stream out.
612
613void TGVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
614{
615 // save options and color if not default
616 auto extra_args = SaveCtorArgs(out);
617
618 out << " TGVSlider *" << GetName() << " = new TGVSlider(" << fParent->GetName() << "," << GetHeight() << ","
619 << GetTypeString() << "," << WidgetId() << extra_args << ");\n";
620
621 if (option && strstr(option, "keep_names"))
622 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
623
624 if (fVmin != 0 || fVmax != (Int_t)fHeight)
625 out << " " << GetName() << "->SetRange(" << fVmin << "," << fVmax << ");\n";
626
627 if (fPos != (Int_t)fHeight / 2)
628 out << " " << GetName() << "->SetPosition(" << GetPosition() << ");\n";
629
630 if (fScale != 10)
631 out << " " << GetName() << "->SetScale(" << fScale << ");\n";
632
633 if (!IsEnabled())
634 out << " " << GetName() << "->SetState(kFALSE);\n";
635}
@ 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
static Pixmap_t GetPixmap(TImage *timg)
Returns image pixmap.
Definition TASUtils.cxx:135
static Pixmap_t GetMask(TImage *timg)
Returns image mask pixmap (alpha channel).
Definition TASUtils.cxx:181
static std::unique_ptr< TImage > FromPixmap(Pixmap_t pxm, Pixmap_t mask)
Create image from pixmap.
Definition TASUtils.cxx:271
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:333
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:729
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:437
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:749
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:639
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:759
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:2494
UInt_t GetWidth() const
Definition TGFrame.h:226
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:769
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in horizontal slide widget.
Definition TGSlider.cxx:517
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
Definition TGSlider.cxx:541
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in horizontal slider widget.
Definition TGSlider.cxx:443
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:586
void DoRedraw() override
Redraw horizontal slider widget.
Definition TGSlider.cxx:401
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:392
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:361
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:81
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:129
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:108
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:97
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:551
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:119
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:153
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in vertical slider.
Definition TGSlider.cxx:327
void DoRedraw() override
Redraw vertical slider widget.
Definition TGSlider.cxx:206
~TGVSlider() override
Delete vertical slider widget.
Definition TGSlider.cxx:197
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
Definition TGSlider.cxx:351
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:166
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:613
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in vertical slider.
Definition TGSlider.cxx:249
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:337
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
virtual void Option_t *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: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