diff options
| author | Matthias Melcher <github@matthiasm.com> | 2025-04-01 17:00:51 +0200 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2025-04-01 17:00:56 +0200 |
| commit | f4978a014997656b4592c2b3b866865f76d390ea (patch) | |
| tree | 13a365c34b705942195c75fd3186801976786070 /src/Fl_Menu_.cxx | |
| parent | 0eb6bb8e6d34b39399cda8b768851a3218eb7e2c (diff) | |
Adding the FL_MENU_CHATTY flag to Fl_Menu_Item.
If set, menu items will also call the callback when highlighting changes.
The reason is given with Fl::callback_reason(). #941
Diffstat (limited to 'src/Fl_Menu_.cxx')
| -rw-r--r-- | src/Fl_Menu_.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Fl_Menu_.cxx b/src/Fl_Menu_.cxx index 20964e748..6a34278ff 100644 --- a/src/Fl_Menu_.cxx +++ b/src/Fl_Menu_.cxx @@ -401,8 +401,11 @@ const Fl_Menu_Item* Fl_Menu_::picked(const Fl_Menu_Item* v) { value_ = v; if (when()&(FL_WHEN_CHANGED|FL_WHEN_RELEASE)) { if (changed() || when()&FL_WHEN_NOT_CHANGED) { - if (value_ && value_->callback_) value_->do_callback((Fl_Widget*)this); - else do_callback(); + if (value_ && value_->callback_) { + value_->do_callback((Fl_Widget*)this, value_->user_data(), FL_REASON_SELECTED); + } else { + do_callback(FL_REASON_SELECTED); + } } } } |
