summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-04-16 19:27:28 +0000
committerManolo Gouy <Manolo>2010-04-16 19:27:28 +0000
commit5a8c6087b0119ebcc17ede14b883398e37310a58 (patch)
treec8533039183e7bce3b4030c5f892c8e65e0fc73e /src
parentcba451be455e16ab1be718ae9a6a067ba346b74e (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Sys_Menu_Bar.cxx32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/Fl_Sys_Menu_Bar.cxx b/src/Fl_Sys_Menu_Bar.cxx
index 88d92ae06..2110ff1e8 100644
--- a/src/Fl_Sys_Menu_Bar.cxx
+++ b/src/Fl_Sys_Menu_Bar.cxx
@@ -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