FLTK 1.3.0
Fl_Timer Class Reference

This is provided only to emulate the Forms Timer widget. More...

#include <Fl_Timer.H>

Inheritance diagram for Fl_Timer:
Fl_Widget

List of all members.

Public Member Functions

char direction () const
 Gets or sets the direction of the timer.
void direction (char d)
 Gets or sets the direction of the timer.
 Fl_Timer (uchar t, int x, int y, int w, int h, const char *l)
 Creates a new Fl_Timer widget using the given type, position, size, and label string.
int handle (int)
 Handles the specified event.
char suspended () const
 Gets or sets whether the timer is suspended.
void suspended (char d)
 Gets or sets whether the timer is suspended.
void value (double)
 Sets the current timer value.
double value () const
 See void Fl_Timer::value(double)
 ~Fl_Timer ()
 Destroys the timer and removes the timeout.

Protected Member Functions

void draw ()
 Draws the widget.

Detailed Description

This is provided only to emulate the Forms Timer widget.

It works by making a timeout callback every 1/5 second. This is wasteful and inaccurate if you just want something to happen a fixed time in the future. You should directly call Fl::add_timeout() instead.


Constructor & Destructor Documentation

Fl_Timer::Fl_Timer ( uchar  t,
int  X,
int  Y,
int  W,
int  H,
const char *  l 
)

Creates a new Fl_Timer widget using the given type, position, size, and label string.

The type parameter can be any of the following symbolic constants:

  • FL_NORMAL_TIMER - The timer just does the callback and displays the string "Timer" in the widget.
  • FL_VALUE_TIMER - The timer does the callback and displays the current timer value in the widget.
  • FL_HIDDEN_TIMER - The timer just does the callback and does not display anything.

Member Function Documentation

char Fl_Timer::direction ( ) const [inline]

Gets or sets the direction of the timer.

If the direction is zero then the timer will count up, otherwise it will count down from the initial value().

void Fl_Timer::direction ( char  d) [inline]

Gets or sets the direction of the timer.

If the direction is zero then the timer will count up, otherwise it will count down from the initial value().

void Fl_Timer::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_Timer::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.

char Fl_Timer::suspended ( ) const [inline]

Gets or sets whether the timer is suspended.

void Fl_Timer::suspended ( char  d)

Gets or sets whether the timer is suspended.


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