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_Timer Class Reference

#include <Fl_Timer.H>

Inheritance diagram for Fl_Timer:
Collaboration diagram for Fl_Timer:

List of all members.

Public Member Functions

int handle (int)
 Fl_Timer (uchar t, int x, int y, int w, int h, const char *l)
 ~Fl_Timer ()
void value (double)
double value () const
char direction () const
void direction (char d)
char suspended () const
void suspended (char d)

Protected Member Functions

void draw ()

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.

Definition at line 50 of file Fl_Timer.H.


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.

Definition at line 148 of file forms_timer.cxx.

References Fl_Widget::align(), Fl_Widget::box(), Fl_Widget::clear_visible(), FL_ALIGN_LEFT, FL_DOWN_BOX, FL_HIDDEN_TIMER, FL_RED, FL_VALUE_TIMER, Fl_Widget::selection_color(), and Fl_Widget::type().

Fl_Timer::~Fl_Timer ( )

Destroys the timer and removes the timeout.

Definition at line 132 of file forms_timer.cxx.

References Fl::remove_timeout().


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().

Definition at line 70 of file Fl_Timer.H.

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().

Definition at line 76 of file Fl_Timer.H.

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.

Definition at line 72 of file forms_timer.cxx.

References Fl_Widget::box(), Fl_Widget::color(), Fl_Widget::draw_box(), Fl_Widget::draw_label(), FL_ALIGN_CENTER, fl_color(), fl_draw(), fl_font(), FL_TIMER_BLINKRATE, FL_VALUE_TIMER, Fl_Widget::h(), int, Fl_Widget::labelcolor(), Fl_Widget::labelfont(), Fl_Widget::labelsize(), Fl_Widget::selection_color(), Fl_Widget::type(), Fl_Widget::w(), Fl_Widget::x(), and Fl_Widget::y().

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.

Definition at line 124 of file forms_timer.cxx.

References FL_RELEASE, and value().

void Fl_Timer::suspended ( char  d)

Gets or sets whether the timer is suspended.

Definition at line 171 of file forms_timer.cxx.

References Fl::add_timeout(), fl_gettime(), FL_TIMER_BLINKRATE, and Fl::remove_timeout().

char Fl_Timer::suspended ( ) const [inline]

Gets or sets whether the timer is suspended.

Definition at line 78 of file Fl_Timer.H.

void Fl_Timer::value ( double  d)
double Fl_Timer::value ( ) const [inline]

See void Fl_Timer::value(double)

Definition at line 64 of file Fl_Timer.H.

Referenced by handle().


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