Author: manolo
Date: 2010-04-16 12:27:28 -0700 (Fri, 16 Apr 2010)
New Revision: 7518
Log:
Added Fl_Sys_Menu_Bar::insert(), clear(), clear_submenu()
Modified:
branches/branch-1.3/FL/Fl_Sys_Menu_Bar.H
branches/branch-1.3/src/Fl_Sys_Menu_Bar.cxx
Modified: branches/branch-1.3/FL/Fl_Sys_Menu_Bar.H
===================================================================
--- branches/branch-1.3/FL/Fl_Sys_Menu_Bar.H 2010-04-16 17:55:45 UTC (rev
7517)
+++ branches/branch-1.3/FL/Fl_Sys_Menu_Bar.H 2010-04-16 19:27:28 UTC (rev
7518)
@@ -54,8 +54,11 @@
}
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 };
Modified: branches/branch-1.3/src/Fl_Sys_Menu_Bar.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Sys_Menu_Bar.cxx 2010-04-16 17:55:45 UTC (rev
7517)
+++ branches/branch-1.3/src/Fl_Sys_Menu_Bar.cxx 2010-04-16 19:27:28 UTC (rev
7518)
@@ -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 @@
/*
- * 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,7 +219,35 @@
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
*
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit