X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9416aa89ca06d0fb20b1002e026d2c7ac7aa6a17..c74d8df09d0c0e182cb2063cc4cc546de3a00fae:/wxPython/contrib/ogl/oglbasic.i diff --git a/wxPython/contrib/ogl/oglbasic.i b/wxPython/contrib/ogl/oglbasic.i index f12f64033f..c1f6c83014 100644 --- a/wxPython/contrib/ogl/oglbasic.i +++ b/wxPython/contrib/ogl/oglbasic.i @@ -92,10 +92,17 @@ public: wxPyShapeEvtHandler(wxPyShapeEvtHandler *prev = NULL, wxPyShape *shape = NULL); - void _setSelf(PyObject* self, PyObject* _class); - %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyShapeEvtHandler)" + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShapeEvtHandler)" + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" %addmethods { void Destroy() { delete self; } } + %addmethods { + void _setOORInfo(PyObject* _self) { + self->SetClientObject(new wxPyClientData(_self)); + } + } + void SetShape(wxPyShape *sh); wxPyShape *GetShape(); @@ -145,12 +152,9 @@ class wxPyShape : public wxPyShapeEvtHandler { public: // wxPyShape(wxPyShapeCanvas *can = NULL); abstract base class... - void _setSelf(PyObject* self, PyObject* _class); - %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyShape)" - - %addmethods { - void Destroy() { delete self; } - } + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShape)" + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" void GetBoundingBoxMax(double *OUTPUT, double *OUTPUT); void GetBoundingBoxMin(double *OUTPUT, double *OUTPUT); @@ -236,25 +240,17 @@ public: // void SetClientData(wxObject *client_data); // wxObject *GetClientData(); - %addmethods { - void SetClientData(PyObject* userData) { - wxPyUserData* data = NULL; - if (userData) - data = new wxPyUserData(userData); - self->SetClientData(data); - } - PyObject* GetClientData() { - wxPyUserData* data = (wxPyUserData*)self->GetClientData(); - if (data) { - Py_INCREF(data->m_obj); - return data->m_obj; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - } + // The real client data methods are being used for OOR, so just fake it. + %pragma(python) addtoclass = " + def SetClientData(self, data): + self.clientData = data + def GetClientData(self): + if hasattr(self, 'clientData'): + return self.clientData + else: + return None +" void Show(bool show); bool IsShown(); @@ -364,6 +360,8 @@ public: void ClearAttachments(); void Recentre(wxDC& dc); void ClearPointList(wxList& list); + wxPen GetBackgroundPen(); + wxBrush GetBackgroundBrush(); void base_OnDelete(); void base_OnDraw(wxDC& dc);