Events handling functions

Fl class events handling API declared in <FL/Fl.H> More...

## Functions

static void | Fl::add_handler (Fl_Event_Handler h)
| Install a function to parse unrecognized events. More...
static Fl_Widget * | Fl::belowmouse ()
| Gets the widget that is below the mouse. More...
static void | Fl::belowmouse (Fl_Widget *)
| Sets the widget that is below the mouse. More...
static int | Fl::compose (int &del)
| Any text editing widget should call this for each FL_KEYBOARD event. More...
static void | Fl::compose_reset ()
| If the user moves the cursor, be sure to call Fl::compose_reset(). More...
static int | Fl::event ()
| Returns the last event that was processed. More...
static int | Fl::event_alt ()
| Returns non-zero if the Alt key is pressed. More...
static int | Fl::event_button ()
| Gets which particular mouse button caused the current event. More...
static int | Fl::event_button1 ()
| Returns non-zero if mouse button 1 is currently held down. More...
static int | Fl::event_button2 ()
| Returns non-zero if button 2 is currently held down. More...
static int | Fl::event_button3 ()
| Returns non-zero if button 3 is currently held down. More...
static int | Fl::event_buttons ()
| Returns the mouse buttons state bits; if non-zero, then at least one button is pressed now. More...
static int | Fl::event_clicks ()
| Returns non zero if we had a double click event. More...
static void | Fl::event_clicks (int i)
| Manually sets the number returned by Fl::event_clicks(). More...
static int | Fl::event_command ()
| Returns non-zero if the FL_COMMAND key is pressed, either FL_CTRL or on OSX FL_META. More...
static int | Fl::event_ctrl ()
| Returns non-zero if the Control key is pressed. More...
static void | Fl::event_dispatch (Fl_Event_Dispatch d)
| Set a new event dispatch function. More...
static Fl_Event_Dispatch | Fl::event_dispatch ()
| Return the current event dispatch function.
static int | Fl::event_dx ()
| Returns the current horizontal mouse scrolling associated with the FL_MOUSEWHEEL event. More...
static int | Fl::event_dy ()
| Returns the current vertical mouse scrolling associated with the FL_MOUSEWHEEL event. More...
static int | Fl::event_inside (int, int, int, int)
| Returns whether or not the mouse event is inside the given rectangle. More...
static int | Fl::event_inside (const Fl_Widget *)
| Returns whether or not the mouse event is inside a given child widget. More...
static int | Fl::event_is_click ()
| Returns non-zero if the mouse has not moved far enough and not enough time has passed since the last FL_PUSH or FL_KEYBOARD event for it to be considered a "drag" rather than a "click". More...
static void | Fl::event_is_click (int i)
| Clears the value returned by Fl::event_is_click(). More...
static int | Fl::event_key ()
| Gets which key on the keyboard was last pushed. More...
static int | Fl::event_key (int key)
| Returns true if the given `key` was held down (or pressed) during the last event. More...
static int | Fl::event_length ()
| Returns the length of the text in Fl::event_text(). More...
static int | Fl::event_original_key ()
| Returns the keycode of the last key event, regardless of the NumLock state. More...
static int | Fl::event_shift ()
| Returns non-zero if the Shift key is pressed. More...
static int | Fl::event_state ()
| This is a bitfield of what shift states were on and what mouse buttons were held down during the most recent event. More...
static int | Fl::event_state (int i)
| See int event_state()
static const char * | Fl::event_text ()
| Returns the text associated with the current event, including FL_PASTE or FL_DND_RELEASE events. More...
static int | Fl::event_x ()
| Returns the mouse position of the event relative to the Fl_Window it was passed to.
static int | Fl::event_x_root ()
| Returns the mouse position on the screen of the event. More...
static int | Fl::event_y ()
| Returns the mouse position of the event relative to the Fl_Window it was passed to.
static int | Fl::event_y_root ()
| Returns the mouse position on the screen of the event. More...
static Fl_Widget * | Fl::focus ()
| Gets the current Fl::focus() widget. More...
static void | Fl::focus (Fl_Widget *)
| Sets the widget that will receive FL_KEYBOARD events. More...
static int | Fl::get_key (int key)
| Returns true if the given `key` is held down now. More...
static void | Fl::get_mouse (int &, int &)
| Return where the mouse is on the screen by doing a round-trip query to the server. More...
static int | Fl::handle (int, Fl_Window *)
| Handle events from the window system. More...
static int | Fl::handle_ (int, Fl_Window *)
| Handle events from the window system. More...
static Fl_Widget * | Fl::pushed ()
| Gets the widget that is being pushed. More...
static void | Fl::pushed (Fl_Widget *)
| Sets the widget that is being pushed. More...
static void | Fl::remove_handler (Fl_Event_Handler h)
| Removes a previously added event handler. More...
static int | Fl::test_shortcut (Fl_Shortcut)
| Tests the current event, which must be an FL_KEYBOARD or FL_SHORTCUT, against a shortcut value (described in Fl_Button). More...

## Variables

const char *const | fl_eventnames []
| This is an array of event names you can use to convert event numbers into names. More...
const char *const | fl_fontnames []
| This is an array of font names you can use to convert font numbers into names. More...

## Detailed Description

Fl class events handling API declared in <FL/Fl.H>

## Function Documentation

void Fl::add_handler | ( | Fl_Event_Handler | ha | ) |

static

Install a function to parse unrecognized events.

If FLTK cannot figure out what to do with an event, it calls each of these functions (most recent first) until one of them returns non-zero. If none of them returns non-zero then the event is ignored. Events that cause this to be called are:

- FL_SHORTCUT events that are not recognized by any widget. This lets you provide global shortcut keys.
- FL_SCREEN_CONFIGURATION_CHANGED events. Under X11, this event requires the libXrandr.so shared library to be loadable at run-time and the X server to implement the RandR extension.
- FL_FULLSCREEN events sent to a window that enters of leaves fullscreen mode.
- System events that FLTK does not recognize. See fl_xevent.
- Some other events when the widget FLTK selected returns zero from its handle() method. Exactly which ones may change in future versions, however.

See Also
  Fl::remove_handler(Fl_Event_Handler)
  Fl::event_dispatch(Fl_Event_Dispatch d)
  Fl::handle(int, Fl_Window*)

static Fl_Widget* Fl::belowmouse | ( |  | ) |

inlinestatic

Gets the widget that is below the mouse.

See Also
  belowmouse(Fl_Widget*)

void Fl::belowmouse | ( | Fl_Widget * | o | ) |

static

Sets the widget that is below the mouse.

This is for highlighting buttons. It is not used to send FL_PUSH or FL_MOVE directly, for several obscure reasons, but those events typically go to this widget. This is also the first widget tried for FL_SHORTCUT events.

If you change the belowmouse widget, the previous one and all parents (that don't contain the new widget) are sent FL_LEAVE events. Changing this does not send FL_ENTER to this or any widget, because sending FL_ENTER is supposed to test if the widget wants the mouse (by it returning non-zero from handle()).

int Fl::compose | ( | int & | del | ) |

static

Any text editing widget should call this for each FL_KEYBOARD event.

Use of this function is very simple.

If true is returned, then it has modified the Fl::event_text() and Fl::event_length() to a set of bytes to insert (it may be of zero length!). In will also set the "del" parameter to the number of bytes to the left of the cursor to delete, this is used to delete the results of the previous call to Fl::compose().

If false is returned, the keys should be treated as function keys, and del is set to zero. You could insert the text anyways, if you don't know what else to do.

On the Mac OS platform, text input can involve marked text, that is, temporary text replaced by other text during the input process. This occurs, e.g., when using dead keys or when entering CJK characters. Text editing widgets should preferentially signal marked text, usually underlining it. Widgets can use `int Fl::compose_state` after having called Fl::compose(int&) to obtain the length in bytes of marked text that always finishes at the current insertion point. It's the widget's task to underline marked text. Widgets should also call `void Fl::reset_marked_text()` when processing FL_UNFOCUS events. Optionally, widgets can also call `void Fl::insertion_point_location(int x, int y, int height)` to indicate the window coordinates of the bottom of the current insertion point and the line height. This way, auxiliary windows that help choosing among alternative characters appear just below the insertion point. If widgets don't do that, auxiliary windows appear at the widget's bottom. The Fl_Input and Fl_Text_Editor widgets underline marked text. If none of this is done by a user-defined text editing widget, text input will work, but will not signal to the user what text is marked. Finally, text editing widgets should call `set_flag(MAC_USE_ACCENTS_MENU);` in their constructor if they want to use the feature introduced with Mac OS 10.7 "Lion" where pressing and holding a key on the keyboard opens an accented-character menu window.

Though the current implementation returns immediately, future versions may take quite awhile, as they may pop up a window or do other user-interface things to allow characters to be selected.

void Fl::compose_reset | ( |  | ) |

static

If the user moves the cursor, be sure to call Fl::compose_reset().

The next call to Fl::compose() will start out in an initial state. In particular it will not set "del" to non-zero. This call is very fast so it is ok to call it many times and in many places.

static int Fl::event | ( |  | ) |

inlinestatic

Returns the last event that was processed.

This can be used to determine if a callback is being done in response to a keypress, mouse click, etc.

static int Fl::event_alt | ( |  | ) |

inlinestatic

Returns non-zero if the Alt key is pressed.

static int Fl::event_button | ( |  | ) |

inlinestatic

Gets which particular mouse button caused the current event.

This returns garbage if the most recent event was not a FL_PUSH or FL_RELEASE event.

Return values

  FL_LEFT_MOUSE\retval | FL_MIDDLE_MOUSE
  FL_RIGHT_MOUSE. |

See Also
  Fl::event_buttons()

static int Fl::event_button1 | ( |  | ) |

inlinestatic

Returns non-zero if mouse button 1 is currently held down.

For more details, see Fl::event_buttons().

static int Fl::event_button2 | ( |  | ) |

inlinestatic

Returns non-zero if button 2 is currently held down.

For more details, see Fl::event_buttons().

static int Fl::event_button3 | ( |  | ) |

inlinestatic

Returns non-zero if button 3 is currently held down.

For more details, see Fl::event_buttons().

static int Fl::event_buttons | ( |  | ) |

inlinestatic

Returns the mouse buttons state bits; if non-zero, then at least one button is pressed now.

This function returns the button state at the time of the event. During an FL_RELEASE event, the state of the released button will be 0. To find out, which button caused an FL_RELEASE event, you can use Fl::event_button() instead.

Returns
  a bit mask value like { [FL_BUTTON1] | [FL_BUTTON2] | [FL_BUTTON3] }

static int Fl::event_clicks | ( |  | ) |

inlinestatic

Returns non zero if we had a double click event.

Return values

  Non-zero | if the most recent FL_PUSH or FL_KEYBOARD was a "double click".
  N-1 | for N clicks. A double click is counted if the same button is pressed again while event_is_click() is true.

static void Fl::event_clicks | ( | int | i | ) |

inlinestatic

Manually sets the number returned by Fl::event_clicks().

This can be used to set it to zero so that later code does not think an item was double-clicked.

Parameters

  [in] | i | corresponds to no double-click if 0, i+1 mouse clicks otherwise

See Also
  int event_clicks()

static int Fl::event_command | ( |  | ) |

inlinestatic

Returns non-zero if the FL_COMMAND key is pressed, either FL_CTRL or on OSX FL_META.

static int Fl::event_ctrl | ( |  | ) |

inlinestatic

Returns non-zero if the Control key is pressed.

void Fl::event_dispatch | ( | Fl_Event_Dispatch | d | ) |

static

Set a new event dispatch function.

The event dispatch function is called after native events are converted to FLTK events, but before they are handled by FLTK. If the dispatch function Fl_Event_Dispatch `d` is set, it is up to the dispatch function to call Fl::handle_(int, Fl_Window*) or to ignore the event.

The dispatch function itself must return 0 if it ignored the event, or non-zero if it used the event. If you call Fl::handle_(), then this will return the correct value.

The event dispatch can be used to handle exceptions in FLTK events and callbacks before they reach the native event handler:

int myHandler(int e, Fl_Window *w) {
try {
return Fl::handle_(e, w);
} catch () {
...
}
}
main() {
Fl::event_dispatch(myHandler);
...
Fl::run();
}

Parameters

  d | new dispatch function, or NULL

See Also
  Fl::add_handler(Fl_Event_Handler)
  Fl::handle(int, Fl_Window*)
  Fl::handle_(int, Fl_Window*)

static int Fl::event_dx | ( |  | ) |

inlinestatic

Returns the current horizontal mouse scrolling associated with the FL_MOUSEWHEEL event.

Right is positive.

static int Fl::event_dy | ( |  | ) |

inlinestatic

Returns the current vertical mouse scrolling associated with the FL_MOUSEWHEEL event.

Down is positive.

int Fl::event_inside | ( | int | xx,
|  | int | yy,
|  | int | ww,
|  | int | hh
| ) |  |

static

Returns whether or not the mouse event is inside the given rectangle.

Returns non-zero if the current Fl::event_x() and Fl::event_y() put it inside the given arbitrary bounding box.

You should always call this rather than doing your own comparison so you are consistent about edge effects.

To find out, whether the event is inside a child widget of the current window, you can use Fl::event_inside(const Fl_Widget *).

Parameters

  [in] | xx,yy,ww,hh | bounding box

Returns
  non-zero, if mouse event is inside

int Fl::event_inside | ( | const Fl_Widget * | o | ) |

static

Returns whether or not the mouse event is inside a given child widget.

Returns non-zero if the current Fl::event_x() and Fl::event_y() put it inside the given child widget's bounding box.

This method can only be used to check whether the mouse event is inside a child widget of the window that handles the event, and there must not be an intermediate subwindow (i.e. the widget must not be inside a subwindow of the current window). However, it is valid if the widget is inside a nested Fl_Group.

You must not use it with the window itself as the `o` argument in a window's handle() method.

Note
  The mentioned restrictions are necessary, because this method does not transform coordinates of child widgets, and thus the given widget `o` must be within the same window that is handling the current event. Otherwise the results are undefined.

You should always call this rather than doing your own comparison so you are consistent about edge effects.

See Also
  Fl::event_inside(int, int, int, int)

Parameters

  [in] | o | child widget to be tested

Returns
  non-zero, if mouse event is inside the widget

static int Fl::event_is_click | ( |  | ) |

inlinestatic

Returns non-zero if the mouse has not moved far enough and not enough time has passed since the last FL_PUSH or FL_KEYBOARD event for it to be considered a "drag" rather than a "click".

You can test this on FL_DRAG, FL_RELEASE, and FL_MOVE events.

static void Fl::event_is_click | ( | int | i | ) |

inlinestatic

Clears the value returned by Fl::event_is_click().

Useful to prevent the next click from being counted as a double-click or to make a popup menu pick an item with a single click. Don't pass non-zero to this.

static int Fl::event_key | ( |  | ) |

inlinestatic

Gets which key on the keyboard was last pushed.

The returned integer 'key code' is not necessarily a text equivalent for the keystroke. For instance: if someone presses '5' on the numeric keypad with numlock on, Fl::event_key() may return the 'key code' for this key, and NOT the character '5'. To always get the '5', use Fl::event_text() instead.

Returns
  an integer 'key code', or 0 if the last event was not a key press or release.

See Also
  int event_key(int), event_text(), compose(int&).

int Fl::event_key | ( | int | key | ) |

static

Returns true if the given `key` was held down (or pressed) during the last event.

This is constant until the next event is read from the server.

Fl::get_key(int) returns true if the given key is held down now. Under X this requires a round-trip to the server and is much slower than Fl::event_key(int).

Keys are identified by the unshifted values. FLTK defines a set of symbols that should work on most modern machines for every key on the keyboard:

- All keys on the main keyboard producing a printable ASCII character use the value of that ASCII character (as though shift, ctrl, and caps lock were not on). The space bar is 32.
- All keys on the numeric keypad producing a printable ASCII character use the value of that ASCII character plus FL_KP. The highest possible value is FL_KP_Last so you can range-check to see if something is on the keypad.
- All numbered function keys use the number on the function key plus FL_F. The highest possible number is FL_F_Last, so you can range-check a value.
- Buttons on the mouse are considered keys, and use the button number (where the left button is 1) plus FL_Button.
- All other keys on the keypad have a symbol: FL_Escape, FL_BackSpace, FL_Tab, FL_Enter, FL_Print, FL_Scroll_Lock, FL_Pause, FL_Insert, FL_Home, FL_Page_Up, FL_Delete, FL_End, FL_Page_Down, FL_Left, FL_Up, FL_Right, FL_Down, FL_Iso_Key, FL_Shift_L, FL_Shift_R, FL_Control_L, FL_Control_R, FL_Caps_Lock, FL_Alt_L, FL_Alt_R, FL_Meta_L, FL_Meta_R, FL_Menu, FL_Num_Lock, FL_KP_Enter. Be careful not to confuse these with the very similar, but all-caps, symbols used by Fl::event_state().

On X Fl::get_key(FL_Button+n) does not work.

On WIN32 Fl::get_key(FL_KP_Enter) and Fl::event_key(FL_KP_Enter) do not work.

static int Fl::event_length | ( |  | ) |

inlinestatic

Returns the length of the text in Fl::event_text().

There will always be a nul at this position in the text. However there may be a nul before that if the keystroke translates to a nul character or you paste a nul character.

static int Fl::event_original_key | ( |  | ) |

inlinestatic

Returns the keycode of the last key event, regardless of the NumLock state.

If NumLock is deactivated, FLTK translates events from the numeric keypad into the corresponding arrow key events. event_key() returns the translated key code, whereas event_original_key() returns the keycode before NumLock translation.

static int Fl::event_shift | ( |  | ) |

inlinestatic

Returns non-zero if the Shift key is pressed.

static int Fl::event_state | ( |  | ) |

inlinestatic

This is a bitfield of what shift states were on and what mouse buttons were held down during the most recent event.

The second version returns non-zero if any of the passed bits are turned on. The legal bits are:

- FL_SHIFT
- FL_CAPS_LOCK
- FL_CTRL
- FL_ALT
- FL_NUM_LOCK
- FL_META
- FL_SCROLL_LOCK
- FL_BUTTON1
- FL_BUTTON2
- FL_BUTTON3

X servers do not agree on shift states, and FL_NUM_LOCK, FL_META, and FL_SCROLL_LOCK may not work. The values were selected to match the XFree86 server on Linux. In addition there is a bug in the way X works so that the shift state is not correctly reported until the first event after the shift key is pressed or released.

static const char* Fl::event_text | ( |  | ) |

inlinestatic

Returns the text associated with the current event, including FL_PASTE or FL_DND_RELEASE events.

This can be used in response to FL_KEYUP, FL_KEYDOWN, FL_PASTE, and FL_DND_RELEASE.

When responding to FL_KEYUP/FL_KEYDOWN, use this function instead of Fl::event_key() to get the text equivalent of keystrokes suitable for inserting into strings and text widgets.

The returned string is guaranteed to be NULL terminated. However, see Fl::event_length() for the actual length of the string, in case the string itself contains NULLs that are part of the text data.

Returns
  A NULL terminated text string equivalent of the last keystroke.

static int Fl::event_x_root | ( |  | ) |

inlinestatic

Returns the mouse position on the screen of the event.

To find the absolute position of an Fl_Window on the screen, use the difference between event_x_root(),event_y_root() and event_x(),event_y().

static int Fl::event_y_root | ( |  | ) |

inlinestatic

Returns the mouse position on the screen of the event.

To find the absolute position of an Fl_Window on the screen, use the difference between event_x_root(),event_y_root() and event_x(),event_y().

static Fl_Widget* Fl::focus | ( |  | ) |

inlinestatic

Gets the current Fl::focus() widget.

See Also
  Fl::focus(Fl_Widget*)

void Fl::focus | ( | Fl_Widget * | o | ) |

static

Sets the widget that will receive FL_KEYBOARD events.

If you change Fl::focus(), the previous widget and all parents (that don't contain the new widget) are sent FL_UNFOCUS events. Changing the focus does not send FL_FOCUS to this or any widget, because sending FL_FOCUS is supposed to test if the widget wants the focus (by it returning non-zero from handle()).

See Also
  Fl_Widget::take_focus()

int Fl::get_key | ( | int | key | ) |

static

Returns true if the given `key` is held down now.

Under X this requires a round-trip to the server and is much slower than Fl::event_key(int).

See Also
  event_key(int)

static void Fl::get_mouse | ( | int & | ,
|  | int & |
| ) |  |

static

Return where the mouse is on the screen by doing a round-trip query to the server.

You should use Fl::event_x_root() and Fl::event_y_root() if possible, but this is necessary if you are not sure if a mouse event has been processed recently (such as to position your first window). If the display is not open, this will open it.

int Fl::handle | ( | int | e,
|  | Fl_Window * | window
| ) |  |

static

Handle events from the window system.

This is called from the native event dispatch after native events have been converted to FLTK notation. This function calls Fl::handle_(int, Fl_Window*) unless the user sets a dispatch function. If a user dispatch function is set, the user must make sure that Fl::handle_() is called, or the event will be ignored.

Parameters

  e | the event type (Fl::event_number() is not yet set)
  window | the window that caused this event

Returns
  0 if the event was not handled

See Also
  Fl::add_handler(Fl_Event_Handler)
  Fl::event_dispatch(Fl_Event_Dispatch)

int Fl::handle_ | ( | int | e,
|  | Fl_Window * | window
| ) |  |

static

Handle events from the window system.

This function is called from the native event dispatch, unless the user sets another dispatch function. In that case, the user dispatch function must decide when to call Fl::handle_(int, Fl_Window*)

Parameters

  e | the event type (Fl::event_number() is not yet set)
  window | the window that caused this event

Returns
  0 if the event was not handled

See Also
  Fl::event_dispatch(Fl_Event_Dispatch)

static Fl_Widget* Fl::pushed | ( |  | ) |

inlinestatic

Gets the widget that is being pushed.

See Also
  void pushed(Fl_Widget*)

void Fl::pushed | ( | Fl_Widget * | o | ) |

static

Sets the widget that is being pushed.

FL_DRAG or FL_RELEASE (and any more FL_PUSH) events will be sent to this widget.

If you change the pushed widget, the previous one and all parents (that don't contain the new widget) are sent FL_RELEASE events. Changing this does not send FL_PUSH to this or any widget, because sending FL_PUSH is supposed to test if the widget wants the mouse (by it returning non-zero from handle()).

void Fl::remove_handler | ( | Fl_Event_Handler | ha | ) |

static

Removes a previously added event handler.

See Also
  Fl::handle(int, Fl_Window*)

int Fl::test_shortcut | ( | Fl_Shortcut | shortcut | ) |

static

Tests the current event, which must be an FL_KEYBOARD or FL_SHORTCUT, against a shortcut value (described in Fl_Button).

Not to be confused with Fl_Widget::test_shortcut().

Returns
  non-zero if there is a match.

## Variable Documentation

const char* const fl_eventnames[]

Initial value:
=
{
"FL_NO_EVENT",
"FL_PUSH",
"FL_RELEASE",
"FL_ENTER",
"FL_LEAVE",
"FL_DRAG",
"FL_FOCUS",
"FL_UNFOCUS",
"FL_KEYDOWN",
"FL_KEYUP",
"FL_CLOSE",
"FL_MOVE",
"FL_SHORTCUT",
"FL_DEACTIVATE",
"FL_ACTIVATE",
"FL_HIDE",
"FL_SHOW",
"FL_PASTE",
"FL_SELECTIONCLEAR",
"FL_MOUSEWHEEL",
"FL_DND_ENTER",
"FL_DND_DRAG",
"FL_DND_LEAVE",
"FL_DND_RELEASE",
"FL_SCREEN_CONFIGURATION_CHANGED",
"FL_FULLSCREEN"
}

This is an array of event names you can use to convert event numbers into names.

The array gets defined inline wherever your '#include <FL/names.h>' appears.

Example:

#include <FL/names.h> // array will be defined here
int MyClass::handle(int e) {
printf("Event was %s (%d)\n", fl_eventnames[e], e);
// ..resulting output might be e.g. "Event was FL_PUSH (1)"..
[..]
}

const char* const fl_fontnames[]

Initial value:
=
{
"FL_HELVETICA",
"FL_HELVETICA_BOLD",
"FL_HELVETICA_ITALIC",
"FL_HELVETICA_BOLD_ITALIC",
"FL_COURIER",
"FL_COURIER_BOLD",
"FL_COURIER_ITALIC",
"FL_COURIER_BOLD_ITALIC",
"FL_TIMES",
"FL_TIMES_BOLD",
"FL_TIMES_ITALIC",
"FL_TIMES_BOLD_ITALIC",
"FL_SYMBOL",
"FL_SCREEN",
"FL_SCREEN_BOLD",
"FL_ZAPF_DINGBATS",
}

This is an array of font names you can use to convert font numbers into names.

The array gets defined inline wherever your '#include <FL/names.h>' appears.

Example:

#include <FL/names.h> // array will be defined here
int MyClass::my_callback(Fl_Widget *w, void*) {
int fnum = w->labelfont();
// Resulting output might be e.g. "Label's font is FL_HELVETICA (0)"
printf("Label's font is %s (%d)\n", fl_fontnames[fnum], fnum);
// ..resulting output might be e.g. "Label's font is FL_HELVETICA (0)"..
[..]
}
- © 1998-2012 by Bill Spitzak and others.