diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-05-14 17:46:25 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-05-14 17:46:25 +0200 |
| commit | 79c3db48cf593ccbe64f6c845af0777caebde2a8 (patch) | |
| tree | 42cdb8075c572ae089f3fd596876692ecd4fe978 /FL | |
| parent | ea962375255190b5e641783ff193cff06ff616c6 (diff) | |
New member function Fl_Menu_Bar::play_menu(const char *title)
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Menu_Bar.H | 17 | ||||
| -rw-r--r-- | FL/Fl_Sys_Menu_Bar.H | 1 |
2 files changed, 6 insertions, 12 deletions
diff --git a/FL/Fl_Menu_Bar.H b/FL/Fl_Menu_Bar.H index 450708895..df7097996 100644 --- a/FL/Fl_Menu_Bar.H +++ b/FL/Fl_Menu_Bar.H @@ -61,18 +61,7 @@ Typing the shortcut() of any of the menu items will cause callbacks exactly the same as when you pick the item with the mouse. - - This code can be used to programmatically open a menu ("Edit" in the example) of a menubar : - \code - Fl_Menu_Bar *bar = ……; - const Fl_Menu_Item *v = bar->find_item("Edit"); - if (v) { - v = bar->menu()->pulldown(bar->x(), bar->y(), bar->w(), bar->h(), v, bar, 0, 1); - bar->picked(v); - } - \endcode - This code currently should be avoided with an Fl_Sys_Menu_Bar object on the macOS platform. -*/ + */ class FL_EXPORT Fl_Menu_Bar : public Fl_Menu_ { friend class Fl_Sys_Menu_Bar_Driver; protected: @@ -102,6 +91,10 @@ public: This is useful when the menu bar can be an Fl_Sys_Menu_Bar object. */ virtual void update() {} + /** + Opens the menu named \c title of the menubar. + */ + virtual void play_menu(const char *title); }; #endif diff --git a/FL/Fl_Sys_Menu_Bar.H b/FL/Fl_Sys_Menu_Bar.H index 7045757a6..27bf6a94b 100644 --- a/FL/Fl_Sys_Menu_Bar.H +++ b/FL/Fl_Sys_Menu_Bar.H @@ -111,6 +111,7 @@ public: const Fl_Menu_Item *menu() const {return Fl_Menu_::menu();} void menu(const Fl_Menu_Item *m); void update() FL_OVERRIDE; + void play_menu(const char *title) FL_OVERRIDE; int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0); /** Adds a new menu item. \see Fl_Menu_::add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0) |
