]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_dnd.i
Corrected _setCallbackInfo code so GiveFeedback can work
[wxWidgets.git] / wxPython / src / _dnd.i
index 19a9494430d2021d60d17dc721497a68883b3f6e..9c2ade6aa3a32bad05781600b886298eef1bf6de 100644 (file)
@@ -57,6 +57,7 @@ IMP_PYCALLBACK_BOOL_DR(wxPyDropSource, wxDropSource, GiveFeedback);
 
 %name(DropSource) class wxPyDropSource {
 public:
+    %pythonAppend wxPyDropSource "self._setCallbackInfo(self, DropSource, 0)"
 #ifndef __WXGTK__
      wxPyDropSource(wxWindow *win,
                     const wxCursor &copy = wxNullCursor,
@@ -70,14 +71,13 @@ public:
 #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,7 +118,7 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyDropTarget, wxDropTarget, OnDrop);
 %name(DropTarget) class wxPyDropTarget // : public wxDropTarget
 {
 public:
-    %addtofunc wxPyDropTarget
+    %pythonAppend wxPyDropTarget
        "self._setCallbackInfo(self, DropTarget)"
     %apply SWIGTYPE *DISOWN { wxDataObject *dataObject };
 
@@ -180,7 +180,7 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyTextDropTarget, wxTextDropTarget, OnDrop);
 
 %name(TextDropTarget) class wxPyTextDropTarget : public wxPyDropTarget {
 public:
-    %addtofunc wxPyTextDropTarget   "self._setCallbackInfo(self, TextDropTarget)"
+    %pythonAppend wxPyTextDropTarget   "self._setCallbackInfo(self, TextDropTarget)"
 
     wxPyTextDropTarget();
     void _setCallbackInfo(PyObject* self, PyObject* _class);
@@ -217,13 +217,13 @@ public:
 bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
                                      const wxArrayString& filenames) {
     bool rval = False;
-    wxPyBeginBlockThreads();
+    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;
 }
 
@@ -241,7 +241,7 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyFileDropTarget, wxFileDropTarget, OnDrop);
 %name(FileDropTarget) class wxPyFileDropTarget : public wxPyDropTarget
 {
 public:
-    %addtofunc wxPyFileDropTarget   "self._setCallbackInfo(self, FileDropTarget)"
+    %pythonAppend wxPyFileDropTarget   "self._setCallbackInfo(self, FileDropTarget)"
 
     wxPyFileDropTarget();
     void _setCallbackInfo(PyObject* self, PyObject* _class);