diff options
Diffstat (limited to 'src/Fl.cxx')
| -rw-r--r-- | src/Fl.cxx | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index 0e5a1b251..de2b869e1 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1519,7 +1519,7 @@ static int max_widget_watch = 0; /** Adds a widget pointer to the widget watch list. - \note Internal use only, please use class Fl_Watch instead. + \note Internal use only, please use class Fl_Widget_Tracker instead. This can be used, if it is possible that a widget might be deleted during a callback or similar function. The widget pointer must be added to the @@ -1556,9 +1556,10 @@ static int max_widget_watch = 0; \see Fl::clear_widget_pointer() An easier and more convenient method to control widget deletion during - callbacks is to use the class Fl_Watch with a local (automatic) variable. + callbacks is to use the class Fl_Widget_Tracker with a local (automatic) + variable. - \see class Fl_Watch + \see class Fl_Widget_Tracker */ void Fl::watch_widget_pointer(Fl_Widget *&w) { @@ -1585,7 +1586,7 @@ void Fl::watch_widget_pointer(Fl_Widget *&w) This is used to remove a widget pointer that has been added to the watch list with Fl::watch_widget_pointer(), when it is not needed anymore. - \note Internal use only, please use class Fl_Watch instead. + \note Internal use only, please use class Fl_Widget_Tracker instead. \see Fl::watch_widget_pointer() */ @@ -1617,14 +1618,16 @@ void Fl::release_widget_pointer(Fl_Widget *&w) This is called when a widget is destroyed (by its destructor). You should never call this directly. - - \note Internal use only, please use class Fl_Watch instead. - - This method searches the widget watch list for pointers to the widget and clears - all pointers that point to it. Widget pointers can be added to the widget - watch list by calling Fl::watch_widget_pointer(). - + + \note Internal use only ! + + This method searches the widget watch list for pointers to the widget and + clears each pointer that points to it. Widget pointers can be added to the + widget watch list by calling Fl::watch_widget_pointer() or by using the + helper class Fl_Widget_Tracker (recommended). + \see Fl::watch_widget_pointer() + \see class Fl_Widget_Tracker */ void Fl::clear_widget_pointer(Fl_Widget const *w) { @@ -1637,12 +1640,12 @@ void Fl::clear_widget_pointer(Fl_Widget const *w) } } -// Helper class Fl_Watch +// Helper class Fl_Widget_Tracker /** The constructor adds a widget to the watch list. */ -Fl_Watch::Fl_Watch(Fl_Widget *wi) { +Fl_Widget_Tracker::Fl_Widget_Tracker(Fl_Widget *wi) { wp_ = wi; Fl::watch_widget_pointer(wp_); // add pointer to watch list @@ -1651,7 +1654,7 @@ Fl_Watch::Fl_Watch(Fl_Widget *wi) { /** The destructor removes a widget from the watch list. */ -Fl_Watch::~Fl_Watch() { +Fl_Widget_Tracker::~Fl_Widget_Tracker() { Fl::release_widget_pointer(wp_); // remove pointer from watch list } |
