mirror of
https://github.com/fltk/fltk.git
synced 2026-06-07 17:35:39 +08:00
doc mods to support fl_eventnames[].
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7157 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+4
-5
@@ -42,10 +42,9 @@
|
||||
\b Example:
|
||||
\code
|
||||
#include <FL/names.h> // array will be defined here
|
||||
// MyWidget's event handler
|
||||
int MyWidget::handle(int e) {
|
||||
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)".. */
|
||||
// ..resulting output might be e.g. "Event was FL_PUSH (1)"..
|
||||
[..]
|
||||
}
|
||||
\endcode
|
||||
@@ -86,11 +85,11 @@ const char * const fl_eventnames[] =
|
||||
\b Example:
|
||||
\code
|
||||
#include <FL/names.h> // array will be defined here
|
||||
int MyWidget::my_callback(Fl_Widget *w, void*) {
|
||||
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)".. */
|
||||
// ..resulting output might be e.g. "Label's font is FL_HELVETICA (0)"..
|
||||
[..]
|
||||
}
|
||||
\endcode
|
||||
|
||||
@@ -25,6 +25,9 @@ of the
|
||||
\p handle()
|
||||
method.
|
||||
|
||||
Event numbers can be converted to their actual names using the \ref fl_eventnames[] array
|
||||
defined in \#include <FL/names.h>; see next chapter for details.
|
||||
|
||||
In the next chapter, the
|
||||
\ref subclassing_events "MyClass::handle()"
|
||||
example shows how to override the
|
||||
|
||||
@@ -302,6 +302,16 @@ You must return non-zero if your \p handle() method
|
||||
uses the event. If you return zero, the parent widget will try
|
||||
sending the event to another widget.
|
||||
|
||||
For debugging purposes, event numbers can be printed as their actual event names
|
||||
using the fl_eventnames[] array, e.g.:
|
||||
\code
|
||||
#include <FL/names.h> // defines fl_eventnames[]
|
||||
[..]
|
||||
int MyClass::handle(int e) {
|
||||
printf("Event was %s (%d)\n", fl_eventnames[e], e); // e.g. "Event was FL_PUSH (1)"
|
||||
[..]
|
||||
\endcode
|
||||
|
||||
\section subclassing_drawing Drawing the Widget
|
||||
|
||||
The \p draw() virtual method is called when FLTK wants
|
||||
|
||||
Reference in New Issue
Block a user