summaryrefslogtreecommitdiff
path: root/src/Fl_Widget.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-01-05 13:51:30 +0100
committerGitHub <noreply@github.com>2023-01-05 13:51:30 +0100
commit8826dca1066361b474139bcc5aeed2e3a5246ed0 (patch)
tree6819629ff3f9f014269c7cee090ab20a824af6ad /src/Fl_Widget.cxx
parent4d1a508c7e4d28fd53129da79f068a275d7160bd (diff)
Add close buttons for individual tabs in Fl_Tabs (#628)
Add close buttons for Fl_Tabs Introducing callback reasons FLUID shows all FL_WHEN_... options Adding Fl_Tabs overflow types Improved test/tabs to show new features
Diffstat (limited to 'src/Fl_Widget.cxx')
-rw-r--r--src/Fl_Widget.cxx49
1 files changed, 27 insertions, 22 deletions
diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx
index 1d1b71dc4..f71b27927 100644
--- a/src/Fl_Widget.cxx
+++ b/src/Fl_Widget.cxx
@@ -365,28 +365,33 @@ void Fl_Widget::bind_deimage(Fl_Image* img) {
/** Calls the widget callback function with arbitrary arguments.
- All overloads of do_callback() call this method.
- It does nothing if the widget's callback() is NULL.
- It clears the widget's \e changed flag \b after the callback was
- called unless the callback is the default callback. Hence it is not
- necessary to call clear_changed() after calling do_callback()
- in your own widget's handle() method.
-
- \note It is legal to delete the widget in the callback (i.e. in user code),
- but you must not access the widget in the handle() method after
- calling do_callback() if the widget was deleted in the callback.
- We recommend to use Fl_Widget_Tracker to check whether the widget
- was deleted in the callback.
-
- \param[in] widget call the callback with \p widget as the first argument
- \param[in] arg use \p arg as the user data (second) argument
-
- \see default_callback()
- \see callback()
- \see class Fl_Widget_Tracker
-*/
-
-void Fl_Widget::do_callback(Fl_Widget *widget, void *arg) {
+ All overloads of do_callback() call this method.
+ It does nothing if the widget's callback() is NULL.
+ It clears the widget's \e changed flag \b after the callback was
+ called unless the callback is the default callback. Hence it is not
+ necessary to call clear_changed() after calling do_callback()
+ in your own widget's handle() method.
+
+ A \p reason must be set for widgets if different actions can trigger
+ the same callback.
+
+ \note It is legal to delete the widget in the callback (i.e. in user code),
+ but you must not access the widget in the handle() method after
+ calling do_callback() if the widget was deleted in the callback.
+ We recommend to use Fl_Widget_Tracker to check whether the widget
+ was deleted in the callback.
+
+ \param[in] widget call the callback with \p widget as the first argument
+ \param[in] arg use \p arg as the user data (second) argument
+ \param[in] reason for calling this callback
+
+ \see default_callback()
+ \see callback()
+ \see class Fl_Widget_Tracker
+ \see Fl::callback_reason()
+ */
+void Fl_Widget::do_callback(Fl_Widget *widget, void *arg, Fl_Callback_Reason reason) {
+ Fl::callback_reason_ = reason;
if (!callback_) return;
Fl_Widget_Tracker wp(this);
callback_(widget, arg);