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
This commit is contained in:
Manolo Gouy 2016-10-06 16:42:59 +00:00
parent a80ce48339
commit c7c238675a
3 changed files with 7 additions and 10 deletions

View File

@ -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

View File

@ -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)

View File

@ -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());