The Fl_Slider widget contains a sliding knob inside a box. More...
#include <Fl_Slider.H>
Public Member Functions | |
void | bounds (double a, double b) |
Sets the minimum (a) and maximum (b) values for the valuator widget. | |
Fl_Slider (uchar t, int X, int Y, int W, int H, const char *L) | |
Creates a new Fl_Slider widget using the given type, position, size, and label string. | |
Fl_Slider (int X, int Y, int W, int H, const char *L=0) | |
Creates a new Fl_Slider widget using the given position, size, and label string. | |
int | handle (int) |
Handles the specified event. | |
int | scrollvalue (int pos, int size, int first, int total) |
Sets the size and position of the sliding knob in the box. | |
void | slider (Fl_Boxtype c) |
Sets the slider box type. | |
Fl_Boxtype | slider () const |
Gets the slider box type. | |
void | slider_size (double v) |
Set the dimensions of the moving piece of slider. | |
float | slider_size () const |
Get the dimensions of the moving piece of slider. | |
Protected Member Functions | |
void | draw () |
Draws the widget. | |
void | draw (int, int, int, int) |
int | handle (int, int, int, int, int) |
The Fl_Slider widget contains a sliding knob inside a box.
It is often used as a scrollbar. Moving the box all the way to the top/left sets it to the minimum(), and to the bottom/right to the maximum(). The minimum() may be greater than the maximum() to reverse the slider direction.
Use void Fl_Widget::type(int) to set how the slider is drawn, which can be one of the following:
Fl_Slider::Fl_Slider | ( | int | X, | |
int | Y, | |||
int | W, | |||
int | H, | |||
const char * | L = 0 | |||
) |
Creates a new Fl_Slider widget using the given position, size, and label string.
The default boxtype is FL_DOWN_BOX.
void Fl_Slider::bounds | ( | double | a, | |
double | b | |||
) |
Sets the minimum (a) and maximum (b) values for the valuator widget.
if at least one of the values is changed, a partial redraw is asked.
Reimplemented from Fl_Valuator.
void Fl_Slider::draw | ( | ) | [protected, virtual] |
Draws the widget.
Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead.
Override this function to draw your own widgets.
If you ever need to call another widget's draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; // scroll is an embedded Fl_Scrollbar s->draw(); // calls Fl_Scrollbar::draw()
Implements Fl_Widget.
Reimplemented in Fl_Scrollbar, and Fl_Value_Slider.
int Fl_Slider::handle | ( | int | event | ) | [virtual] |
Handles the specified event.
You normally don't call this method directly, but instead let FLTK do it when the user interacts with the widget.
When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise.
Most of the time, you want to call the inherited handle() method in your overridden method so that you don't short-circuit events that you don't handle. In this last case you should return the callee retval.
[in] | event | the kind of event received |
0 | if the event was not used or understood | |
1 | if the event was used and can be deleted |
Reimplemented from Fl_Widget.
Reimplemented in Fl_Scrollbar, and Fl_Value_Slider.
int Fl_Slider::scrollvalue | ( | int | pos, | |
int | size, | |||
int | first, | |||
int | total | |||
) |
Sets the size and position of the sliding knob in the box.
[in] | pos | position of first line displayed |
[in] | size | size of window in lines |
[in] | first | number of first line |
[in] | total | total number of lines Returns Fl_Valuator::value(p) |
void Fl_Slider::slider | ( | Fl_Boxtype | c | ) | [inline] |
Sets the slider box type.
Fl_Boxtype Fl_Slider::slider | ( | ) | const [inline] |
Gets the slider box type.
void Fl_Slider::slider_size | ( | double | v | ) |
Set the dimensions of the moving piece of slider.
This is the fraction of the size of the entire widget. 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.