fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Counter Class Reference

#include <Fl_Counter.H>

Inheritance diagram for Fl_Counter:
Collaboration diagram for Fl_Counter:

List of all members.

Public Member Functions

int handle (int)
 Fl_Counter (int X, int Y, int W, int H, const char *L=0)
 ~Fl_Counter ()
void lstep (double a)
void step (double a, double b)
void step (double a)
double step () const
Fl_Font textfont () const
void textfont (Fl_Font s)
Fl_Fontsize textsize () const
void textsize (Fl_Fontsize s)
Fl_Color textcolor () const
void textcolor (Fl_Color s)

Protected Member Functions

void draw ()

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.

Definition at line 57 of file Fl_Counter.H.


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

Definition at line 195 of file Fl_Counter.cxx.

References Fl_Widget::align(), Fl_Valuator::bounds(), Fl_Widget::box(), FL_ALIGN_BOTTOM, FL_FOREGROUND_COLOR, FL_HELVETICA, FL_INACTIVE_COLOR, FL_NORMAL_SIZE, FL_UP_BOX, Fl_Widget::selection_color(), and step().

Fl_Counter::~Fl_Counter ( )

Destroys the valuator.

Definition at line 185 of file Fl_Counter.cxx.

References Fl::remove_timeout().


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.

Definition at line 32 of file Fl_Counter.cxx.

References Fl_Widget::active_r(), Fl_Widget::box(), Fl_Widget::color(), Fl_Widget::damage(), Fl_Widget::draw_box(), Fl_Widget::draw_focus(), FL_ALIGN_CENTER, FL_BACKGROUND2_COLOR, fl_color(), FL_DAMAGE_ALL, fl_down(), FL_DOWN_BOX, fl_draw(), fl_draw_symbol(), fl_font(), fl_inactive(), FL_NORMAL_COUNTER, FL_THIN_DOWN_BOX, FL_THIN_UP_BOX, FL_UP_BOX, Fl::focus(), Fl_Valuator::format(), Fl_Widget::h(), i, Fl_Widget::labelcolor(), textcolor(), textfont(), textsize(), Fl_Widget::type(), Fl_Widget::w(), Fl_Widget::x(), and Fl_Widget::y().

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.

Definition at line 127 of file Fl_Counter.cxx.

References Fl::add_timeout(), Fl_Valuator::clamp(), Fl_Widget_Tracker::deleted(), Fl::event_key(), FL_DRAG, FL_ENTER, FL_FOCUS, FL_KEYBOARD, FL_LEAVE, FL_Left, FL_PUSH, FL_RELEASE, FL_Right, FL_UNFOCUS, Fl::focus(), Fl_Valuator::handle_drag(), Fl_Valuator::handle_push(), Fl_Valuator::handle_release(), i, Fl_Valuator::increment(), INITIALREPEAT, Fl_Widget::redraw(), Fl::remove_timeout(), Fl_Valuator::value(), and Fl::visible_focus().

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.

Definition at line 84 of file Fl_Counter.H.

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.

Definition at line 90 of file Fl_Counter.H.

References b, and Fl_Valuator::step().

void Fl_Counter::step ( double  a) [inline]

Sets the increment for the normal step buttons.

Parameters:
[in]anormal step increment.

Reimplemented from Fl_Valuator.

Definition at line 96 of file Fl_Counter.H.

References Fl_Valuator::step().

double Fl_Counter::step ( ) const [inline]

Returns the increment for normal step buttons.

Reimplemented from Fl_Valuator.

Definition at line 101 of file Fl_Counter.H.

References Fl_Valuator::step().

Referenced by Fl_Counter().

void Fl_Counter::textcolor ( Fl_Color  s) [inline]

Sets the font color to s

Definition at line 116 of file Fl_Counter.H.

Fl_Color Fl_Counter::textcolor ( ) const [inline]

Gets the font color

Definition at line 114 of file Fl_Counter.H.

Referenced by draw().

Fl_Font Fl_Counter::textfont ( ) const [inline]

Gets the text font

Definition at line 104 of file Fl_Counter.H.

Referenced by draw().

void Fl_Counter::textfont ( Fl_Font  s) [inline]

Sets the text font to s

Definition at line 106 of file Fl_Counter.H.

Fl_Fontsize Fl_Counter::textsize ( ) const [inline]

Gets the font size

Definition at line 109 of file Fl_Counter.H.

Referenced by draw().

void Fl_Counter::textsize ( Fl_Fontsize  s) [inline]

Sets the font size to s

Definition at line 111 of file Fl_Counter.H.


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