/usr/include/root/TGDoubleSlider.h is in libroot-gui-dev 5.34.19+dfsg-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | // @(#)root/gui:$Id$
// Author: Reiner Rohlfs 30/09/98
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGDoubleSlider
#define ROOT_TGDoubleSlider
//////////////////////////////////////////////////////////////////////////
// //
// TGDoubleSlider, TGDoubleVSlider and TGDoubleHSlider //
// //
// DoubleSlider widgets allow easy selection of a min and a max value //
// out of a range. //
// DoubleSliders can be either horizontal or vertical oriented and //
// there is a choice of three different types of tick marks. //
// //
// To change the min value press the mouse near to the left / bottom //
// edge of the slider. //
// To change the max value press the mouse near to the right / top //
// edge of the slider. //
// To change both values simultaneously press the mouse near to the //
// center of the slider. //
// //
// TGDoubleSlider is an abstract base class. Use the concrete //
// TGDoubleVSlider and TGDoubleHSlider. //
// //
// Dragging the slider will generate the event: //
// kC_VSLIDER, kSL_POS, slider id, 0 (for vertical slider) //
// kC_HSLIDER, kSL_POS, slider id, 0 (for horizontal slider) //
// //
// Pressing the mouse will generate the event: //
// kC_VSLIDER, kSL_PRESS, slider id, 0 (for vertical slider) //
// kC_HSLIDER, kSL_PRESS, slider id, 0 (for horizontal slider) //
// //
// Releasing the mouse will generate the event: //
// kC_VSLIDER, kSL_RELEASE, slider id, 0 (for vertical slider) //
// kC_HSLIDER, kSL_RELEASE, slider id, 0 (for horizontal slider) //
// //
// Use the functions GetMinPosition(), GetMaxPosition() and //
// GetPosition() to retrieve the position of the slider. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif
class TGPicture;
enum EDoubleSliderSize {
//--- sizes for vert. and horz. sliders
kDoubleSliderWidth = 24,
kDoubleSliderHeight = kDoubleSliderWidth
};
enum EDoubleSliderScale {
//--- type of slider scale
kDoubleScaleNo = BIT(0),
kDoubleScaleDownRight = BIT(1),
kDoubleScaleBoth = BIT(2)
};
class TGDoubleSlider : public TGFrame, public TGWidget {
private:
TGDoubleSlider(const TGDoubleSlider&); // Not implemented
TGDoubleSlider& operator=(const TGDoubleSlider&); // Not implemented
protected:
Float_t fPos; // logical position between fVmin and fVmax
Float_t fSmin; // logical position of min value of Slider
Float_t fSmax; // logical position of max value of Slider
Int_t fRelPos; // slider position in pixel coordinates
Float_t fVmin; // logical lower limit of slider
Float_t fVmax; // logical upper limit of slider
Int_t fScale; // tick mark scale
Int_t fScaleType; // tick mark scale type (no, downright, both)
Int_t fPressPoint; // mouse position at button press event
Float_t fPressSmin; // logical min position at button press event
Float_t fPressSmax; // logical max position at button press event
Int_t fMove; // 1: move min value
// 2: move max value
// 3: move min and max value
// 0: don't move any value
Bool_t fReversedScale; // reverse which end is min and max
Bool_t fMarkEnds; // lines marking where stretch zones begin
const TGPicture *fSliderPic; // picture to draw slider ends
TString GetSString() const; // returns scaling type as string
static void FixBounds(Float_t &min, Float_t &max);
void ChangeCursor(Event_t *event);
public:
TGDoubleSlider(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1, UInt_t type = 1, Int_t id = -1,
UInt_t options = kChildFrame,
Pixel_t back = GetDefaultFrameBackground(),
Bool_t reversed = kFALSE,
Bool_t mark_ends = kFALSE);
virtual ~TGDoubleSlider() { }
virtual Bool_t HandleButton(Event_t *event) = 0;
virtual Bool_t HandleMotion(Event_t *event) = 0;
virtual void SetScale(Int_t scale) { fScale = scale; }
virtual void SetRange(Float_t min, Float_t max) {
fVmin = min; fVmax = max;
FixBounds(fVmin, fVmax);
}
virtual void SetPosition(Float_t min, Float_t max) {
if (fReversedScale) { fSmin = fVmin+fVmax-max; fSmax = fVmin+fVmax-min; }
else { fSmin = min; fSmax = max; }
fClient->NeedRedraw(this);
}
virtual Float_t GetMinPosition() const {
if (fReversedScale) return fVmin+fVmax-fSmax;
else return fSmin;
}
virtual Float_t GetMaxPosition() const {
if (fReversedScale) return fVmin+fVmax-fSmin;
else return fSmax;
}
virtual void GetPosition(Float_t &min, Float_t &max) const {
if (fReversedScale) { min = fVmin+fVmax-fSmax; max = fVmin+fVmax-fSmin; }
else { min = fSmin; max = fSmax; }
}
virtual void GetPosition(Float_t *min, Float_t *max) const {
if (fReversedScale) { *min = fVmin+fVmax-fSmax; *max = fVmin+fVmax-fSmin; }
else { *min = fSmin; *max = fSmax; }
}
virtual void MapSubwindows() { TGWindow::MapSubwindows(); }
virtual void PositionChanged() { Emit("PositionChanged()"); } //*SIGNAL*
virtual void Pressed() { Emit("Pressed()"); } //*SIGNAL*
virtual void Released() { Emit("Released()"); } //*SIGNAL*
ClassDef(TGDoubleSlider,0) // Double slider widget abstract base class
};
class TGDoubleVSlider : public TGDoubleSlider {
protected:
Int_t fYp; // vertical slider y position in pixel coordinates
virtual void DoRedraw();
public:
TGDoubleVSlider(const TGWindow *p = 0, UInt_t h = 1, UInt_t type = 1, Int_t id = -1,
UInt_t options = kVerticalFrame,
Pixel_t back = GetDefaultFrameBackground(),
Bool_t reversed = kFALSE,
Bool_t mark_ends = kFALSE);
virtual ~TGDoubleVSlider();
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleMotion(Event_t *event);
virtual TGDimension GetDefaultSize() const
{ return TGDimension(kDoubleSliderWidth, fHeight); }
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGDoubleVSlider,0) // Vertical double slider widget
};
class TGDoubleHSlider : public TGDoubleSlider {
protected:
Int_t fXp; // horizontal slider x position in pixel coordinates
virtual void DoRedraw();
public:
TGDoubleHSlider(const TGWindow *p = 0, UInt_t w = 1, UInt_t type = 1, Int_t id = -1,
UInt_t options = kHorizontalFrame,
Pixel_t back = GetDefaultFrameBackground(),
Bool_t reversed = kFALSE,
Bool_t mark_ends = kFALSE);
virtual ~TGDoubleHSlider();
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleMotion(Event_t *event);
virtual TGDimension GetDefaultSize() const
{ return TGDimension(fWidth, kDoubleSliderHeight); }
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGDoubleHSlider,0) // Horizontal double slider widget
};
#endif
|