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 // //
25 // TGSlider, TGVSlider and TGHSlider //
26 // //
27 // Slider widgets allow easy selection of a range. //
28 // Sliders can be either horizontal or vertical oriented and there is //
29 // a choice of two different slider types and three different types //
30 // of tick marks. //
31 // //
32 // TGSlider is an abstract base class. Use the concrete TGVSlider and //
33 // TGHSlider. //
34 // //
35 // Dragging the slider will generate the event: //
36 // kC_VSLIDER, kSL_POS, slider id, position (for vertical slider) //
37 // kC_HSLIDER, kSL_POS, slider id, position (for horizontal slider) //
38 // //
39 // Pressing the mouse will generate the event: //
40 // kC_VSLIDER, kSL_PRESS, slider id, 0 (for vertical slider) //
41 // kC_HSLIDER, kSL_PRESS, slider id, 0 (for horizontal slider) //
42 // //
43 // Releasing the mouse will generate the event: //
44 // kC_VSLIDER, kSL_RELEASE, slider id, 0 (for vertical slider) //
45 // kC_HSLIDER, kSL_RELEASE, slider id, 0 (for horizontal slider) //
46 // //
47 //////////////////////////////////////////////////////////////////////////
48 
49 #include "TGSlider.h"
50 #include "TGPicture.h"
51 #include "TImage.h"
52 #include "TEnv.h"
53 #include "TVirtualX.h"
54 
55 #include <iostream>
56 
60 
61 
62 ////////////////////////////////////////////////////////////////////////////////
63 /// Slider constructor.
64 
66  UInt_t options, ULong_t back)
67  : TGFrame(p, w, h, options, back)
68 {
69  fDisabledPic = 0;
70  fWidgetId = id;
72  fMsgWindow = p;
73 
74  fType = type;
75  fScale = 10;
76  fDragging = kFALSE;
77  fPos = fRelPos = 0;
78  fVmax = fVmin = 0;
79  fSliderPic = 0;
80 }
81 
82 ////////////////////////////////////////////////////////////////////////////////
83 /// Creates disabled picture.
84 
86 {
87  if (!fSliderPic) return;
88 
89  TImage *img = TImage::Create();
90  if (!img) return;
91  TImage *img2 = TImage::Create();
92  if (!img2) {
93  if (img) delete img;
94  return;
95  }
96  TString back = gEnv->GetValue("Gui.BackgroundColor", "#c0c0c0");
97  img2->FillRectangle(back.Data(), 0, 0, fSliderPic->GetWidth(),
100  Pixmap_t mask = img->GetMask();
101  img2->Merge(img, "overlay");
102 
103  TString name = "disbl_";
104  name += fSliderPic->GetName();
106  img2->GetPixmap(), mask);
107  delete img;
108  delete img2;
109 }
110 
111 ////////////////////////////////////////////////////////////////////////////////
112 /// Set state of widget. If kTRUE=enabled, kFALSE=disabled.
113 
115 {
116  if (state) {
118  } else {
120  }
121  fClient->NeedRedraw(this);
122 }
123 
124 ////////////////////////////////////////////////////////////////////////////////
125 /// Create a vertical slider widget.
126 
128  UInt_t options, ULong_t back) :
129  TGSlider(p, kSliderWidth, h, type, id, options, back)
130 {
131  if ((fType & kSlider1))
132  fSliderPic = fClient->GetPicture("slider1h.xpm");
133  else
134  fSliderPic = fClient->GetPicture("slider2h.xpm");
135 
136  if (!fSliderPic)
137  Error("TGVSlider", "slider?h.xpm not found");
138 
140 
141  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
144 
146  // set initial values
147  fPos = h/2; fVmin = 0; fVmax = h; fYp = 0;
149 
150  if (!p && fClient->IsEditable()) {
151  Resize(GetDefaultWidth(), 100);
152  }
153 }
154 
155 ////////////////////////////////////////////////////////////////////////////////
156 /// Delete vertical slider widget.
157 
159 {
162 }
163 
164 ////////////////////////////////////////////////////////////////////////////////
165 /// Redraw vertical slider widget.
166 
168 {
169  // cleanup the drawable
170  gVirtualX->ClearWindow(fId);
171 
172  GContext_t drawGC = IsEnabled() ? GetBlackGC()() : GetShadowGC()();
173 
174  gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2, 8, fWidth/2-1, 8);
175  gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth/2-1, 8, fWidth/2-1, fHeight-9);
176  gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, 8, fWidth/2+1, fHeight-8);
177  gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth/2+1, fHeight-8, fWidth/2, fHeight-8);
178  gVirtualX->DrawLine(fId, drawGC, fWidth/2, 9, fWidth/2, fHeight-9);
179 
180  // check scale
181  if (fScale == 1) fScale++;
182  if (fScale * 2 > (int)fHeight) fScale = 0;
183  if (fScale > 0 && !(fType & kScaleNo)) {
184  int lines = ((int)fHeight-16) / fScale;
185  int remain = ((int)fHeight-16) % fScale;
186  if (lines < 1) lines = 1;
187  for (int i = 0; i <= lines; i++) {
188  int y = i * fScale + (i * remain) / lines;
189  gVirtualX->DrawLine(fId, drawGC, fWidth/2+8, y+7, fWidth/2+10, y+7);
190  if ((fType & kSlider2) && (fType & kScaleBoth))
191  gVirtualX->DrawLine(fId, drawGC, fWidth/2-9, y+7, fWidth/2-11, y+7);
192  }
193  }
194  if (fPos < fVmin) fPos = fVmin;
195  if (fPos > fVmax) fPos = fVmax;
196 
197  // calc slider-picture position
198  fRelPos = (((int)fHeight-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
199  const TGPicture *pic = fSliderPic;
200  if (!IsEnabled()) {
203  }
204  if (pic) pic->Draw(fId, GetBckgndGC()(), fWidth/2-7, fRelPos-6);
205 }
206 
207 ////////////////////////////////////////////////////////////////////////////////
208 /// Handle mouse button event in vertical slider.
209 
211 {
212  if (!IsEnabled()) return kTRUE;
213  if (event->fCode == kButton4 || event->fCode == kButton5) {
214  Int_t oldPos = fPos;
215  int m = (fVmax - fVmin) / (fWidth-16);
216  if (event->fCode == kButton4)
217  fPos -= ((m) ? m : 1);
218  else if (event->fCode == kButton5)
219  fPos += ((m) ? m : 1);
220  if (fPos > fVmax) fPos = fVmax;
221  if (fPos < fVmin) fPos = fVmin;
223  fWidgetId, fPos);
225  fWidgetId, fPos);
226  if (fPos != oldPos) {
228  fClient->NeedRedraw(this);
229  }
230  return kTRUE;
231  }
232  if (event->fType == kButtonPress) {
233  // constrain to the slider width
234  if (event->fX < (Int_t)fWidth/2-7 || event->fX > (Int_t)fWidth/2+7) {
235  return kTRUE;
236  }
237  // last argument kFALSE forces all specified events to this window
240  kTRUE, kFALSE);
241 
242  if (event->fY >= fRelPos - 7 && event->fY <= fRelPos + 7) {
243  // slider selected
244  fDragging = kTRUE;
245  fYp = event->fY - (fRelPos-7);
248  Pressed();
249  } else {
250  if (event->fCode == kButton1) {
251  // scroll up or down
252  int m = (fVmax - fVmin) / (fHeight-16);
253  if (event->fY < fRelPos) {
254  fPos -= ((m) ? m : 1);
255  }
256  if (event->fY > fRelPos) {
257  fPos += ((m) ? m : 1);
258  }
259  } else if (event->fCode == kButton2) {
260  // set absolute position
261  fPos = ((fVmax - fVmin) * event->fY) / (fHeight-16) + fVmin;
262  }
263  if (fPos > fVmax) fPos = fVmax;
264  if (fPos < fVmin) fPos = fVmin;
266  fWidgetId, fPos);
268  fWidgetId, fPos);
270  }
271  fClient->NeedRedraw(this);
272 
273  } else {
274  // ButtonRelease
275  fDragging = kFALSE;
276  gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
277 
280  Released();
281  }
282  return kTRUE;
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////
286 /// Handle mouse motion event in vertical slider.
287 
289 {
290  if (fDragging) {
291  int old = fPos;
292  fPos = ((fVmax - fVmin) * (event->fY - fYp)) / ((int)fHeight-16) + fVmin;
293  if (fPos > fVmax) fPos = fVmax;
294  if (fPos < fVmin) fPos = fVmin;
295 
296  // check if position changed
297  if (old != fPos) {
298  fClient->NeedRedraw(this);
300  fWidgetId, fPos);
302  fWidgetId, fPos);
304  }
305  }
306  return kTRUE;
307 }
308 
309 ////////////////////////////////////////////////////////////////////////////////
310 /// Handles resize events for this widget.
311 
313 {
315  fClient->NeedRedraw(this);
316  return kTRUE;
317 }
318 
319 ////////////////////////////////////////////////////////////////////////////////
320 /// Create horizontal slider widget.
321 
323  UInt_t options, ULong_t back) :
324  TGSlider(p, w, kSliderHeight, type, id, options, back)
325 {
326  if ((fType & kSlider1))
327  fSliderPic = fClient->GetPicture("slider1v.xpm");
328  else
329  fSliderPic = fClient->GetPicture("slider2v.xpm");
330 
331  if (!fSliderPic)
332  Error("TGHSlider", "slider?v.xpm not found");
333 
335 
336  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
339 
341  // set initial values
342  fPos = w/2; fVmin = 0; fVmax = w; fXp = 0;
344 
345  if (!p && fClient->IsEditable()) {
346  Resize(100, GetDefaultHeight());
347  }
348 }
349 
350 ////////////////////////////////////////////////////////////////////////////////
351 /// Delete a horizontal slider widget.
352 
354 {
357 }
358 
359 ////////////////////////////////////////////////////////////////////////////////
360 /// Redraw horizontal slider widget.
361 
363 {
364  // cleanup drawable
365  gVirtualX->ClearWindow(fId);
366 
367  GContext_t drawGC = IsEnabled() ? GetBlackGC()() : GetShadowGC()();
368 
369  gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2, 8, fHeight/2-1);
370  gVirtualX->DrawLine(fId, GetShadowGC()(), 8, fHeight/2-1, fWidth-9, fHeight/2-1);
371  gVirtualX->DrawLine(fId, GetHilightGC()(), 8, fHeight/2+1, fWidth-8, fHeight/2+1);
372  gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-8, fHeight/2+1, fWidth-8, fHeight/2);
373  gVirtualX->DrawLine(fId, drawGC, 9, fHeight/2, fWidth-9, fHeight/2);
374 
375  if (fScale == 1) fScale++;
376  if (fScale * 2 > (int)fWidth) fScale = 0;
377  if (fScale > 0 && !(fType & kScaleNo)) {
378  int lines = ((int)fWidth-16) / fScale;
379  int remain = ((int)fWidth-16) % fScale;
380  if (lines < 1) lines = 1;
381  for (int i = 0; i <= lines; i++) {
382  int x = i * fScale + (i * remain) / lines;
383  gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2+8, x+7, fHeight/2+10);
384  if ((fType & kSlider2) && (fType & kScaleBoth))
385  gVirtualX->DrawLine(fId, drawGC, x+7, fHeight/2-9, x+7, fHeight/2-11);
386  }
387  }
388  if (fPos < fVmin) fPos = fVmin;
389  if (fPos > fVmax) fPos = fVmax;
390 
391  // calc slider-picture position
392  fRelPos = (((int)fWidth-16) * (fPos - fVmin)) / (fVmax - fVmin) + 8;
393  const TGPicture *pic = fSliderPic;
394  if (!IsEnabled()) {
397  }
398  if (pic) pic->Draw(fId, GetBckgndGC()(), fRelPos-6, fHeight/2-7);
399 }
400 
401 ////////////////////////////////////////////////////////////////////////////////
402 /// Handle mouse button event in horizontal slider widget.
403 
405 {
406  if (!IsEnabled()) return kTRUE;
407  if (event->fCode == kButton4 || event->fCode == kButton5) {
408  Int_t oldPos = fPos;
409  int m = (fVmax - fVmin) / (fWidth-16);
410  if (event->fCode == kButton4)
411  fPos += ((m) ? m : 1);
412  else if (event->fCode == kButton5)
413  fPos -= ((m) ? m : 1);
414  if (fPos > fVmax) fPos = fVmax;
415  if (fPos < fVmin) fPos = fVmin;
417  fWidgetId, fPos);
419  fWidgetId, fPos);
420  if (fPos != oldPos) {
422  fClient->NeedRedraw(this);
423  }
424  return kTRUE;
425  }
426  if (event->fType == kButtonPress) {
427  // constrain to the slider height
428  if (event->fY < (Int_t)fHeight/2-7 || event->fY > (Int_t)fHeight/2+7) {
429  return kTRUE;
430  }
431  if (event->fX >= fRelPos - 7 && event->fX <= fRelPos + 7) {
432  // slider selected
433  fDragging = kTRUE;
434  fXp = event->fX - (fRelPos-7);
437  Pressed();
438  } else {
439  if (event->fCode == kButton1) {
440  int m = (fVmax - fVmin) / (fWidth-16);
441  if (event->fX < fRelPos) {
442  fPos -= ((m) ? m : 1);
443  }
444  if (event->fX > fRelPos) {
445  fPos += ((m) ? m : 1);
446  }
447  } else if (event->fCode == kButton2) {
448  fPos = ((fVmax - fVmin) * event->fX) / (fWidth-16) + fVmin;
449  }
450  if (fPos > fVmax) fPos = fVmax;
451  if (fPos < fVmin) fPos = fVmin;
453  fWidgetId, fPos);
455  fWidgetId, fPos);
457  }
458  fClient->NeedRedraw(this);
459 
460  // last argument kFALSE forces all specified events to this window
462  kNone, kNone, kTRUE, kFALSE);
463  } else {
464  // ButtonRelease
465  fDragging = kFALSE;
466  gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
467 
470  Released();
471  }
472  return kTRUE;
473 }
474 
475 ////////////////////////////////////////////////////////////////////////////////
476 /// Handle mouse motion event in horizontal slide widget.
477 
479 {
480  if (fDragging) {
481  int old = fPos;
482  fPos = ((fVmax - fVmin) * (event->fX - fXp)) / ((int)fWidth-16) + fVmin;
483  if (fPos > fVmax) fPos = fVmax;
484  if (fPos < fVmin) fPos = fVmin;
485 
486  // check if position changed
487  if (old != fPos) {
488  fClient->NeedRedraw(this);
490  fWidgetId, fPos);
492  fWidgetId, fPos);
494  }
495  }
496  return kTRUE;
497 }
498 
499 ////////////////////////////////////////////////////////////////////////////////
500 /// Handles resize events for this widget.
501 
503 {
505  fClient->NeedRedraw(this);
506  return kTRUE;
507 }
508 
509 ////////////////////////////////////////////////////////////////////////////////
510 /// Returns the slider type as a string - used in SavePrimitive().
511 
513 {
514  TString stype;
515 
516  if (fType) {
517  if (fType & kSlider1) {
518  if (stype.Length() == 0) stype = "kSlider1";
519  else stype += " | kSlider1";
520  }
521  if (fType & kSlider2) {
522  if (stype.Length() == 0) stype = "kSlider2";
523  else stype += " | kSlider2";
524  }
525  if (fType & kScaleNo) {
526  if (stype.Length() == 0) stype = "kScaleNo";
527  else stype += " | kScaleNo";
528  }
529  if (fType & kScaleDownRight) {
530  if (stype.Length() == 0) stype = "kScaleDownRight";
531  else stype += " | kScaleDownRight";
532  }
533  if (fType & kScaleBoth) {
534  if (stype.Length() == 0) stype = "kScaleBoth";
535  else stype += " | kScaleBoth";
536  }
537  }
538  return stype;
539 }
540 
541 ////////////////////////////////////////////////////////////////////////////////
542 /// Save an horizontal slider as a C++ statement(s) on output stream out.
543 
544 void TGHSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
545 {
546  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
547 
548  out <<" TGHSlider *";
549  out << GetName() << " = new TGHSlider(" << fParent->GetName()
550  << "," << GetWidth() << ",";
551  out << GetTypeString() << "," << WidgetId();
552 
554  if (!GetOptions()) {
555  out <<");" << std::endl;
556  } else {
557  out << "," << GetOptionString() <<");" << std::endl;
558  }
559  } else {
560  out << "," << GetOptionString() << ",ucolor);" << std::endl;
561  }
562  if (option && strstr(option, "keep_names"))
563  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
564 
565  if (fVmin != 0 || fVmax != (Int_t)fWidth)
566  out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax << ");" << std::endl;
567 
568  if (fPos != (Int_t)fWidth/2)
569  out << " " << GetName() <<"->SetPosition(" << GetPosition() << ");" << std::endl;
570 
571  if (fScale != 10)
572  out << " " << GetName() <<"->SetScale(" << fScale << ");" << std::endl;
573 
574  if (!IsEnabled())
575  out << " " << GetName() <<"->SetState(kFALSE);" << std::endl;
576 }
577 
578 ////////////////////////////////////////////////////////////////////////////////
579 /// Save an horizontal slider as a C++ statement(s) on output stream out.
580 
581 void TGVSlider::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
582 {
583  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
584 
585  out<<" TGVSlider *";
586  out << GetName() <<" = new TGVSlider("<< fParent->GetName()
587  << "," << GetHeight() << ",";
588  out << GetTypeString() << "," << WidgetId();
589 
591 
592  if (!GetOptions()) {
593  out <<");" << std::endl;
594  } else {
595  out << "," << GetOptionString() <<");" << std::endl;
596  }
597  } else {
598  out << "," << GetOptionString() << ",ucolor);" << std::endl;
599  }
600  if (option && strstr(option, "keep_names"))
601  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
602 
603  if (fVmin != 0 || fVmax != (Int_t)fHeight)
604  out << " " << GetName() <<"->SetRange(" << fVmin << "," << fVmax << ");" << std::endl;
605 
606  if (fPos != (Int_t)fHeight/2)
607  out << " " << GetName() <<"->SetPosition(" << GetPosition() << ");" << std::endl;
608 
609  if (fScale != 10)
610  out << " " << GetName() <<"->SetScale(" << fScale << ");" << std::endl;
611 
612  if (!IsEnabled())
613  out << " " << GetName() <<"->SetState(kFALSE);" << std::endl;
614 }
Event_t::fType
EGEventType fType
Definition: GuiTypes.h:174
TGVSlider::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical slider.
Definition: TGSlider.cxx:210
m
auto * m
Definition: textangle.C:8
TGVSlider::DoRedraw
virtual void DoRedraw()
Redraw vertical slider widget.
Definition: TGSlider.cxx:167
kButton2
@ kButton2
Definition: GuiTypes.h:213
TGVSlider::fYp
Int_t fYp
Definition: TGSlider.h:130
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:250
Event_t::fY
Int_t fY
Definition: GuiTypes.h:177
Event_t::fX
Int_t fX
Definition: GuiTypes.h:177
TGSlider::fType
Int_t fType
Definition: TGSlider.h:73
TGWindow
Definition: TGWindow.h:31
TGSlider::SetState
virtual void SetState(Bool_t state)
Set state of widget. If kTRUE=enabled, kFALSE=disabled.
Definition: TGSlider.cxx:114
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
Pixmap_t
Handle_t Pixmap_t
Definition: GuiTypes.h:29
TGSlider::fVmin
Int_t fVmin
Definition: TGSlider.h:71
TGHSlider::fXp
Int_t fXp
Definition: TGSlider.h:157
TGVSlider::HandleConfigureNotify
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handles resize events for this widget.
Definition: TGSlider.cxx:312
TGPicture
Definition: TGPicture.h:36
kAnyModifier
const Mask_t kAnyModifier
Definition: GuiTypes.h:209
TImage::Merge
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
Definition: TImage.h:172
TGSlider::GetPosition
virtual Int_t GetPosition() const
Definition: TGSlider.h:109
TGClient::ProcessLine
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2)
Execute string "cmd" via the interpreter.
Definition: TGClient.cxx:914
TGPicture::GetWidth
UInt_t GetWidth() const
Definition: TGPicture.h:63
kPointerMotionMask
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:162
TImage::Create
static TImage * Create()
Create an image.
Definition: TImage.cxx:35
gEnv
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
kAnyButton
@ kAnyButton
Definition: GuiTypes.h:213
TGSlider::CreateDisabledPicture
virtual void CreateDisabledPicture()
Creates disabled picture.
Definition: TGSlider.cxx:85
TString::Data
const char * Data() const
Definition: TString.h:369
TGSlider.h
TGSlider::fSliderPic
const TGPicture * fSliderPic
Definition: TGSlider.h:76
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGSlider::PositionChanged
virtual void PositionChanged(Int_t pos)
Definition: TGSlider.h:119
TGPicture.h
TGFrame::fWidth
UInt_t fWidth
Definition: TGFrame.h:112
kScaleDownRight
@ kScaleDownRight
Definition: TGSlider.h:61
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
TGPicture::GetMask
Pixmap_t GetMask() const
Definition: TGPicture.h:66
TGFrame::GetDefaultHeight
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:216
kSliderHeight
@ kSliderHeight
Definition: TGSlider.h:56
kButton4
@ kButton4
Definition: GuiTypes.h:214
TGHSlider
Definition: TGSlider.h:154
TGSlider::fPos
Int_t fPos
Definition: TGSlider.h:69
TGHSlider::TGHSlider
TGHSlider(const TGWindow *p=0, 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:322
TGClient::IsEditable
Bool_t IsEditable() const
Definition: TGClient.h:98
TGSlider::Pressed
virtual void Pressed()
Definition: TGSlider.h:120
TGVSlider::~TGVSlider
virtual ~TGVSlider()
Delete vertical slider widget.
Definition: TGSlider.cxx:158
kSlider2
@ kSlider2
Definition: TGSlider.h:57
TImage
Definition: TImage.h:29
TGPicture::Draw
void Draw(Option_t *="")
Default Draw method for all objects.
Definition: TGPicture.h:57
x
Double_t x[n]
Definition: legend1.C:17
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGVSlider
Definition: TGSlider.h:127
kSL_RELEASE
@ kSL_RELEASE
Definition: WidgetMessageTypes.h:71
TGWindow::kEditDisableHeight
@ kEditDisableHeight
Definition: TGWindow.h:63
kButton1
@ kButton1
Definition: GuiTypes.h:213
TEnv::GetValue
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:492
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:668
TVirtualX.h
TGClient::FreePicture
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:309
TGSlider::Released
virtual void Released()
Definition: TGSlider.h:121
TEnv.h
TGFrame::GetBlackGC
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:720
TString
Definition: TString.h:136
TGFrame
Definition: TGFrame.h:105
kButtonPressMask
const Mask_t kButtonPressMask
Definition: GuiTypes.h:160
TGClient::GetPicturePool
TGPicturePool * GetPicturePool() const
Definition: TGClient.h:135
TGHSlider::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in horizontal slider widget.
Definition: TGSlider.cxx:404
bool
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:249
id
XFontStruct * id
Definition: TGX11.cxx:109
TGHSlider::HandleConfigureNotify
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handles resize events for this widget.
Definition: TGSlider.cxx:502
TGHSlider::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in horizontal slide widget.
Definition: TGSlider.cxx:478
TImage.h
TGFrame::GetOptionString
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2465
TGFrame::GetOptions
virtual UInt_t GetOptions() const
Definition: TGFrame.h:222
GContext_t
Handle_t GContext_t
Definition: GuiTypes.h:37
TGWidget::fCommand
TString fCommand
Definition: TGWidget.h:61
kScaleNo
@ kScaleNo
Definition: TGSlider.h:60
TGFrame::AddInput
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:324
kNone
const Handle_t kNone
Definition: GuiTypes.h:87
TGFrame::GetHilightGC
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:740
TGSlider::fVmax
Int_t fVmax
Definition: TGSlider.h:72
kC_HSLIDER
@ kC_HSLIDER
Definition: WidgetMessageTypes.h:66
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGPicturePool::GetPicture
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
Definition: TGPicture.cxx:80
TGVSlider::Resize
virtual void Resize(UInt_t w, UInt_t h)
Resize the frame.
Definition: TGSlider.h:146
h
#define h(i)
Definition: RSha256.hxx:124
TGWidget::WidgetId
Int_t WidgetId() const
Definition: TGWidget.h:80
TGWidget::fMsgWindow
const TGWindow * fMsgWindow
Definition: TGWidget.h:60
TGSlider::fScale
Int_t fScale
Definition: TGSlider.h:74
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:317
TImage::FillRectangle
virtual void FillRectangle(const char *=0, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition: TImage.h:192
TGObject::fId
Handle_t fId
Definition: TGObject.h:36
Event_t::fCode
UInt_t fCode
Definition: GuiTypes.h:179
TGFrame::SendMessage
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:630
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGVSlider::TGVSlider
TGVSlider(const TGWindow *p=0, 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:127
TGWidget::fWidgetFlags
Int_t fWidgetFlags
Definition: TGWidget.h:59
TImage::GetMask
virtual Pixmap_t GetMask()
Definition: TImage.h:236
kButtonPress
@ kButtonPress
Definition: GuiTypes.h:59
kWidgetIsEnabled
@ kWidgetIsEnabled
Definition: TGWidget.h:48
kButtonReleaseMask
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:161
TGWidget::IsEnabled
Bool_t IsEnabled() const
Definition: TGWidget.h:81
TGFrame::SaveUserColor
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2438
TGVSlider::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an horizontal slider as a C++ statement(s) on output stream out.
Definition: TGSlider.cxx:581
TGClient::GetPicture
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:290
TGSlider::GetTypeString
TString GetTypeString() const
Returns the slider type as a string - used in SavePrimitive().
Definition: TGSlider.cxx:512
y
Double_t y[n]
Definition: legend1.C:17
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGSlider
Definition: TGSlider.h:66
TGFrame::GetBckgndGC
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:760
TGVSlider::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical slider.
Definition: TGSlider.cxx:288
kSL_POS
@ kSL_POS
Definition: WidgetMessageTypes.h:68
unsigned int
TGHSlider::DoRedraw
virtual void DoRedraw()
Redraw horizontal slider widget.
Definition: TGSlider.cxx:362
TGWidget::fWidgetId
Int_t fWidgetId
Definition: TGWidget.h:58
TGWidget::ClearFlags
Int_t ClearFlags(Int_t flags)
Definition: TGWidget.h:71
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:373
kSliderWidth
@ kSliderWidth
Definition: TGSlider.h:55
TGObject::fClient
TGClient * fClient
Definition: TGObject.h:37
kSL_PRESS
@ kSL_PRESS
Definition: WidgetMessageTypes.h:70
TGPicture::GetPicture
Pixmap_t GetPicture() const
Definition: TGPicture.h:65
TGFrame::HandleConfigureNotify
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition: TGFrame.cxx:428
TImage::GetPixmap
virtual Pixmap_t GetPixmap()
Definition: TImage.h:235
Event_t
Definition: GuiTypes.h:173
TGHSlider::~TGHSlider
virtual ~TGHSlider()
Delete a horizontal slider widget.
Definition: TGSlider.cxx:353
name
char name[80]
Definition: TGX11.cxx:110
TGPicture::GetName
const char * GetName() const
Returns name of object.
Definition: TGPicture.h:62
TGSlider::fRelPos
Int_t fRelPos
Definition: TGSlider.h:70
kButton5
@ kButton5
Definition: GuiTypes.h:214
TGFrame::GetShadowGC
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:750
TGHSlider::Resize
virtual void Resize(UInt_t w, UInt_t h)
Resize the frame.
Definition: TGSlider.h:173
kC_VSLIDER
@ kC_VSLIDER
Definition: WidgetMessageTypes.h:67
kSlider1
@ kSlider1
Definition: TGSlider.h:56
TGWidget::SetFlags
Int_t SetFlags(Int_t flags)
Definition: TGWidget.h:70
TImage::SetImage
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=0)
Definition: TImage.h:116
TGWindow::kEditDisableWidth
@ kEditDisableWidth
Definition: TGWindow.h:64
TGHSlider::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an horizontal slider as a C++ statement(s) on output stream out.
Definition: TGSlider.cxx:544
kStructureNotifyMask
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:165
TGFrame::fHeight
UInt_t fHeight
Definition: TGFrame.h:113
TGFrame::fBackground
Pixel_t fBackground
Definition: TGFrame.h:120
type
int type
Definition: TGX11.cxx:121
TGWindow::fEditDisabled
UInt_t fEditDisabled
Definition: TGWindow.h:40
kScaleBoth
@ kScaleBoth
Definition: TGSlider.h:62
TGPicture::GetHeight
UInt_t GetHeight() const
Definition: TGPicture.h:64
TGSlider::TGSlider
TGSlider(const TGSlider &)
TGFrame::GetDefaultWidth
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:215
TGSlider::fDisabledPic
const TGPicture * fDisabledPic
Definition: TGSlider.h:77
kWidgetWantFocus
@ kWidgetWantFocus
Definition: TGWidget.h:46
MK_MSG
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Definition: WidgetMessageTypes.h:110
TGSlider::fDragging
Bool_t fDragging
Definition: TGSlider.h:75
TGWindow::fParent
const TGWindow * fParent
Definition: TGWindow.h:36
int