Logo ROOT  
Reference Guide
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
75
76
77////////////////////////////////////////////////////////////////////////////////
78/// Slider constructor.
79
81 UInt_t options, Pixel_t back)
82 : TGFrame(p, w, h, options, back)
83{
84 fDisabledPic = 0;
85 fWidgetId = id;
87 fMsgWindow = p;
88
89 fType = type;
90 fScale = 10;
92 fPos = fRelPos = 0;
93 fVmax = fVmin = 0;
94 fSliderPic = nullptr;
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Set slider range
100{
101 if (max > min) {
102 fVmin = min;
103 fVmax = max;
104 } else
105 Warning("SetRange", "Incorrect range boundaries [%d,%d]", min, max);
106}
107
108////////////////////////////////////////////////////////////////////////////////
109/// Set slider position
111{
112 if ((pos >= fVmin) && (pos <= fVmax)) {
113 fPos = pos;
114 fClient->NeedRedraw(this);
115 } else
116 Warning("SetPosition", "The position (%d) is out of range [%d,%d]", pos, fVmin, fVmax);
117}
118
119////////////////////////////////////////////////////////////////////////////////
120/// Change slider picture
122{
123 if (fSliderPic)
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Creates disabled picture.
130
132{
133 if (!fSliderPic) return;
134
135 TImage *img = TImage::Create();
136 if (!img) return;
137 TImage *img2 = TImage::Create();
138 if (!img2) {
139 if (img) delete img;
140 return;
141 }
142 TString back = gEnv->GetValue("Gui.BackgroundColor", "#c0c0c0");
143 img2->FillRectangle(back.Data(), 0, 0, fSliderPic->GetWidth(),
146 Pixmap_t mask = img->GetMask();
147 img2->Merge(img, "overlay");
148
149 TString name = "disbl_";
150 name += fSliderPic->GetName();
152 img2->GetPixmap(), mask);
153 delete img;
154 delete img2;
155}
156
157////////////////////////////////////////////////////////////////////////////////
158/// Set state of widget. If kTRUE=enabled, kFALSE=disabled.
159
161{
162 if (state) {
164 } else {
166 }
167 fClient->NeedRedraw(this);
168}
169
170////////////////////////////////////////////////////////////////////////////////
171/// Create a vertical slider widget.
172
174 UInt_t options, ULong_t back) :
175 TGSlider(p, kSliderWidth, h, type, id, options, back)
176{
177 if ((fType & kSlider1))
178 fSliderPic = fClient->GetPicture("slider1h.xpm");
179 else
180 fSliderPic = fClient->GetPicture("slider2h.xpm");
181
182 if (!fSliderPic)
183 Error("TGVSlider", "slider?h.xpm not found");
184
186
187 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
190
192 // set initial values
193 fPos = h/2; fVmin = 0; fVmax = h; fYp = 0;
195
196 if (!p && fClient->IsEditable()) {
197 Resize(GetDefaultWidth(), 100);
198 }
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Delete vertical slider widget.
203
205{
208}
209
210////////////////////////////////////////////////////////////////////////////////
211/// Redraw vertical slider widget.
212
214{
215 // cleanup the drawable
216 gVirtualX->ClearWindow(fId);
217
218 GContext_t drawGC = IsEnabled() ? GetBlackGC()() : GetShadowGC()();
219
220 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2, 8, fWidth/2-1, 8);
221 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, 8, fWidth/2-1, fHeight-9);
222 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, 8, fWidth/2+1, fHeight-8);
223 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, fHeight-8, fWidth/2, fHeight-8);
224 gVirtualX->DrawLine(fId, drawGC, fWidth/2, 9, fWidth/2, fHeight-9);
225
226 // check scale
227 if (fScale == 1) fScale++;
228 if (fScale * 2 > (int)fHeight) fScale = 0;
229 if (fScale > 0 && !(fType & kScaleNo)) {
230 int lines = ((int)fHeight-16) / fScale;
231 int remain = ((int)fHeight-16) % fScale;
232 if (lines < 1) lines = 1;
233 for (int i = 0; i <= lines; i++) {
234 int y = i * fScale + (i * remain) / lines;
235 gVirtualX->DrawLine(fId, drawGC, fWidth/2+8, y+7, fWidth/2+10, y+7);
236 if ((fType & kSlider2) && (fType & kScaleBoth))
237 gVirtualX->DrawLine(fId, drawGC, fWidth/2-9, y+7, fWidth/2-11, y+7);
238 }
239 }
240 if (fPos < fVmin) fPos = fVmin;
241 if (fPos > fVmax) fPos = fVmax;
242
243 // calc slider-picture position
244 fRelPos = (((int)fHeight-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
245 const TGPicture *pic = fSliderPic;
246 if (!IsEnabled()) {
249 }
250 if (pic) pic->Draw(fId, GetBckgndGC()(), fWidth/2-7, fRelPos-6);
251}
252
253////////////////////////////////////////////////////////////////////////////////
254/// Handle mouse button event in vertical slider.
255
257{
258 if (!IsEnabled()) return kTRUE;
259 if (event->fCode == kButton4 || event->fCode == kButton5) {
260 Int_t oldPos = fPos;
261 int m = (fVmax - fVmin) / (fWidth-16);
262 if (event->fCode == kButton4)
263 fPos -= ((m) ? m : 1);
264 else if (event->fCode == kButton5)
265 fPos += ((m) ? m : 1);
266 if (fPos > fVmax) fPos = fVmax;
267 if (fPos < fVmin) fPos = fVmin;
269 fWidgetId, fPos);
271 fWidgetId, fPos);
272 if (fPos != oldPos) {
274 fClient->NeedRedraw(this);
275 }
276 return kTRUE;
277 }
278 if (event->fType == kButtonPress) {
279 // constrain to the slider width
280 if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
281 return kTRUE;
282 }
283 // last argument kFALSE forces all specified events to this window
286 kTRUE, kFALSE);
287
288 if (event->fY >= fRelPos - 7 && event->fY <= fRelPos + 7) {
289 // slider selected
291 fYp = event->fY - (fRelPos-7);
294 Pressed();
295 } else {
296 if (event->fCode == kButton1) {
297 // scroll up or down
298 int m = (fVmax - fVmin) / (fHeight-16);
299 if (event->fY < fRelPos) {
300 fPos -= ((m) ? m : 1);
301 }
302 if (event->fY > fRelPos) {
303 fPos += ((m) ? m : 1);
304 }
305 } else if (event->fCode == kButton2) {
306 // set absolute position
307 fPos = ((fVmax - fVmin) * event->fY) / (fHeight-16) + fVmin;
308 }
309 if (fPos > fVmax) fPos = fVmax;
310 if (fPos < fVmin) fPos = fVmin;
312 fWidgetId, fPos);
314 fWidgetId, fPos);
316 }
317 fClient->NeedRedraw(this);
318
319 } else {
320 // ButtonRelease
322 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
323
326 Released();
327 }
328 return kTRUE;
329}
330
331////////////////////////////////////////////////////////////////////////////////
332/// Handle mouse motion event in vertical slider.
333
335{
336 if (fDragging) {
337 int old = fPos;
338 fPos = ((fVmax - fVmin) * (event->fY - fYp)) / ((int)fHeight-16) + fVmin;
339 if (fPos > fVmax) fPos = fVmax;
340 if (fPos < fVmin) fPos = fVmin;
341
342 // check if position changed
343 if (old != fPos) {
344 fClient->NeedRedraw(this);
346 fWidgetId, fPos);
348 fWidgetId, fPos);
350 }
351 }
352 return kTRUE;
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Handles resize events for this widget.
357
359{
361 fClient->NeedRedraw(this);
362 return kTRUE;
363}
364
365////////////////////////////////////////////////////////////////////////////////
366/// Create horizontal slider widget.
367
369 UInt_t options, ULong_t back) :
370 TGSlider(p, w, kSliderHeight, type, id, options, back)
371{
372 if ((fType & kSlider1))
373 fSliderPic = fClient->GetPicture("slider1v.xpm");
374 else
375 fSliderPic = fClient->GetPicture("slider2v.xpm");
376
377 if (!fSliderPic)
378 Error("TGHSlider", "slider?v.xpm not found");
379
381
382 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
385
387 // set initial values
388 fPos = w/2; fVmin = 0; fVmax = w; fXp = 0;
390
391 if (!p && fClient->IsEditable()) {
392 Resize(100, GetDefaultHeight());
393 }
394}
395
396////////////////////////////////////////////////////////////////////////////////
397/// Delete a horizontal slider widget.
398
400{
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Redraw horizontal slider widget.
407
409{
410 // cleanup drawable
411 gVirtualX->ClearWindow(fId);
412
413 GContext_t drawGC = IsEnabled() ? GetBlackGC()() : GetShadowGC()();
414
415 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2, 8, fHeight/2-1);
416 gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2-1, fWidth-9, fHeight/2-1);
417 gVirtualX->DrawLine(fId, GetHilightGC()(), 8, fHeight/2+1, fWidth-8, fHeight/2+1);
418 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-8, fHeight/2+1, fWidth-8, fHeight/2);
419 gVirtualX->DrawLine(fId, drawGC, 9, fHeight/2, fWidth-9, fHeight/2);
420
421 if (fScale == 1) fScale++;
422 if (fScale * 2 > (int)fWidth) fScale = 0;
423 if (fScale > 0 && !(fType & kScaleNo)) {
424 int lines = ((int)fWidth-16) / fScale;
425 int remain = ((int)fWidth-16) % fScale;
426 if (lines < 1) lines = 1;
427 for (int i = 0; i <= lines; i++) {
428 int x = i * fScale + (i * remain) / lines;
429 gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2+8, x+7, fHeight/2+10);
430 if ((fType & kSlider2) && (fType & kScaleBoth))
431 gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2-9, x+7, fHeight/2-11);
432 }
433 }
434 if (fPos < fVmin) fPos = fVmin;
435 if (fPos > fVmax) fPos = fVmax;
436
437 // calc slider-picture position
438 fRelPos = (((int)fWidth-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
439 const TGPicture *pic = fSliderPic;
440 if (!IsEnabled()) {
443 }
444 if (pic) pic->Draw(fId, GetBckgndGC()(), fRelPos-6, fHeight/2-7);
445}
446
447////////////////////////////////////////////////////////////////////////////////
448/// Handle mouse button event in horizontal slider widget.
449
451{
452 if (!IsEnabled()) return kTRUE;
453 if (event->fCode == kButton4 || event->fCode == kButton5) {
454 Int_t oldPos = fPos;
455 int m = (fVmax - fVmin) / (fWidth-16);
456 if (event->fCode == kButton4)
457 fPos += ((m) ? m : 1);
458 else if (event->fCode == kButton5)
459 fPos -= ((m) ? m : 1);
460 if (fPos > fVmax) fPos = fVmax;
461 if (fPos < fVmin) fPos = fVmin;
463 fWidgetId, fPos);
465 fWidgetId, fPos);
466 if (fPos != oldPos) {
468 fClient->NeedRedraw(this);
469 }
470 return kTRUE;
471 }
472 if (event->fType == kButtonPress) {
473 // constrain to the slider height
474 if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
475 return kTRUE;
476 }
477 if (event->fX >= fRelPos - 7 && event->fX <= fRelPos + 7) {
478 // slider selected
480 fXp = event->fX - (fRelPos-7);
483 Pressed();
484 } else {
485 if (event->fCode == kButton1) {
486 int m = (fVmax - fVmin) / (fWidth-16);
487 if (event->fX < fRelPos) {
488 fPos -= ((m) ? m : 1);
489 }
490 if (event->fX > fRelPos) {
491 fPos += ((m) ? m : 1);
492 }
493 } else if (event->fCode == kButton2) {
494 fPos = ((fVmax - fVmin) * event->fX) / (fWidth-16) + fVmin;
495 }
496 if (fPos > fVmax) fPos = fVmax;
497 if (fPos < fVmin) fPos = fVmin;
499 fWidgetId, fPos);
501 fWidgetId, fPos);
503 }
504 fClient->NeedRedraw(this);
505
506 // last argument kFALSE forces all specified events to this window
509 } else {
510 // ButtonRelease
512 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
513
516 Released();
517 }
518 return kTRUE;
519}
520
521////////////////////////////////////////////////////////////////////////////////
522/// Handle mouse motion event in horizontal slide widget.
523
525{
526 if (fDragging) {
527 int old = fPos;
528 fPos = ((fVmax - fVmin) * (event->fX - fXp)) / ((int)fWidth-16) + fVmin;
529 if (fPos > fVmax) fPos = fVmax;
530 if (fPos < fVmin) fPos = fVmin;
531
532 // check if position changed
533 if (old != fPos) {
534 fClient->NeedRedraw(this);
536 fWidgetId, fPos);
538 fWidgetId, fPos);
540 }
541 }
542 return kTRUE;
543}
544
545////////////////////////////////////////////////////////////////////////////////
546/// Handles resize events for this widget.
547
549{
551 fClient->NeedRedraw(this);
552 return kTRUE;
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Returns the slider type as a string - used in SavePrimitive().
557
559{
560 TString stype;
561
562 if (fType) {
563 if (fType & kSlider1) {
564 if (stype.Length() == 0) stype = "kSlider1";
565 else stype += " | kSlider1";
566 }
567 if (fType & kSlider2) {
568 if (stype.Length() == 0) stype = "kSlider2";
569 else stype += " | kSlider2";
570 }
571 if (fType & kScaleNo) {
572 if (stype.Length() == 0) stype = "kScaleNo";
573 else stype += " | kScaleNo";
574 }
575 if (fType & kScaleDownRight) {
576 if (stype.Length() == 0) stype = "kScaleDownRight";
577 else stype += " | kScaleDownRight";
578 }
579 if (fType & kScaleBoth) {
580 if (stype.Length() == 0) stype = "kScaleBoth";
581 else stype += " | kScaleBoth";
582 }
583 }
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{
593
594 out <<" TGHSlider *";
595 out << GetName() << " = new TGHSlider(" << fParent->GetName()
596 << "," << GetWidth() << ",";
597 out << GetTypeString() << "," << WidgetId();
598
600 if (!GetOptions()) {
601 out <<");" << std::endl;
602 } else {
603 out << "," << GetOptionString() <<");" << std::endl;
604 }
605 } else {
606 out << "," << GetOptionString() << ",ucolor);" << std::endl;
607 }
608 if (option && strstr(option, "keep_names"))
609 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
610
611 if (fVmin != 0 || fVmax != (Int_t)fWidth)
612 out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax << ");" << std::endl;
613
614 if (fPos != (Int_t)fWidth/2)
615 out << " " << GetName() <<"->SetPosition(" << GetPosition() << ");" << std::endl;
616
617 if (fScale != 10)
618 out << " " << GetName() <<"->SetScale(" << fScale << ");" << std::endl;
619
620 if (!IsEnabled())
621 out << " " << GetName() <<"->SetState(kFALSE);" << std::endl;
622}
623
624////////////////////////////////////////////////////////////////////////////////
625/// Save an horizontal slider as a C++ statement(s) on output stream out.
626
627void TGVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
628{
630
631 out<<" TGVSlider *";
632 out << GetName() <<" = new TGVSlider("<< fParent->GetName()
633 << "," << GetHeight() << ",";
634 out << GetTypeString() << "," << WidgetId();
635
637
638 if (!GetOptions()) {
639 out <<");" << std::endl;
640 } else {
641 out << "," << GetOptionString() <<");" << std::endl;
642 }
643 } else {
644 out << "," << GetOptionString() << ",ucolor);" << std::endl;
645 }
646 if (option && strstr(option, "keep_names"))
647 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
648
649 if (fVmin != 0 || fVmax != (Int_t)fHeight)
650 out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax << ");" << std::endl;
651
652 if (fPos != (Int_t)fHeight/2)
653 out << " " << GetName() <<"->SetPosition(" << GetPosition() << ");" << std::endl;
654
655 if (fScale != 10)
656 out << " " << GetName() <<"->SetScale(" << fScale << ");" << std::endl;
657
658 if (!IsEnabled())
659 out << " " << GetName() <<"->SetState(kFALSE);" << std::endl;
660}
@ 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
const Bool_t kFALSE
Definition: RtypesCore.h:101
const Bool_t kTRUE
Definition: RtypesCore.h:100
unsigned long ULong_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:375
R__EXTERN TEnv * gEnv
Definition: TEnv.h:170
@ 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:338
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:491
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:914
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:289
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:372
TGPicturePool * GetPicturePool() const
Definition: TGClient.h:126
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:308
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:339
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:735
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition: TGFrame.cxx:443
UInt_t fHeight
frame height
Definition: TGFrame.h:88
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:190
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:191
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:755
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
virtual UInt_t GetOptions() const
Definition: TGFrame.h:197
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2506
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:645
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:765
UInt_t fWidth
frame width
Definition: TGFrame.h:87
UInt_t GetHeight() const
Definition: TGFrame.h:225
UInt_t GetWidth() const
Definition: TGFrame.h:224
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2479
Pixel_t fBackground
frame background color
Definition: TGFrame.h:95
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:775
Concrete class for horizontal slider.
Definition: TGSlider.h:119
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in horizontal slide widget.
Definition: TGSlider.cxx:524
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
Definition: TGSlider.cxx:548
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in horizontal slider widget.
Definition: TGSlider.cxx:450
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
virtual ~TGHSlider()
Delete a horizontal slider widget.
Definition: TGSlider.cxx:399
void DoRedraw() override
Redraw horizontal slider widget.
Definition: TGSlider.cxx:408
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(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:368
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:82
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:131
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:110
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:99
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:558
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:121
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:160
Concrete class for vertical slider.
Definition: TGSlider.h:92
virtual ~TGVSlider()
Delete vertical slider widget.
Definition: TGSlider.cxx:204
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in vertical slider.
Definition: TGSlider.cxx:334
void DoRedraw() override
Redraw vertical slider widget.
Definition: TGSlider.cxx:213
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
Definition: TGSlider.cxx:358
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:173
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:627
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in vertical slider.
Definition: TGSlider.cxx:256
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:55
@ kEditDisableWidth
window width cannot be edited
Definition: TGWindow.h:56
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:32
An abstract interface to image processing library.
Definition: TImage.h:29
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=0)
Definition: TImage.h:116
static TImage * Create()
Create an image.
Definition: TImage.cxx:35
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
Definition: TImage.h:172
virtual Pixmap_t GetPixmap()
Definition: TImage.h:235
virtual void FillRectangle(const char *=0, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition: TImage.h:192
virtual Pixmap_t GetMask()
Definition: TImage.h:236
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
Basic string class.
Definition: TString.h:136
Ssiz_t Length() const
Definition: TString.h:410
const char * Data() const
Definition: TString.h:369
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Event structure.
Definition: GuiTypes.h:174
TMarker m
Definition: textangle.C:8