// C++ version.
bool rval = FALSE;
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
if (m_myInst.findCallback("GetDataHere")) {
PyObject* ro;
ro = m_myInst.callCallbackObj(Py_BuildValue("()"));
Py_DECREF(ro);
}
}
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
return rval;
}
// 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;
}
%}
wxBitmap wxPyBitmapDataObject::GetBitmap() {
wxBitmap* rval = &wxNullBitmap;
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
if (m_myInst.findCallback("GetBitmap")) {
PyObject* ro;
wxBitmap* ptr;
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);
}
%}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
-class wxClipboard {
+class wxClipboard : public wxObject {
public:
wxClipboard();
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());
if (m_myInst.findCallback("OnDropFiles"))
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
Py_DECREF(list);
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
return rval;
}
%init %{
wxPyTheClipboard = wxTheClipboard;
-
+ wxPyPtrTypeMap_Add("wxDropSource", "wxPyDropSource");
+ wxPyPtrTypeMap_Add("wxTextDropTarget", "wxPyTextDropTarget");
+ wxPyPtrTypeMap_Add("wxFileDropTarget", "wxPyFileDropTarget");
%}
//----------------------------------------------------------------------