Use the DISOWN typemap

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-01-27 00:52:47 +00:00
parent 7b466aee08
commit 8668c24280
7 changed files with 21 additions and 10 deletions

View File

@@ -40,6 +40,9 @@ public:
// query whether the clipboard is opened // query whether the clipboard is opened
virtual bool IsOpened() const; virtual bool IsOpened() const;
%apply SWIGTYPE *DISOWN { wxDataObject *data };
// add to the clipboard data // add to the clipboard data
// //
// NB: the clipboard owns the pointer and will delete it, so data must be // NB: the clipboard owns the pointer and will delete it, so data must be
@@ -50,6 +53,8 @@ public:
// AddData() // AddData()
virtual bool SetData( wxDataObject *data ); virtual bool SetData( wxDataObject *data );
%clear wxDataObject *data;
// ask if data in correct format is available // ask if data in correct format is available
virtual bool IsSupported( const wxDataFormat& format ); virtual bool IsSupported( const wxDataFormat& format );

View File

@@ -240,8 +240,9 @@ class wxDataObjectComposite : public wxDataObject {
public: public:
wxDataObjectComposite(); wxDataObjectComposite();
%addtofunc Add "args[1].thisown = 0" %apply SWIGTYPE *DISOWN { wxDataObjectSimple *dataObject };
void Add(wxDataObjectSimple *dataObject, int preferred = False); void Add(wxDataObjectSimple *dataObject, int preferred = False);
%clear wxDataObjectSimple *dataObject;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -119,8 +119,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyDropTarget, wxDropTarget, OnDrop);
{ {
public: public:
%addtofunc wxPyDropTarget %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); wxPyDropTarget(wxDataObject *dataObject = NULL);
void _setCallbackInfo(PyObject* self, PyObject* _class); void _setCallbackInfo(PyObject* self, PyObject* _class);
@@ -129,9 +129,10 @@ public:
// get/set the associated wxDataObject // get/set the associated wxDataObject
wxDataObject *GetDataObject(); wxDataObject *GetDataObject();
%addtofunc SetDataObject "args[1].thisown = 0"
void SetDataObject(wxDataObject *dataObject); void SetDataObject(wxDataObject *dataObject);
%clear wxDataObject *dataObject;
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def); wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void base_OnLeave(); void base_OnLeave();

View File

@@ -578,9 +578,10 @@ public:
// is there a way to tell SWIG to disown this??? // 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); void AssignImageList(wxImageList *imageList, int which);
%clear wxImageList *imageList;
// returns True if it is a virtual list control // returns True if it is a virtual list control
bool IsVirtual() const; bool IsVirtual() const;

View File

@@ -64,8 +64,9 @@ public:
virtual void SetImageList(wxImageList *imageList); virtual void SetImageList(wxImageList *imageList);
// as SetImageList() but we will delete the image list ourselves // 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); void AssignImageList(wxImageList *imageList);
%clear wxImageList *imageList;
// get pointer (may be NULL) to the associated image list // get pointer (may be NULL) to the associated image list
wxImageList* GetImageList() const; wxImageList* GetImageList() const;

View File

@@ -371,10 +371,10 @@ public:
void SetImageList(wxImageList *imageList); void SetImageList(wxImageList *imageList);
void SetStateImageList(wxImageList *imageList); void SetStateImageList(wxImageList *imageList);
%addtofunc AssignImageList "args[1].thisown = 0"; %apply SWIGTYPE *DISOWN { wxImageList *imageList };
%addtofunc AssignStateImageList "args[1].thisown = 0";
void AssignImageList(wxImageList *imageList); void AssignImageList(wxImageList *imageList);
void AssignStateImageList(wxImageList *imageList); void AssignStateImageList(wxImageList *imageList);
%clear wxImageList *imageList;
// retrieve items label // retrieve items label

View File

@@ -683,8 +683,10 @@ public:
// set/retrieve the drop target associated with this window (may be // set/retrieve the drop target associated with this window (may be
// NULL; it's owned by the window and will be deleted by it) // 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 ); virtual void SetDropTarget( wxPyDropTarget *dropTarget );
%clear wxPyDropTarget *dropTarget;
virtual wxPyDropTarget *GetDropTarget() const; virtual wxPyDropTarget *GetDropTarget() const;
#ifdef __WXMSW__ // TODO: should I drop-kick this? #ifdef __WXMSW__ // TODO: should I drop-kick this?