FLTK 1.3.0
|
Controls a single floating point value with button (or keyboard) arrows. More...
#include <Fl_Counter.H>
Public Member Functions | |
Fl_Counter (int X, int Y, int W, int H, const char *L=0) | |
Creates a new Fl_Counter widget using the given position, size, and label string. | |
int | handle (int) |
Handles the specified event. | |
void | lstep (double a) |
Sets the increment for the large step buttons. | |
void | step (double a, double b) |
Sets the increments for the normal and large step buttons. | |
void | step (double a) |
Sets the increment for the normal step buttons. | |
double | step () const |
Returns the increment for normal step buttons. | |
void | textcolor (Fl_Color s) |
Sets the font color to s . | |
Fl_Color | textcolor () const |
Gets the font color. | |
Fl_Font | textfont () const |
Gets the text font. | |
void | textfont (Fl_Font s) |
Sets the text font to s . | |
void | textsize (Fl_Fontsize s) |
Sets the font size to s . | |
Fl_Fontsize | textsize () const |
Gets the font size. | |
~Fl_Counter () | |
Destroys the valuator. | |
Protected Member Functions | |
void | draw () |
Draws the widget. |
Controls a single floating point value with button (or keyboard) arrows.
Double arrows buttons achieve larger steps than simple arrows.
The type of an Fl_Counter object can be set using type(uchar t) to:
FL_NORMAL_COUNTER:
Displays a counter with 4 arrow buttons. FL_SIMPLE_COUNTER:
Displays a counter with only 2 arrow buttons. Fl_Counter::Fl_Counter | ( | int | X, |
int | Y, | ||
int | W, | ||
int | H, | ||
const char * | L = 0 |
||
) |
Creates a new Fl_Counter widget using the given position, size, and label string.
The default type is FL_NORMAL_COUNTER.
[in] | X,Y,W,H | position and size of the widget |
[in] | L | widget label, default is no label |
void Fl_Counter::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_Counter::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.
void Fl_Counter::lstep | ( | double | a | ) | [inline] |
Sets the increment for the large step buttons.
The default value is 1.0.
[in] | a | large step increment. |
void Fl_Counter::step | ( | double | a, |
double | b | ||
) | [inline] |
Sets the increments for the normal and large step buttons.
[in] | a,b | normal and large step increments. |
void Fl_Counter::step | ( | double | a | ) | [inline] |
Sets the increment for the normal step buttons.
[in] | a | normal step increment. |
Reimplemented from Fl_Valuator.