Added Fl_Sys_Menu_Bar::insert(), clear(), clear_submenu()

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7518 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2010-04-16 19:27:28 +00:00
parent cba451be45
commit 5a8c6087b0
2 changed files with 33 additions and 2 deletions

View File

@ -54,8 +54,11 @@ public:
}
void menu(const Fl_Menu_Item *m);
int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0);
int insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data=0, int flags=0);
void remove(int n);
void replace(int rank, const char *name);
void clear();
int clear_submenu(int index);
#if ! defined(FL_DOXYGEN)
enum menuOrItemOperation { itemAtIndex, setKeyEquivalent, setKeyEquivalentModifierMask, setState, initWithTitle,
numberOfItems, setSubmenu, setEnabled, addSeparatorItem, setTitle, removeItem, addNewItem, renameItem };

View File

@ -36,7 +36,7 @@
* FLTK features not supported by the Mac System menu
*
* - no invisible menu items
* - no sybolic labels
* - no symbolic labels
* - embossed labels will be underlined instead
* - no font sizes
* - Shortcut Characters should be English alphanumeric only, no modifiers yet
@ -69,7 +69,7 @@ typedef const Fl_Menu_Item *pFl_Menu_Item;
/*
* Set a shortct for an Apple manu item using the FLTK shortcut descriptor.
* Set a shortcut for an Apple menu item using the FLTK shortcut descriptor.
*/
static void setMenuShortcut( MenuHandle mh, int miCnt, const Fl_Menu_Item *m )
{
@ -219,6 +219,34 @@ int Fl_Sys_Menu_Bar::add(const char* label, int shortcut, Fl_Callback *cb, void
return rank;
}
/**
* @brief insert in the system menu bar a new menu item
*
* insert in the system menu bar a new menu item, with a title string, shortcut int,
* callback, argument to the callback, and flags.
*
* @see Fl_Menu_::insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data, int flags)
*/
int Fl_Sys_Menu_Bar::insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data, int flags)
{
fl_open_display();
int rank = Fl_Menu_::insert(index, label, shortcut, cb, user_data, flags);
convertToMenuBar(Fl_Menu_::menu());
return rank;
}
void Fl_Sys_Menu_Bar::clear()
{
Fl_Menu_::clear();
convertToMenuBar(NULL);
}
int Fl_Sys_Menu_Bar::clear_submenu(int index)
{
int retval = Fl_Menu_::clear_submenu(index);
if (retval != -1) convertToMenuBar(Fl_Menu_::menu());
return retval;
}
/**
* @brief remove an item from the system menu bar