class Fl_Slider : public Fl_Object
See also Fl_Value_Slider
Fl_Slider(int x,int y,int w,int h, const char *l = 0);
Fl_Slider(int type, int x,int y,int w,int h, const char *l);
uchar type() const;
void type(uchar);
float value() const;
int value(float);
Get or set the current value. The value is not clamped or
otherwise changed when you set it. If the value changes then the set
routine causes a redraw() and returns true. The initial value is .5.
float minimum() const ;
void minimum(float);
float maximum() const ;
void maximum(float);
The range the slider value can go over. The "minimum" is the value
when the slider is at the top or left, the "maximum" is the value when
the slider is at the bottom or right. The maximum may be less than
the minimum if you want the slider to go the other way. The default
values are 0 and 1.
float step() const;
void step(float);
Get or set the step value. As the user moves the mouse the value is
rounded to the nearest multiple of the step value. This is done
before clamping it to the minimum and maximum.
float size() const;
void size(float);
Get or set the dimensions of the moving piece of slider. This is the
fraction of the size of the entire object. If you set this to 1 then
the slider cannot move. The default value is .08.
For the "fill" sliders this is the size of the area around the end
that causes a drag effect rather than causing the slider to jump to
the mouse.
uchar slider() const;
void slider(uchar);
Set the type of box to draw for the moving part of the slider.
The color of the moving part (or of the notch in it for the nice
sliders) is controlled by color2(). The default value of zero causes
the slider to figure out what to draw from box().
int value(int windowtop,int windowsize,int first,int
totalsize);
Turn the slider into a scrollber. This is done by correctly setting
value(), minimum(), maximum(), and size(). The first argument is the
position of the top of your window, the second is the size of your
window, the third is the position of the top of your data (usually 0),
and the last is the total size of your data. All strange cases (no
data, data less than window size, window position outside the data,
etc) are handled correctly by this function. You should call this
every time your window changes size, your data changes size, or your
scroll position changes (even if in response to a callback from this
scrollbar).
int changed() const;
void set_changed();
void clear_changed();
This value is true if the user has moved the slider. It is turned
off by value(x) and just before doing a callback (the callback can
turn it back on if desired).
uchar when() const;
void when(uchar);
Controls when callbacks are done. The following values are useful:
0
: The callback is not done. changed() is turned on
when the user moves the slider.
FL_WHEN_CHANGED
: The callback is done as the user
moves the slider.
FL_WHEN_RELEASE
(default value) : The callback will
be done when the user releases the mouse.
FL_WHEN_RELEASE|FL_WHEN_NOT_CHANGED
: The callback is
done when the user clicks the mouse on the slider, even if the slider
does not move.