// append any kind of item (normal/check/radio/separator)
wxMenuItem* Append(int id,
- const wxString& text,
+ const wxString& text = wxPyEmptyString,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);
wxMenu *submenu,
const wxString& help = wxPyEmptyString));
+ wxMenuItem* AppendSubMenu(wxMenu *submenu,
+ const wxString& text,
+ const wxString& help = wxPyEmptyString);
%disownarg(wxMenuItem*);
// the most generic form of Append() - append anything
// insert an item before given position
wxMenuItem* Insert(size_t pos,
int id,
- const wxString& text,
+ const wxString& text = wxPyEmptyString,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);
// prepend any item to the menu
wxMenuItem* Prepend(int id,
- const wxString& text,
+ const wxString& text = wxPyEmptyString,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);
// called before deleting the menubar normally
virtual void Detach();
+ // update all menu item states in all menus
+ virtual void UpdateMenus();
+
#ifdef __WXMAC__
static void SetAutoWindowMenu( bool enable );
static bool GetAutoWindowMenu();
static bool GetAutoWindowMenu() { return false; }
}
#endif
+
+ %pythoncode {
+ def GetMenus(self):
+ """Return a list of (menu, label) items for the menus in the MenuBar. """
+ return [(self.GetMenu(i), self.GetLabelTop(i))
+ for i in range(self.GetMenuCount())]
+
+ def SetMenus(self, items):
+ """Clear and add new menus to the MenuBar from a list of (menu, label) items. """
+ for i in range(self.GetMenuCount()-1, -1, -1):
+ self.Remove(i)
+ for m, l in items:
+ self.Append(m, l)
+ }
+ %property(Menus, GetMenus, SetMenus);
+
};
//---------------------------------------------------------------------------