X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/17991ec0347994008244c136984fc6faffc4a33a..955e46d25d6ac0f9fa55ec9fe11f0c21da3a494d:/wxPython/src/_menu.i diff --git a/wxPython/src/_menu.i b/wxPython/src/_menu.i index 3ab2403291..0e3b113553 100644 --- a/wxPython/src/_menu.i +++ b/wxPython/src/_menu.i @@ -55,16 +55,24 @@ public: 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 %Rename(AppendItem, wxMenuItem*, Append(wxMenuItem *item)); + // insert an item before given position + %Rename(InsertItem, wxMenuItem*, Insert(size_t pos, wxMenuItem *item)); + // prepend an item to the menu + %Rename(PrependItem, wxMenuItem*, Prepend(wxMenuItem *item)); + %cleardisown(wxMenuItem*); + // insert a break in the menu (only works when appending the items, not // inserting them) virtual void Break(); - // insert an item before given position - %Rename(InsertItem, wxMenuItem*, Insert(size_t pos, wxMenuItem *item)); - // insert an item before given position wxMenuItem* Insert(size_t pos, int id, @@ -94,9 +102,6 @@ public: wxMenu *submenu, const wxString& help = wxPyEmptyString)); - // prepend an item to the menu - %Rename(PrependItem, wxMenuItem*, Prepend(wxMenuItem *item)); - // prepend any item to the menu wxMenuItem* Prepend(int id, const wxString& text, @@ -122,9 +127,11 @@ public: wxMenu *submenu, const wxString& help = wxPyEmptyString)); + // detach an item from the menu, but don't delete it so that it can be // added back later (but if it's not, the caller is responsible for // deleting it!) + %newobject Remove; wxMenuItem *Remove(int id); %Rename(RemoveItem, wxMenuItem*, Remove(wxMenuItem *item)); @@ -133,8 +140,10 @@ public: bool Delete(int id); %Rename(DeleteItem, bool, Delete(wxMenuItem *item)); - // delete the item from menu and destroy it (if it's a submenu) + %pythonAppend Destroy "args[0].thisown = 0" %extend { void Destroy() { delete self; } } + + // delete the item from menu and destroy it (if it's a submenu) %Rename(DestroyId, bool, Destroy(int id)); %Rename(DestroyItem, bool, Destroy(wxMenuItem *item)); @@ -321,6 +330,7 @@ public: const wxString& help = wxPyEmptyString, wxItemKind kind = wxITEM_NORMAL, wxMenu* subMenu = NULL); + ~wxMenuItem(); // the menu we're in wxMenu *GetMenu() const;