diff options
| author | Greg Ercolano <erco@seriss.com> | 2019-06-06 11:09:29 -0700 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2019-06-06 11:09:29 -0700 |
| commit | bca3ae0b173f2c3ba24b0aa5e4c8fe10e0c1754c (patch) | |
| tree | a6a587f50a1452df39b023f03b9ac6f3759c5bd9 /FL | |
| parent | 94fffb701ce88adf7398fb37a007a04c08f1ca6f (diff) | |
Added example for mac Application -> Preferences
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Sys_Menu_Bar.H | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/FL/Fl_Sys_Menu_Bar.H b/FL/Fl_Sys_Menu_Bar.H index ecf72ff15..23c8fc0ab 100644 --- a/FL/Fl_Sys_Menu_Bar.H +++ b/FL/Fl_Sys_Menu_Bar.H @@ -30,9 +30,10 @@ class Fl_Sys_Menu_Bar_Driver; /** A class to create and modify menus that appear on Mac OS X in the menu bar at the top of the screen. - To use this class, just replace Fl_Menu_Bar by Fl_Sys_Menu_Bar, and, on the Mac platform, + To use this class, just replace Fl_Menu_Bar with Fl_Sys_Menu_Bar, and on the Mac platform a system menu at the top of the screen will be available. This menu will match an array - of Fl_Menu_Item's exactly as in all other FLTK menus. + of Fl_Menu_Item's exactly as in all other FLTK menus (except for the submenu with the + application's own name; see below). On other than Mac OS X platforms, Fl_Sys_Menu_Bar is a synonym of class Fl_Menu_Bar. @@ -56,6 +57,37 @@ class Fl_Sys_Menu_Bar_Driver; \li no symbolic labels \li no embossed labels \li no font sizes + + As described above, the submenu with the application's own name (usually + the second submenu from the left, immediately following the "Apple" submenu) + is a special case, and can be managed with + Fl_Mac_App_Menu::custom_application_menu_items(). + For example, to make your own "Appname -> Preferences" dialog, you might use: + + \code + #include <FL/platform.H> // for Fl_Mac_App_Menu class + #include <FL/Fl_Sys_Menu_Bar.H> // for Fl_Menu_Item + : + void prefs_cb(Fl_Widget *w, void *data) { + // ..Open your preferences dialog here.. + } + : + int main(..) { + : + // Items to add to the application menu + static Fl_Menu_Item appitems[] = { + { "Preferences", 0, prefs_cb, 0, 0 }, + { 0 }, { 0 } + }; + Fl_Mac_App_Menu::custom_application_menu_items(appitems); // adds it + } + \endcode + + ..the result being: + + \image html mac-app-menu-preferences.png "Mac Application submenu" + \image latex tree-simple.png "Mac Application submenu" width=4cm + */ class FL_EXPORT Fl_Sys_Menu_Bar : public Fl_Menu_Bar { protected: |
