X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ecece7e042ddd7a8968ddccdf6dd4e982b5a15a..bb650010c8200174ce824aaadac44e8e5ead194d:/wxPython/src/_menu.i?ds=sidebyside diff --git a/wxPython/src/_menu.i b/wxPython/src/_menu.i index 1bbb3a56e4..c19a304862 100644 --- a/wxPython/src/_menu.i +++ b/wxPython/src/_menu.i @@ -133,8 +133,19 @@ public: // deleting it!) %newobject Remove; wxMenuItem *Remove(int id); - %Rename(RemoveItem, wxMenuItem*, Remove(wxMenuItem *item)); + %feature("shadow") Remove(wxMenuItem *item) %{ + def RemoveItem(self, item): + """RemoveItem(self, MenuItem item) -> MenuItem""" + #// The return object is always the parameter, so return that + #// proxy instead of the new one + val = _core_.Menu_RemoveItem(self, item) + item.this.own(val.this.own()) + val.this.disown() + return item + %} + %Rename(RemoveItem, wxMenuItem*, Remove(wxMenuItem *item)); + // delete an item from the menu (submenus are not destroyed by this // function, see Destroy) bool Delete(int id); @@ -369,7 +380,7 @@ public: // turn off this typemap %typemap(out) wxMenuItem*; - wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_ANY, + wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_SEPARATOR, const wxString& text = wxPyEmptyString, const wxString& help = wxPyEmptyString, wxItemKind kind = wxITEM_NORMAL, @@ -377,7 +388,10 @@ public: ~wxMenuItem(); // Turn it back on again - %typemap(out) wxEvtHandler* { $result = wxPyMake_wxObject($1, $owner); } + %typemap(out) wxMenuItem* { $result = wxPyMake_wxObject($1, $owner); } + + // Make Destroy a NOP. The destruction will be handled by SWIG. + %pythoncode { def Destroy(self): pass } // the menu we're in