FLTK 1.3.0
Fl_Free Class Reference

Emulation of the Forms "free" widget. More...

#include <Fl_Free.H>

Inheritance diagram for Fl_Free:
Fl_Widget

List of all members.

Public Member Functions

 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.
int handle (int e)
 Handles the specified event.
 ~Fl_Free ()
 The destructor will call the handle function with the event FL_FREE_MEM.

Protected Member Functions

void draw ()
 Draws the widget.

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.

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

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.

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.


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