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

#include <Fl_Free.H>

Inheritance diagram for Fl_Free:
Collaboration diagram for Fl_Free:

List of all members.

Public Member Functions

int handle (int e)
 Fl_Free (uchar t, int X, int Y, int W, int H, const char *L, FL_HANDLEPTR hdl)
 ~Fl_Free ()

Protected Member Functions

void draw ()

Detailed Description

Emulation of the Forms "free" widget.

This emulation allows the free demo to run, and appears to be useful for porting programs written in Forms which use the free widget or make subclasses of the Forms widgets.

There are five types of free, which determine when the handle function is called:

  • FL_NORMAL_FREE normal event handling.
  • FL_SLEEPING_FREE deactivates event handling (widget is inactive).
  • FL_INPUT_FREE accepts FL_FOCUS events.
  • FL_CONTINUOUS_FREE sets a timeout callback 100 times a second and provides an FL_STEP event. This has obvious detrimental effects on machine performance.
  • FL_ALL_FREE same as FL_INPUT_FREE and FL_CONTINUOUS_FREE.

Definition at line 66 of file Fl_Free.H.


Constructor & Destructor Documentation

Fl_Free::Fl_Free ( uchar  t,
int  X,
int  Y,
int  W,
int  H,
const char *  L,
FL_HANDLEPTR  hdl 
)

Create a new Fl_Free widget with type, position, size, label and handler.

Parameters:
[in]ttype
[in]X,Y,W,Hposition and size
[in]Lwidget label
[in]hdlhandler function

The constructor takes both the type and the handle function. The handle function should be declared as follows:

  int handle_function(Fl_Widget *w,
                      int       event,
                      float     event_x,
                      float     event_y,
                      char      key)

This function is called from the handle() method in response to most events, and is called by the draw() method.

The event argument contains the event type:

  // old event names for compatibility:
  #define FL_MOUSE              FL_DRAG
  #define FL_DRAW               0
  #define FL_STEP               9
  #define FL_FREEMEM            12
  #define FL_FREEZE             FL_UNMAP
  #define FL_THAW               FL_MAP

Definition at line 74 of file forms_free.cxx.

References Fl::add_timeout(), FL_ALL_FREE, FL_CONTINUOUS_FREE, FL_SLEEPING_FREE, Fl_Widget::INACTIVE, Fl_Widget::set_flag(), and Fl_Widget::type().

Fl_Free::~Fl_Free ( )

The destructor will call the handle function with the event FL_FREE_MEM.

Definition at line 87 of file forms_free.cxx.

References FL_FREEMEM, and Fl::remove_timeout().


Member Function Documentation

void Fl_Free::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 92 of file forms_free.cxx.

References FL_DRAW.

int Fl_Free::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 94 of file forms_free.cxx.

References Fl_Widget::do_callback(), Fl::event_button(), Fl::event_key(), Fl::event_x(), Fl::event_y(), FL_ALL_FREE, FL_DRAG, FL_FOCUS, FL_INPUT_FREE, FL_PUSH, FL_RELEASE, FL_SHORTCUT, key, and Fl_Widget::type().


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