mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 22:04:26 +08:00
Documentation updates on callbacks and Fl::readqueue().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10677 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+16
-6
@@ -599,6 +599,8 @@ public:
|
|||||||
void user_data(void* v) {user_data_ = v;}
|
void user_data(void* v) {user_data_ = v;}
|
||||||
|
|
||||||
/** Gets the current user data (long) argument that is passed to the callback function.
|
/** Gets the current user data (long) argument that is passed to the callback function.
|
||||||
|
\todo The user data value must be implemented using \em intptr_t or similar
|
||||||
|
to avoid 64-bit machine incompatibilities.
|
||||||
*/
|
*/
|
||||||
long argument() const {return (long)(fl_intptr_t)user_data_;}
|
long argument() const {return (long)(fl_intptr_t)user_data_;}
|
||||||
|
|
||||||
@@ -835,12 +837,20 @@ public:
|
|||||||
*/
|
*/
|
||||||
unsigned int visible_focus() { return flags_ & VISIBLE_FOCUS; }
|
unsigned int visible_focus() { return flags_ & VISIBLE_FOCUS; }
|
||||||
|
|
||||||
/** Sets the default callback for all widgets.
|
/** The default callback for all widgets that don't set a callback.
|
||||||
Sets the default callback, which puts a pointer to the widget on the queue
|
|
||||||
returned by Fl::readqueue(). You may want to call this from your own callback.
|
This callback function puts a pointer to the widget on the queue
|
||||||
\param[in] cb the new callback
|
returned by Fl::readqueue().
|
||||||
\param[in] d user data associated with that callback
|
|
||||||
\see callback(), do_callback(), Fl::readqueue()
|
Relying on the default callback and reading the callback queue with
|
||||||
|
Fl::readqueue() is not recommended. If you need a callback, you should
|
||||||
|
set one with Fl_Widget::callback(Fl_Callback *cb, void *data)
|
||||||
|
or one of its variants.
|
||||||
|
|
||||||
|
\param[in] cb the widget given to the callback
|
||||||
|
\param[in] d user data associated with that callback
|
||||||
|
|
||||||
|
\see callback(), do_callback(), Fl::readqueue()
|
||||||
*/
|
*/
|
||||||
static void default_callback(Fl_Widget *cb, void *d);
|
static void default_callback(Fl_Widget *cb, void *d);
|
||||||
|
|
||||||
|
|||||||
+18
-3
@@ -54,9 +54,24 @@ void Fl_Widget::default_callback(Fl_Widget *o, void * /*v*/) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
All Fl_Widgets that don't have a callback defined use a
|
Reads the default callback queue and returns the first widget.
|
||||||
default callback that puts a pointer to the widget in this queue,
|
|
||||||
and this method reads the oldest widget out of this queue.
|
All Fl_Widgets that don't have a callback defined use the default
|
||||||
|
callback \p static Fl_Widget::default_callback() that puts a pointer
|
||||||
|
to the widget in a queue. This method reads the oldest widget out
|
||||||
|
of this queue.
|
||||||
|
|
||||||
|
The queue (FIFO) is limited (currently 20 items). If the queue
|
||||||
|
overflows, the oldest entry (Fl_Widget *) is discarded.
|
||||||
|
|
||||||
|
Relying on the default callback and reading the callback queue with
|
||||||
|
Fl::readqueue() is not recommended. If you need a callback, you should
|
||||||
|
set one with Fl_Widget::callback(Fl_Callback *cb, void *data)
|
||||||
|
or one of its variants.
|
||||||
|
|
||||||
|
\see Fl_Widget::callback()
|
||||||
|
\see Fl_Widget::callback(Fl_Callback *cb, void *data)
|
||||||
|
\see Fl_Widget::default_callback()
|
||||||
*/
|
*/
|
||||||
Fl_Widget *Fl::readqueue() {
|
Fl_Widget *Fl::readqueue() {
|
||||||
if (obj_tail==obj_head) return 0;
|
if (obj_tail==obj_head) return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user