]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_dnd.i
reSWIGged
[wxWidgets.git] / wxPython / src / _dnd.i
index 15f0f187776fd814111ad906c736bce90df3f2ef..a7f5e4ab3bfbef365e4d4901c9ce1c351d61af4c 100644 (file)
 
 
 //---------------------------------------------------------------------------
+#ifndef __WXX11__
 
-%{
-%}
-
-//---------------------------------------------------------------------------
 %newgroup
 
 // flags for wxDropSource::DoDragDrop()
@@ -58,29 +55,30 @@ IMP_PYCALLBACK_BOOL_DR(wxPyDropSource, wxDropSource, GiveFeedback);
 %}
 
 
-%name(DropSource) class wxPyDropSource {
+%rename(DropSource) wxPyDropSource;
+class wxPyDropSource {
 public:
+    %pythonAppend wxPyDropSource "self._setCallbackInfo(self, DropSource, 0)"
 #ifndef __WXGTK__
-     wxPyDropSource(wxWindow *win = NULL,
+     wxPyDropSource(wxWindow *win,
                     const wxCursor &copy = wxNullCursor,
                     const wxCursor &move = wxNullCursor,
                     const wxCursor &none = wxNullCursor);
 #else
-    wxPyDropSource(wxWindow *win = NULL,
+    wxPyDropSource(wxWindow *win,
                    const wxIcon& copy = wxNullIcon,
                    const wxIcon& move = wxNullIcon,
                    const wxIcon& none = wxNullIcon);
 #endif
 
     void _setCallbackInfo(PyObject* self, PyObject* _class, int incref);
-    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxDropSource, 0)"
     ~wxPyDropSource();
 
     // set the data which is transfered by drag and drop
     void SetData(wxDataObject& data);
-    
+
     wxDataObject *GetDataObject();
-    
+
     // set the icon corresponding to given drag result
     void SetCursor(wxDragResult res, const wxCursor& cursor);
 
@@ -118,12 +116,13 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyDropTarget, wxDropTarget, OnDrop);
 %}
 
 
-%name(DropTarget) class wxPyDropTarget // : public wxDropTarget
+%rename(DropTarget) wxPyDropTarget;
+class wxPyDropTarget // : public wxDropTarget
 {
 public:
-    %addtofunc wxPyDropTarget
-       "if args: args[0].thisown = 0;
-        self._setCallbackInfo(self, DropTarget)"
+    %pythonAppend wxPyDropTarget
+       "self._setCallbackInfo(self, DropTarget)"
+    %apply SWIGTYPE *DISOWN { wxDataObject *dataObject };
 
     wxPyDropTarget(wxDataObject *dataObject = NULL);
     void _setCallbackInfo(PyObject* self, PyObject* _class);
@@ -132,9 +131,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();
@@ -180,9 +180,10 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyTextDropTarget, wxTextDropTarget, OnDrop);
 
 %}
 
-%name(TextDropTarget) class wxPyTextDropTarget : public wxPyDropTarget {
+%rename(TextDropTarget) wxPyTextDropTarget;
+class wxPyTextDropTarget : public wxPyDropTarget {
 public:
-    %addtofunc wxPyTextDropTarget   "self._setCallbackInfo(self, TextDropTarget)"
+    %pythonAppend wxPyTextDropTarget   "self._setCallbackInfo(self, TextDropTarget)"
 
     wxPyTextDropTarget();
     void _setCallbackInfo(PyObject* self, PyObject* _class);
@@ -218,14 +219,14 @@ public:
 
 bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
                                      const wxArrayString& filenames) {
-    bool rval = False;
-    wxPyBeginBlockThreads();
+    bool rval = false;
+    bool blocked = wxPyBeginBlockThreads();
     if (wxPyCBH_findCallback(m_myInst, "OnDropFiles")) {
         PyObject* list = wxArrayString2PyList_helper(filenames);
         rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",x,y,list));
         Py_DECREF(list);
     }
-    wxPyEndBlockThreads();
+    wxPyEndBlockThreads(blocked);
     return rval;
 }
 
@@ -240,10 +241,11 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyFileDropTarget, wxFileDropTarget, OnDrop);
 %}
 
 
-%name(FileDropTarget) class wxPyFileDropTarget : public wxPyDropTarget
+%rename(FileDropTarget) wxPyFileDropTarget;
+class wxPyFileDropTarget : public wxPyDropTarget
 {
 public:
-    %addtofunc wxPyFileDropTarget   "self._setCallbackInfo(self, FileDropTarget)"
+    %pythonAppend wxPyFileDropTarget   "self._setCallbackInfo(self, FileDropTarget)"
 
     wxPyFileDropTarget();
     void _setCallbackInfo(PyObject* self, PyObject* _class);
@@ -265,3 +267,5 @@ public:
     wxPyPtrTypeMap_Add("wxFileDropTarget", "wxPyFileDropTarget");
 %}
 //---------------------------------------------------------------------------
+
+#endif