diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-05-13 12:46:47 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-05-13 12:46:47 +0200 |
| commit | 4eb98c0af4815c69a13da0bbb5d966c8ece8400a (patch) | |
| tree | d868a8b7914c98be106abbc72b88b623ac56f1bf /FL/Fl_Menu_Bar.H | |
| parent | 6c06e953e100f00da08b7f3f67c01d47e96ab978 (diff) | |
Fl_Menu_Bar: document how to programmatically open menu from menubar
Diffstat (limited to 'FL/Fl_Menu_Bar.H')
| -rw-r--r-- | FL/Fl_Menu_Bar.H | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/FL/Fl_Menu_Bar.H b/FL/Fl_Menu_Bar.H index 3157519ac..5e6d9d170 100644 --- a/FL/Fl_Menu_Bar.H +++ b/FL/Fl_Menu_Bar.H @@ -61,6 +61,17 @@ 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; @@ -91,6 +102,7 @@ public: This is useful when the menu bar can be an Fl_Sys_Menu_Bar object. */ virtual void update() {} + virtual void play_menu(const char *menu_name); }; #endif |
