From 8668c242808de89b9a8debf2b5a8e62d46e10972 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 27 Jan 2004 00:52:47 +0000 Subject: [PATCH] Use the DISOWN typemap git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_clipbrd.i | 5 +++++ wxPython/src/_dataobj.i | 3 ++- wxPython/src/_dnd.i | 7 ++++--- wxPython/src/_listctrl.i | 5 +++-- wxPython/src/_notebook.i | 3 ++- wxPython/src/_treectrl.i | 4 ++-- wxPython/src/_window.i | 4 +++- 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/wxPython/src/_clipbrd.i b/wxPython/src/_clipbrd.i index b1d42c2046..ef48ae8daa 100644 --- a/wxPython/src/_clipbrd.i +++ b/wxPython/src/_clipbrd.i @@ -40,6 +40,9 @@ public: // query whether the clipboard is opened virtual bool IsOpened() const; + + %apply SWIGTYPE *DISOWN { wxDataObject *data }; + // add to the clipboard data // // NB: the clipboard owns the pointer and will delete it, so data must be @@ -50,6 +53,8 @@ public: // AddData() virtual bool SetData( wxDataObject *data ); + %clear wxDataObject *data; + // ask if data in correct format is available virtual bool IsSupported( const wxDataFormat& format ); diff --git a/wxPython/src/_dataobj.i b/wxPython/src/_dataobj.i index 7a52a47305..8dacc168d8 100644 --- a/wxPython/src/_dataobj.i +++ b/wxPython/src/_dataobj.i @@ -240,8 +240,9 @@ class wxDataObjectComposite : public wxDataObject { public: wxDataObjectComposite(); - %addtofunc Add "args[1].thisown = 0" + %apply SWIGTYPE *DISOWN { wxDataObjectSimple *dataObject }; void Add(wxDataObjectSimple *dataObject, int preferred = False); + %clear wxDataObjectSimple *dataObject; }; //--------------------------------------------------------------------------- diff --git a/wxPython/src/_dnd.i b/wxPython/src/_dnd.i index 4e59285844..19a9494430 100644 --- a/wxPython/src/_dnd.i +++ b/wxPython/src/_dnd.i @@ -119,8 +119,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyDropTarget, wxDropTarget, OnDrop); { public: %addtofunc wxPyDropTarget - "if args: args[0].thisown = 0; - self._setCallbackInfo(self, DropTarget)" + "self._setCallbackInfo(self, DropTarget)" + %apply SWIGTYPE *DISOWN { wxDataObject *dataObject }; wxPyDropTarget(wxDataObject *dataObject = NULL); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -129,9 +129,10 @@ public: // get/set the associated wxDataObject wxDataObject *GetDataObject(); - %addtofunc SetDataObject "args[1].thisown = 0" void SetDataObject(wxDataObject *dataObject); + %clear wxDataObject *dataObject; + wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def); void base_OnLeave(); diff --git a/wxPython/src/_listctrl.i b/wxPython/src/_listctrl.i index 156c2f658d..60f6ba3edc 100644 --- a/wxPython/src/_listctrl.i +++ b/wxPython/src/_listctrl.i @@ -578,9 +578,10 @@ public: // is there a way to tell SWIG to disown this??? - %addtofunc AssignImageList "args[1].thisown = 0"; + %apply SWIGTYPE *DISOWN { wxImageList *imageList }; void AssignImageList(wxImageList *imageList, int which); - + %clear wxImageList *imageList; + // returns True if it is a virtual list control bool IsVirtual() const; diff --git a/wxPython/src/_notebook.i b/wxPython/src/_notebook.i index baff847c76..5cfb313667 100644 --- a/wxPython/src/_notebook.i +++ b/wxPython/src/_notebook.i @@ -64,8 +64,9 @@ public: virtual void SetImageList(wxImageList *imageList); // as SetImageList() but we will delete the image list ourselves - %addtofunc AssignImageList "args[1].thisown = 0" + %apply SWIGTYPE *DISOWN { wxImageList *imageList }; void AssignImageList(wxImageList *imageList); + %clear wxImageList *imageList; // get pointer (may be NULL) to the associated image list wxImageList* GetImageList() const; diff --git a/wxPython/src/_treectrl.i b/wxPython/src/_treectrl.i index 1fac4850c1..616322344c 100644 --- a/wxPython/src/_treectrl.i +++ b/wxPython/src/_treectrl.i @@ -371,10 +371,10 @@ public: void SetImageList(wxImageList *imageList); void SetStateImageList(wxImageList *imageList); - %addtofunc AssignImageList "args[1].thisown = 0"; - %addtofunc AssignStateImageList "args[1].thisown = 0"; + %apply SWIGTYPE *DISOWN { wxImageList *imageList }; void AssignImageList(wxImageList *imageList); void AssignStateImageList(wxImageList *imageList); + %clear wxImageList *imageList; // retrieve items label diff --git a/wxPython/src/_window.i b/wxPython/src/_window.i index b446de9d06..3ffc44537d 100644 --- a/wxPython/src/_window.i +++ b/wxPython/src/_window.i @@ -683,8 +683,10 @@ public: // set/retrieve the drop target associated with this window (may be // NULL; it's owned by the window and will be deleted by it) - %addtofunc SetDropTarget "args[1].thisown = 0" + %apply SWIGTYPE *DISOWN { wxPyDropTarget *dropTarget }; virtual void SetDropTarget( wxPyDropTarget *dropTarget ); + %clear wxPyDropTarget *dropTarget; + virtual wxPyDropTarget *GetDropTarget() const; #ifdef __WXMSW__ // TODO: should I drop-kick this? -- 2.45.2