X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4309759886d3f79801610d3095b414e262a9f8cc..bf44306ebca5d26e204ef17851516d844bc2f0a7:/wxPython/src/controls2.i diff --git a/wxPython/src/controls2.i b/wxPython/src/controls2.i index 01436fa680..11e599148c 100644 --- a/wxPython/src/controls2.i +++ b/wxPython/src/controls2.i @@ -392,6 +392,7 @@ IMP_PYCALLBACK_LISTATTR_LONG(wxPyListCtrl, wxListCtrl, OnGetItemAttr); %} + %name(wxListCtrl)class wxPyListCtrl : public wxControl { public: wxPyListCtrl(wxWindow* parent, wxWindowID id = -1, @@ -695,7 +696,7 @@ public: 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); @@ -705,7 +706,7 @@ public: Py_DECREF(result); } - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); return retval; } @@ -940,9 +941,9 @@ public: } ~wxPyTreeItemData() { - bool doSave = wxPyRestoreThread(); + wxPyTState* state = wxPyBeginBlockThreads(); Py_DECREF(m_obj); - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); } PyObject* GetData() { @@ -951,9 +952,9 @@ public: } void SetData(PyObject* obj) { - bool doSave = wxPyRestoreThread(); + wxPyTState* state = wxPyBeginBlockThreads(); Py_DECREF(m_obj); - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); m_obj = obj; Py_INCREF(obj); } @@ -984,6 +985,7 @@ public: wxTreeItemId GetItem(); wxTreeItemId GetOldItem(); wxPoint GetPoint(); + const wxKeyEvent& GetKeyEvent(); int GetCode(); const wxString& GetLabel(); }; @@ -1016,15 +1018,16 @@ public: 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; @@ -1138,7 +1141,7 @@ public: //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; @@ -1148,7 +1151,7 @@ public: PyObject* item = wxPyConstructObject((void*)tii, "wxTreeItemId", TRUE); PyList_Append(rval, item); } - wxPySaveThread(doSave); + wxPyEndBlockThreads(state); return rval; } } @@ -1233,10 +1236,10 @@ public: 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 { @@ -1271,8 +1274,10 @@ public: //---------------------------------------------------------------------- %init %{ + // Map renamed classes back to their common name for OOR wxPyPtrTypeMap_Add("wxTreeItemData", "wxPyTreeItemData"); wxPyPtrTypeMap_Add("wxTreeCtrl", "wxPyTreeCtrl"); + wxPyPtrTypeMap_Add("wxListCtrl", "wxPyListCtrl"); %} //----------------------------------------------------------------------