diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-01-05 13:51:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-05 13:51:30 +0100 |
| commit | 8826dca1066361b474139bcc5aeed2e3a5246ed0 (patch) | |
| tree | 6819629ff3f9f014269c7cee090ab20a824af6ad /src/Fl_Button.cxx | |
| parent | 4d1a508c7e4d28fd53129da79f068a275d7160bd (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_Button.cxx')
| -rw-r--r-- | src/Fl_Button.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx index 1651d08f5..dec92d483 100644 --- a/src/Fl_Button.cxx +++ b/src/Fl_Button.cxx @@ -100,12 +100,12 @@ int Fl_Button::handle(int event) { value_ = newval; set_changed(); redraw(); - if (when() & FL_WHEN_CHANGED) do_callback(); + if (when() & FL_WHEN_CHANGED) do_callback(FL_REASON_CHANGED); } return 1; case FL_RELEASE: if (value_ == oldval) { - if (when() & FL_WHEN_NOT_CHANGED) do_callback(); + if (when() & FL_WHEN_NOT_CHANGED) do_callback(FL_REASON_SELECTED); return 1; } set_changed(); @@ -116,11 +116,11 @@ int Fl_Button::handle(int event) { set_changed(); if (when() & FL_WHEN_CHANGED) { Fl_Widget_Tracker wp(this); - do_callback(); + do_callback(FL_REASON_CHANGED); if (wp.deleted()) return 1; } } - if (when() & FL_WHEN_RELEASE) do_callback(); + if (when() & FL_WHEN_RELEASE) do_callback(FL_REASON_RELEASED); return 1; case FL_SHORTCUT: if (!(shortcut() ? @@ -150,16 +150,16 @@ int Fl_Button::handle(int event) { if (type() == FL_RADIO_BUTTON) { if (!value_) { setonly(); - if (when() & FL_WHEN_CHANGED) do_callback(); + if (when() & FL_WHEN_CHANGED) do_callback(FL_REASON_CHANGED); } } else if (type() == FL_TOGGLE_BUTTON) { value(!value()); - if (when() & FL_WHEN_CHANGED) do_callback(); + if (when() & FL_WHEN_CHANGED) do_callback(FL_REASON_CHANGED); } else { simulate_key_action(); } if (wp.deleted()) return 1; - if (when() & FL_WHEN_RELEASE) do_callback(); + if (when() & FL_WHEN_RELEASE) do_callback(FL_REASON_RELEASED); return 1; } /* FALLTHROUGH */ @@ -206,6 +206,11 @@ void Fl_Button::key_release_timeout(void *d) Derived classes may handle this differently. + A button may reequest callbacks with \p whne() \p FL_WHEN_CHANGED, + \p FL_WHEN_NOT_CHANGED, and \p FL_WHEN_RELEASE, triggering the callback + reasons \p FL_REASON_CHANGED, \p FL_REASON_SELECTED, + and \p FL_REASON_DESELECTED. + \param[in] X, Y, W, H position and size of the widget \param[in] L widget label, default is no label */ |
