diff options
| author | Manolo Gouy <Manolo> | 2016-10-06 16:42:59 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-10-06 16:42:59 +0000 |
| commit | c7c238675a0b66b52513b5c1931b5ec15054f406 (patch) | |
| tree | b49adf7f4938e1732705e6c99faa1fa94cc9fc7b | |
| parent | a80ce48339952fc754aa6a95de6ba4ad64b73e68 (diff) | |
Introduce virtual void Fl_Menu_Bar::update() with a platform-specific reimplementation to support Fl_Sys_Menu_Bar.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12015 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Menu_Bar.H | 4 | ||||
| -rw-r--r-- | FL/Fl_Sys_Menu_Bar.H | 11 | ||||
| -rw-r--r-- | src/Fl_Sys_Menu_Bar.mm | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/FL/Fl_Menu_Bar.H b/FL/Fl_Menu_Bar.H index dcb76652a..b6261069d 100644 --- a/FL/Fl_Menu_Bar.H +++ b/FL/Fl_Menu_Bar.H @@ -88,6 +88,10 @@ public: menu items. */ Fl_Menu_Bar(int X, int Y, int W, int H, const char *l=0); + /** Updates the menu bar after any change to its items. + This is useful when the menu bar can be an Fl_Sys_Menu_Bar object. + */ + virtual void update() {} }; #endif diff --git a/FL/Fl_Sys_Menu_Bar.H b/FL/Fl_Sys_Menu_Bar.H index 61d97fe52..833140c24 100644 --- a/FL/Fl_Sys_Menu_Bar.H +++ b/FL/Fl_Sys_Menu_Bar.H @@ -33,7 +33,7 @@ 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 + Fl_Menu_Item::set()) should be followed by a call to update() to be visible in the menubar across all platforms. A few FLTK features are not supported by the Mac System menu: @@ -53,7 +53,7 @@ public: */ const Fl_Menu_Item *menu() const {return Fl_Menu_::menu();} void menu(const Fl_Menu_Item *m); - void update(); + virtual 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) @@ -100,12 +100,7 @@ public: #else -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() {} -}; - +typedef Fl_Menu_Bar Fl_Sys_Menu_Bar; #endif // defined(__APPLE__) || defined(FL_DOXYGEN) diff --git a/src/Fl_Sys_Menu_Bar.mm b/src/Fl_Sys_Menu_Bar.mm index a44039b5f..4dcdb3f8a 100644 --- a/src/Fl_Sys_Menu_Bar.mm +++ b/src/Fl_Sys_Menu_Bar.mm @@ -458,8 +458,6 @@ void Fl_Sys_Menu_Bar::replace(int index, const char *name) update(); } -/** Updates the system menu after any change to its items. - */ void Fl_Sys_Menu_Bar::update() { convertToMenuBar(Fl_Menu_::menu()); |
