From a7af6ab04c8f9ad5571542ab33ddc709bed9b624 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 17 Jun 2016 12:56:18 +0000 Subject: [PATCH] Make Fl_Sys_Menu_Bar::update() public and cross-platform. It was before protected and Mac OS-specific. This allows to call it after direct modification of menu items. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11785 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Sys_Menu_Bar.H | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/FL/Fl_Sys_Menu_Bar.H b/FL/Fl_Sys_Menu_Bar.H index 3f7344e15..c866c083d 100644 --- a/FL/Fl_Sys_Menu_Bar.H +++ b/FL/Fl_Sys_Menu_Bar.H @@ -30,7 +30,13 @@ \n To use this class, just replace Fl_Menu_Bar by 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 with standard FLTK menus. - \n A few FLTK features are not supported by the Mac System menu: + + Changes to the menu state are immediately visible in the menubar when they are made + using member functions of the Fl_Sys_Menu_Bar class. Other changes (e.g., by a call to + Fl_Menu_Item::set()) should be followed by a call to Fl_Sys_Menu_Bar::update() to be + visible in the menubar across all platforms. + + A few FLTK features are not supported by the Mac System menu: \li no symbolic labels \li no embossed labels \li no font sizes @@ -39,7 +45,6 @@ */ class FL_EXPORT Fl_Sys_Menu_Bar : public Fl_Menu_Bar { protected: - void update(); void draw(); public: Fl_Sys_Menu_Bar(int x,int y,int w,int h,const char *l=0); @@ -48,6 +53,7 @@ public: */ const Fl_Menu_Item *menu() const {return Fl_Menu_::menu();} void menu(const Fl_Menu_Item *m); + void update(); 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) @@ -94,7 +100,12 @@ public: #else -typedef Fl_Menu_Bar Fl_Sys_Menu_Bar; +class FL_EXPORT Fl_Sys_Menu_Bar : public Fl_Menu_Bar { +public: + Fl_Sys_Menu_Bar(int x,int y,int w,int h,const char *l=0) : Fl_Menu_Bar(x,y,w,h,l) {} + inline void update() {} +}; + #endif // defined(__APPLE__) || defined(FL_DOXYGEN)