X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0122b7e3fcfd78f879470053c91a60e3c66537a3..95e9b72bf4c4da413f28dd4f559dc14a83c292f8:/wxPython/contrib/ogl/oglbasic.i?ds=sidebyside diff --git a/wxPython/contrib/ogl/oglbasic.i b/wxPython/contrib/ogl/oglbasic.i index 6d66e15caa..c1f6c83014 100644 --- a/wxPython/contrib/ogl/oglbasic.i +++ b/wxPython/contrib/ogl/oglbasic.i @@ -94,8 +94,15 @@ public: 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(); @@ -147,10 +154,7 @@ public: void _setCallbackInfo(PyObject* self, PyObject* _class); %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyShape)" - - %addmethods { - void Destroy() { delete self; } - } + %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);