From cefcc57db8591495d11d2f6f9bffb96de889e154 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 23 Dec 2006 00:02:23 +0000 Subject: [PATCH] RemoveItem should return the same object it is passed, but adjusted for new ownership git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44038 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_menu.i | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/wxPython/src/_menu.i b/wxPython/src/_menu.i index 7d36331a39..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); @@ -377,7 +388,7 @@ 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 }