X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ca6a5f04692678cd2d9f3ea0843fc3f5a0b254f..5bf2abe34850e0952a44f3be4a4390ea12c55bd0:/wxPython/src/clip_dnd.i diff --git a/wxPython/src/clip_dnd.i b/wxPython/src/clip_dnd.i index 8feb9e8786..634a2f06fc 100644 --- a/wxPython/src/clip_dnd.i +++ b/wxPython/src/clip_dnd.i @@ -147,7 +147,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) { // C++ version. bool rval = FALSE; - bool doSave = wxPyRestoreThread(); + wxPyTState* state = wxPyBeginBlockThreads(); if (m_myInst.findCallback("GetDataHere")) { PyObject* ro; ro = m_myInst.callCallbackObj(Py_BuildValue("()")); @@ -158,7 +158,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) { Py_DECREF(ro); } } - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); return rval; } @@ -166,13 +166,13 @@ bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) { // For this one we simply need to make a string from buf and len // and send it to the Python method. bool rval = FALSE; - bool doSave = wxPyRestoreThread(); + wxPyTState* state = wxPyBeginBlockThreads(); if (m_myInst.findCallback("SetData")) { PyObject* data = PyString_FromStringAndSize((char*)buf, len); rval = m_myInst.callCallback(Py_BuildValue("(O)", data)); Py_DECREF(data); } - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); return rval; } %} @@ -264,7 +264,7 @@ public: wxBitmap wxPyBitmapDataObject::GetBitmap() { wxBitmap* rval = &wxNullBitmap; - bool doSave = wxPyRestoreThread(); + wxPyTState* state = wxPyBeginBlockThreads(); if (m_myInst.findCallback("GetBitmap")) { PyObject* ro; wxBitmap* ptr; @@ -275,17 +275,17 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() { Py_DECREF(ro); } } - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); return *rval; } void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { - bool doSave = wxPyRestoreThread(); + wxPyTState* state = wxPyBeginBlockThreads(); if (m_myInst.findCallback("SetBitmap")) { m_myInst.callCallback(Py_BuildValue("(O)", wxPyConstructObject((void*)&bitmap, "wxBitmap"))); } - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); } %} @@ -346,6 +346,7 @@ public: } size_t GetSize(); + //void *GetData(); %addmethods { PyObject* GetData() { @@ -362,7 +363,7 @@ public: //---------------------------------------------------------------------- //---------------------------------------------------------------------- -class wxClipboard { +class wxClipboard : public wxObject { public: wxClipboard(); @@ -582,7 +583,7 @@ public: bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) { bool rval = FALSE; - bool doSave = wxPyRestoreThread(); + wxPyTState* state = wxPyBeginBlockThreads(); PyObject* list = PyList_New(0); for (size_t i=0; i<filenames.GetCount(); i++) { PyObject* str = PyString_FromString(filenames[i].c_str()); @@ -591,7 +592,7 @@ bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y, if (m_myInst.findCallback("OnDropFiles")) rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list)); Py_DECREF(list); - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); return rval; } @@ -628,7 +629,9 @@ public: %init %{ wxPyTheClipboard = wxTheClipboard; - + wxPyPtrTypeMap_Add("wxDropSource", "wxPyDropSource"); + wxPyPtrTypeMap_Add("wxTextDropTarget", "wxPyTextDropTarget"); + wxPyPtrTypeMap_Add("wxFileDropTarget", "wxPyFileDropTarget"); %} //----------------------------------------------------------------------