FLTK 1.3.0
Fl_Counter Class Reference

Controls a single floating point value with button (or keyboard) arrows. More...

#include <Fl_Counter.H>

Inheritance diagram for Fl_Counter:
Fl_Valuator Fl_Widget Fl_Simple_Counter

List of all members.

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.
Fl_Color textcolor () const
 Gets the font color.
void textcolor (Fl_Color s)
 Sets the font color to s.
Fl_Font textfont () const
 Gets the text font.
void textfont (Fl_Font s)
 Sets the text font to s.
Fl_Fontsize textsize () const
 Gets the font size.
void textsize (Fl_Fontsize s)
 Sets the font size to s.
 ~Fl_Counter ()
 Destroys the valuator.

Protected Member Functions

void draw ()
 Draws the widget.

Detailed Description

Controls a single floating point value with button (or keyboard) arrows.

Double arrows buttons achieve larger steps than simple arrows.

See also:
Fl_Spinner for value input with vertical step arrows.
counter.png
Todo:
Refactor the doxygen comments for Fl_Counter type() documentation.

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.

Constructor & Destructor Documentation

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.

Parameters:
[in]X,Y,W,Hposition and size of the widget
[in]Lwidget label, default is no label

Member Function Documentation

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.

Parameters:
[in]eventthe kind of event received
Return values:
0if the event was not used or understood
1if the event was used and can be deleted
See also:
Fl_Event

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.

Parameters:
[in]alarge step increment.
void Fl_Counter::step ( double  a,
double  b 
) [inline]

Sets the increments for the normal and large step buttons.

Parameters:
[in]a,bnormal and large step increments.
void Fl_Counter::step ( double  a) [inline]

Sets the increment for the normal step buttons.

Parameters:
[in]anormal step increment.

Reimplemented from Fl_Valuator.


The documentation for this class was generated from the following files: