Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGTripleSlider.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot 20/01/06
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#ifndef ROOT_TGTripleSlider
13#define ROOT_TGTripleSlider
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TGTripleVSlider and TGTripleHSlider //
18// //
19// TripleSlider inherit from DoubleSlider widgets and allow easy //
20// selection of a min, max and pointer value out of a range. //
21// The pointer position can be constrained to edges of slider and / or //
22// can be relative to the slider position. //
23// //
24// To change the min value press the mouse near to the left / bottom //
25// edge of the slider. //
26// To change the max value press the mouse near to the right / top //
27// edge of the slider. //
28// To change both values simultaneously press the mouse near to the //
29// center of the slider. //
30// To change pointer value press the mouse on the pointer and drag it //
31// to the desired position //
32// //
33// Dragging the slider will generate the event: //
34// kC_VSLIDER, kSL_POS, slider id, 0 (for vertical slider) //
35// kC_HSLIDER, kSL_POS, slider id, 0 (for horizontal slider) //
36// //
37// Pressing the mouse will generate the event: //
38// kC_VSLIDER, kSL_PRESS, slider id, 0 (for vertical slider) //
39// kC_HSLIDER, kSL_PRESS, slider id, 0 (for horizontal slider) //
40// //
41// Releasing the mouse will generate the event: //
42// kC_VSLIDER, kSL_RELEASE, slider id, 0 (for vertical slider) //
43// kC_HSLIDER, kSL_RELEASE, slider id, 0 (for horizontal slider) //
44// //
45// Moving the pointer will generate the event: //
46// kC_VSLIDER, kSL_POINTER, slider id, 0 (for vertical slider) //
47// kC_HSLIDER, kSL_POINTER, slider id, 0 (for horizontal slider) //
48// //
49// Use the functions GetMinPosition(), GetMaxPosition() and //
50// GetPosition() to retrieve the position of the slider. //
51// Use the function GetPointerPosition() to retrieve the position of //
52// the pointer //
53// //
54//////////////////////////////////////////////////////////////////////////
55
56#include "TGFrame.h"
57#include "TGWidget.h"
58#include "TGDoubleSlider.h"
59
61
62protected:
63 Int_t fCz; // vertical pointer position in pixel coordinates
64 Double_t fSCz; // vertical pointer position
65 Bool_t fConstrained; // kTRUE if pointer is constrained to slider edges
66 Bool_t fRelative; // kTRUE if pointer position is relative to slider
67 const TGPicture *fPointerPic; // picture to draw pointer
68
69 virtual void DoRedraw();
70 virtual void SetPointerPos(Int_t z, Int_t opt = 0);
71
72public:
73 TGTripleVSlider(const TGWindow *p = 0, UInt_t h = 1, UInt_t type = 1, Int_t id = -1,
74 UInt_t options = kVerticalFrame,
76 Bool_t reversed = kFALSE,
77 Bool_t mark_ends = kFALSE,
78 Bool_t constrained = kTRUE,
79 Bool_t relative = kFALSE);
80
81 virtual ~TGTripleVSlider();
82
83 virtual void PointerPositionChanged() { Emit("PointerPositionChanged()"); } //*SIGNAL*
84 virtual void DrawPointer();
85 virtual Float_t GetPointerPosition() const {
87 }
88 virtual Long64_t GetPointerPositionL() const {
90 }
91 virtual Double_t GetPointerPositionD() const {
92 if (fReversedScale) return fVmin + fVmax - fSCz;
93 else return fSCz;
94 }
95 virtual Bool_t HandleButton(Event_t *event);
96 virtual Bool_t HandleConfigureNotify(Event_t* event);
97 virtual Bool_t HandleMotion(Event_t *event);
98 virtual void SetConstrained(Bool_t on = kTRUE);
99 virtual void SetPointerPosition(Double_t pos);
100 virtual void SetPointerPosition(Float_t pos) {
102 }
103 virtual void SetPointerPosition(Long64_t pos) {
105 }
106 virtual void SetRelative(Bool_t rel = kTRUE) { fRelative = rel; }
107 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
108
109 ClassDef(TGTripleVSlider,0) // Vertical triple slider widget
110};
111
112
114
115protected:
116 Int_t fCz; // horizontal pointer position in pixel coordinates
117 Double_t fSCz; // vertical pointer position
118 Bool_t fConstrained; // kTRUE if pointer is constrained to slider edges
119 Bool_t fRelative; // kTRUE if pointer position is relative to slider
120 const TGPicture *fPointerPic; // picture to draw pointer
121
122 virtual void DoRedraw();
123 virtual void SetPointerPos(Int_t z, Int_t opt = 0);
124
125public:
126 TGTripleHSlider(const TGWindow *p = 0, UInt_t w = 1, UInt_t type = 1, Int_t id = -1,
127 UInt_t options = kHorizontalFrame,
129 Bool_t reversed = kFALSE,
130 Bool_t mark_ends = kFALSE,
131 Bool_t constrained = kTRUE,
132 Bool_t relative = kFALSE);
133
134 virtual ~TGTripleHSlider();
135
136 virtual void PointerPositionChanged() { Emit("PointerPositionChanged()"); } //*SIGNAL*
137 virtual void DrawPointer();
138 virtual Float_t GetPointerPosition() const {
139 return (Float_t) GetPointerPositionD();
140 }
142 if (fReversedScale) return fVmin + fVmax - fSCz;
143 else return fSCz;
144 }
146 return (Long64_t) GetPointerPositionD();
147 }
148 virtual Bool_t HandleButton(Event_t *event);
149 virtual Bool_t HandleConfigureNotify(Event_t* event);
150 virtual Bool_t HandleMotion(Event_t *event);
151 virtual void SetConstrained(Bool_t on = kTRUE);
152 virtual void SetPointerPosition(Double_t pos);
153 virtual void SetPointerPosition(Float_t pos) {
155 }
156 virtual void SetPointerPosition(Long64_t pos) {
158 }
159 virtual void SetRelative(Bool_t rel = kTRUE) { fRelative = rel; }
160 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
161
162 ClassDef(TGTripleHSlider,0) // Horizontal triple slider widget
163};
164
165#endif
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define h(i)
Definition RSha256.hxx:106
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:73
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
int type
Definition TGX11.cxx:121
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:668
virtual void DoRedraw()
Redraw horizontal slider widget.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in horizontal slider widget.
const TGPicture * fPointerPic
virtual Double_t GetPointerPositionD() const
virtual void PointerPositionChanged()
virtual void SetRelative(Bool_t rel=kTRUE)
virtual ~TGTripleHSlider()
Delete a horizontal slider widget.
virtual void SetPointerPosition(Long64_t pos)
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handles resize events for this widget.
virtual Float_t GetPointerPosition() const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an horizontal slider as a C++ statement(s) on output stream out.
virtual Long64_t GetPointerPositionL() const
virtual void DrawPointer()
Draw slider pointer.
virtual void SetPointerPosition(Float_t pos)
virtual void SetPointerPos(Int_t z, Int_t opt=0)
Set slider pointer position in pixel value.
virtual void SetPointerPosition(Double_t pos)
Set pointer position in scaled (real) value.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in horizontal slide widget.
virtual void SetConstrained(Bool_t on=kTRUE)
Set pointer position constrained in the slider range.
virtual void SetPointerPos(Int_t z, Int_t opt=0)
Set slider pointer position in pixel value.
virtual Double_t GetPointerPositionD() const
virtual void SetPointerPosition(Double_t pos)
Set pointer position in scaled (real) value.
virtual void DoRedraw()
Redraw vertical slider widget.
virtual void DrawPointer()
Draw slider pointer.
virtual void PointerPositionChanged()
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical slider.
virtual void SetConstrained(Bool_t on=kTRUE)
Set pointer position constrained in the slider range.
virtual ~TGTripleVSlider()
Delete vertical slider widget.
virtual void SetRelative(Bool_t rel=kTRUE)
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handles resize events for this widget.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an horizontal slider as a C++ statement(s) on output stream out.
const TGPicture * fPointerPic
virtual Long64_t GetPointerPositionL() const
virtual void SetPointerPosition(Long64_t pos)
virtual Float_t GetPointerPosition() const
virtual void SetPointerPosition(Float_t pos)
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical slider.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Event structure.
Definition GuiTypes.h:174