int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) {
int retval = 0;
PyObject* func = (PyObject*)funcPtr;
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
PyObject* args = Py_BuildValue("(ii)", item1, item2);
PyObject* result = PyEval_CallObject(func, args);
Py_DECREF(result);
}
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
return retval;
}
}
~wxPyTreeItemData() {
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
Py_DECREF(m_obj);
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
}
PyObject* GetData() {
}
void SetData(PyObject* obj) {
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
Py_DECREF(m_obj);
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
m_obj = obj;
Py_INCREF(obj);
}
int OnCompareItems(const wxTreeItemId& item1,
const wxTreeItemId& item2) {
int rval = 0;
- bool doSave = wxPyRestoreThread();
- if (m_myInst.findCallback("OnCompareItems"))
+ bool found;
+ wxPyTState* state = wxPyBeginBlockThreads();
+ if ((found = m_myInst.findCallback("OnCompareItems")))
rval = m_myInst.callCallback(Py_BuildValue(
"(OO)",
wxPyConstructObject((void*)&item1, "wxTreeItemId"),
wxPyConstructObject((void*)&item2, "wxTreeItemId")));
- else
+ wxPyEndBlockThreads(state);
+ if (! found)
rval = wxTreeCtrl::OnCompareItems(item1, item2);
- wxPySaveThread(doSave);
return rval;
}
PYPRIVATE;
//size_t GetSelections(wxArrayTreeItemIds& selection);
%addmethods {
PyObject* GetSelections() {
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
PyObject* rval = PyList_New(0);
wxArrayTreeItemIds array;
size_t num, x;
PyObject* item = wxPyConstructObject((void*)tii, "wxTreeItemId", TRUE);
PyList_Append(rval, item);
}
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
return rval;
}
}
PyObject* GetBoundingRect(const wxTreeItemId& item, int textOnly = FALSE) {
wxRect rect;
if (self->GetBoundingRect(item, rect, textOnly)) {
- bool doSave = wxPyRestoreThread();
+ wxPyTState* state = wxPyBeginBlockThreads();
wxRect* r = new wxRect(rect);
PyObject* val = wxPyConstructObject((void*)r, "wxRect");
- wxPySaveThread(doSave);
+ wxPyEndBlockThreads(state);
return val;
}
else {
//----------------------------------------------------------------------
%init %{
+ // Map renamed classes back to their common name for OOR
wxPyPtrTypeMap_Add("wxTreeItemData", "wxPyTreeItemData");
wxPyPtrTypeMap_Add("wxTreeCtrl", "wxPyTreeCtrl");
+ wxPyPtrTypeMap_Add("wxListCtrl", "wxPyListCtrl");
%}
//----------------------------------------------------------------------