FLTK 1.3.0
|
The Fl_Adjuster widget was stolen from Prisms, and has proven to be very useful for values that need a large dynamic range. More...
#include <Fl_Adjuster.H>
Public Member Functions | |
Fl_Adjuster (int X, int Y, int W, int H, const char *l=0) | |
Creates a new Fl_Adjuster widget using the given position, size, and label string. | |
int | soft () const |
If "soft" is turned on, the user is allowed to drag the value outside the range. | |
void | soft (int s) |
If "soft" is turned on, the user is allowed to drag the value outside the range. | |
Protected Member Functions | |
void | draw () |
Draws the widget. | |
int | handle (int) |
Handles the specified event. | |
void | value_damage () |
Asks for partial redraw. |
The Fl_Adjuster widget was stolen from Prisms, and has proven to be very useful for values that need a large dynamic range.
When you press a button and drag to the right the value increases. When you drag to the left it decreases. The largest button adjusts by 100 * step(), the next by 10 * step() and that smallest button by step(). Clicking on the buttons increments by 10 times the amount dragging by a pixel does. Shift + click decrements by 10 times the amount.
Fl_Adjuster::Fl_Adjuster | ( | int | X, |
int | Y, | ||
int | W, | ||
int | H, | ||
const char * | l = 0 |
||
) |
Creates a new Fl_Adjuster widget using the given position, size, and label string.
It looks best if one of the dimensions is 3 times the other.
Inherited destructor destroys the Valuator.
void Fl_Adjuster::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.
int Fl_Adjuster::handle | ( | int | event | ) | [protected, 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.
void Fl_Adjuster::soft | ( | int | s | ) | [inline] |
If "soft" is turned on, the user is allowed to drag the value outside the range.
If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one.
int Fl_Adjuster::soft | ( | ) | const [inline] |
If "soft" is turned on, the user is allowed to drag the value outside the range.
If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one.