summaryrefslogtreecommitdiff
path: root/FL/Fl_Widget.H
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2009-02-08 14:44:15 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2009-02-08 14:44:15 +0000
commit9f1eeaee19576584fab930b6d407d0c5b307dacb (patch)
tree8c3df25fb2177c024cc7fcd50918748d90699409 /FL/Fl_Widget.H
parentb30b9e170a0961493c1b256d9c53a1e8309f52b1 (diff)
Added the helper class Fl_Watch to simplify safe handling of widget deletion
in callbacks. This is used e.g. in Fl_Widget::do_callback() to prevent accessing widgets after deletion in the callback. Documentation adjusted, Fl_Menu_Button.cxx changed to use Fl_Watch instead of Fl::watch_widget_pointer. Fl::watch_widget_pointer() and Fl::release_widget_pointer() have been modified to use an array without "holes" (NULL pointers) for storing the widget pointers for faster access: Fl::release_widget_pointer() now shifts pointers to close gaps of freed pointers. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6651 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Widget.H')
-rw-r--r--FL/Fl_Widget.H19
1 files changed, 5 insertions, 14 deletions
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H
index f8d3fa4ed..7fe67ce11 100644
--- a/FL/Fl_Widget.H
+++ b/FL/Fl_Widget.H
@@ -793,29 +793,20 @@ public:
static void default_callback(Fl_Widget *cb, void *d);
/** Calls the widget callback.
- Causes a widget to invoke its callback function, optionally
- with arbitrary arguments.
+ Causes a widget to invoke its callback function with default arguments.
\see callback()
*/
- void do_callback() {callback_(this,user_data_); if (callback_ != default_callback) clear_changed();}
+ void do_callback() {do_callback(this,user_data_);}
/** Calls the widget callback.
- Causes a widget to invoke its callback function, optionally
- with arbitrary arguments.
+ Causes a widget to invoke its callback function with arbitrary arguments.
\param[in] o call the callback with \em o as the widget argument
\param[in] arg call the callback with \em arg as the user data argument
\see callback()
*/
- void do_callback(Fl_Widget* o,void* arg=0) {callback_(o,arg); if (callback_ != default_callback) clear_changed();}
+ void do_callback(Fl_Widget* o,long arg) {do_callback(o,(void*)arg);}
- /** Calls the widget callback.
- Causes a widget to invoke its callback function, optionally
- with arbitrary arguments.
- \param[in] o call the callback with \em o as the widget argument
- \param[in] arg call the callback with \em arg as the user data argument
- \see callback()
- */
- void do_callback(Fl_Widget* o,long arg) {callback_(o,(void*)arg); if (callback_ != default_callback) clear_changed();}
+ void do_callback(Fl_Widget* o,void* arg=0); // impl. in Fl_Widget.cxx
/** Internal use only. */
int test_shortcut();