From c893f25d86ce00a0f5fc0a37a18e41d487a014fb Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 11 Apr 2002 23:12:02 +0000 Subject: [PATCH] Fixed GetShapeList and similar methods to use OOR. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/contrib/ogl/ogl.cpp | 19 +++++++++++++++++++ wxPython/contrib/ogl/ogl.i | 19 +++++++++++++++++++ wxPython/contrib/ogl/oglbasic.cpp | 4 ++-- wxPython/contrib/ogl/oglbasic.i | 4 ++-- wxPython/contrib/ogl/oglcanvas.cpp | 2 +- wxPython/contrib/ogl/oglcanvas.i | 8 +++++++- wxPython/contrib/ogl/oglcanvas.py | 4 ++++ wxPython/contrib/ogl/oglhelpers.h | 1 + wxPython/contrib/ogl/oglshapes.cpp | 2 +- wxPython/contrib/ogl/oglshapes.i | 2 +- wxPython/contrib/ogl/oglshapes2.cpp | 2 +- wxPython/contrib/ogl/oglshapes2.i | 2 +- 12 files changed, 59 insertions(+), 10 deletions(-) diff --git a/wxPython/contrib/ogl/ogl.cpp b/wxPython/contrib/ogl/ogl.cpp index 3c74a41f61..abd1f2f04e 100644 --- a/wxPython/contrib/ogl/ogl.cpp +++ b/wxPython/contrib/ogl/ogl.cpp @@ -186,6 +186,25 @@ PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source) { return target; } +//--------------------------------------------------------------------------- + +PyObject* wxPy_ConvertShapeList(wxListBase* list, const char* className) { + PyObject* pyList; + PyObject* pyObj; + wxObject* wxObj; + wxNode* node = list->First(); + + wxPyBeginBlockThreads(); + pyList = PyList_New(0); + while (node) { + wxObj = node->Data(); + pyObj = wxPyMake_wxShapeEvtHandler((wxShapeEvtHandler*)wxObj); + PyList_Append(pyList, pyObj); + node = node->Next(); + } + wxPyEndBlockThreads(); + return pyList; +} //--------------------------------------------------------------------------- diff --git a/wxPython/contrib/ogl/ogl.i b/wxPython/contrib/ogl/ogl.i index dfa1a664a2..0d66d65282 100644 --- a/wxPython/contrib/ogl/ogl.i +++ b/wxPython/contrib/ogl/ogl.i @@ -235,6 +235,25 @@ PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source) { return target; } +//--------------------------------------------------------------------------- + +PyObject* wxPy_ConvertShapeList(wxListBase* list, const char* className) { + PyObject* pyList; + PyObject* pyObj; + wxObject* wxObj; + wxNode* node = list->First(); + + wxPyBeginBlockThreads(); + pyList = PyList_New(0); + while (node) { + wxObj = node->Data(); + pyObj = wxPyMake_wxShapeEvtHandler((wxShapeEvtHandler*)wxObj); + PyList_Append(pyList, pyObj); + node = node->Next(); + } + wxPyEndBlockThreads(); + return pyList; +} //--------------------------------------------------------------------------- diff --git a/wxPython/contrib/ogl/oglbasic.cpp b/wxPython/contrib/ogl/oglbasic.cpp index c0bc910213..7bc2a3787c 100644 --- a/wxPython/contrib/ogl/oglbasic.cpp +++ b/wxPython/contrib/ogl/oglbasic.cpp @@ -3080,7 +3080,7 @@ static PyObject *_wrap_wxPyShape_GetTopAncestor(PyObject *self, PyObject *args, static PyObject * wxPyShape_GetChildren(wxPyShape *self) { wxList& list = self->GetChildren(); - return wxPy_ConvertList(&list, "wxPyShape"); + return wxPy_ConvertShapeList(&list, "wxPyShape"); } static PyObject *_wrap_wxPyShape_GetChildren(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -4147,7 +4147,7 @@ static PyObject *_wrap_wxPyShape_GetMaintainAspectRatio(PyObject *self, PyObject static PyObject * wxPyShape_GetLines(wxPyShape *self) { wxList& list = self->GetLines(); - return wxPy_ConvertList(&list, "wxPyLineShape"); + return wxPy_ConvertShapeList(&list, "wxPyLineShape"); } static PyObject *_wrap_wxPyShape_GetLines(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; diff --git a/wxPython/contrib/ogl/oglbasic.i b/wxPython/contrib/ogl/oglbasic.i index 2338089016..8fd19b783b 100644 --- a/wxPython/contrib/ogl/oglbasic.i +++ b/wxPython/contrib/ogl/oglbasic.i @@ -179,7 +179,7 @@ public: %addmethods { PyObject* GetChildren() { wxList& list = self->GetChildren(); - return wxPy_ConvertList(&list, "wxPyShape"); + return wxPy_ConvertShapeList(&list, "wxPyShape"); } } @@ -223,7 +223,7 @@ public: %addmethods { PyObject* GetLines() { wxList& list = self->GetLines(); - return wxPy_ConvertList(&list, "wxPyLineShape"); + return wxPy_ConvertShapeList(&list, "wxPyLineShape"); } } diff --git a/wxPython/contrib/ogl/oglcanvas.cpp b/wxPython/contrib/ogl/oglcanvas.cpp index d79dfa4789..a3feab52c1 100644 --- a/wxPython/contrib/ogl/oglcanvas.cpp +++ b/wxPython/contrib/ogl/oglcanvas.cpp @@ -425,7 +425,7 @@ static PyObject *_wrap_wxDiagram_GetMouseTolerance(PyObject *self, PyObject *arg static PyObject * wxDiagram_GetShapeList(wxDiagram *self) { wxList* list = self->GetShapeList(); - return wxPy_ConvertList(list, "wxPyShape"); + return wxPy_ConvertShapeList(list, "wxPyShape"); } static PyObject *_wrap_wxDiagram_GetShapeList(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; diff --git a/wxPython/contrib/ogl/oglcanvas.i b/wxPython/contrib/ogl/oglcanvas.i index 38507e443f..a2dd8f59b8 100644 --- a/wxPython/contrib/ogl/oglcanvas.i +++ b/wxPython/contrib/ogl/oglcanvas.i @@ -59,7 +59,7 @@ public: %addmethods { PyObject* GetShapeList() { wxList* list = self->GetShapeList(); - return wxPy_ConvertList(list, "wxPyShape"); + return wxPy_ConvertShapeList(list, "wxPyShape"); } } @@ -147,6 +147,12 @@ public: void SetDiagram(wxDiagram *diagram); void Snap(double *INOUT, double *INOUT); + + %pragma(python) addtoclass = " + def GetShapeList(self): + return self.GetDiagram().GetShapeList() + " + }; diff --git a/wxPython/contrib/ogl/oglcanvas.py b/wxPython/contrib/ogl/oglcanvas.py index c988e38607..d0126a265a 100644 --- a/wxPython/contrib/ogl/oglcanvas.py +++ b/wxPython/contrib/ogl/oglcanvas.py @@ -209,6 +209,10 @@ class wxPyShapeCanvasPtr(wxScrolledWindowPtr): return val def __repr__(self): return "" % (self.this,) + + def GetShapeList(self): + return self.GetDiagram().GetShapeList() + class wxPyShapeCanvas(wxPyShapeCanvasPtr): def __init__(self,*_args,**_kwargs): self.this = apply(oglcanvasc.new_wxPyShapeCanvas,_args,_kwargs) diff --git a/wxPython/contrib/ogl/oglhelpers.h b/wxPython/contrib/ogl/oglhelpers.h index ef4be52d3d..be345e7ae9 100644 --- a/wxPython/contrib/ogl/oglhelpers.h +++ b/wxPython/contrib/ogl/oglhelpers.h @@ -101,6 +101,7 @@ wxList* wxPy_wxListHelper(PyObject* pyList, char* className); wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList); PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source); +PyObject* wxPy_ConvertShapeList(wxListBase* list, const char* className); diff --git a/wxPython/contrib/ogl/oglshapes.cpp b/wxPython/contrib/ogl/oglshapes.cpp index 2aab38ee81..0335330a47 100644 --- a/wxPython/contrib/ogl/oglshapes.cpp +++ b/wxPython/contrib/ogl/oglshapes.cpp @@ -8147,7 +8147,7 @@ static PyObject *_wrap_wxPyCompositeShape_GetConstraints(PyObject *self, PyObjec static PyObject * wxPyCompositeShape_GetDivisions(wxPyCompositeShape *self) { wxList& list = self->GetDivisions(); - return wxPy_ConvertList(&list, "wxPyDivisionShape"); + return wxPy_ConvertShapeList(&list, "wxPyDivisionShape"); } static PyObject *_wrap_wxPyCompositeShape_GetDivisions(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; diff --git a/wxPython/contrib/ogl/oglshapes.i b/wxPython/contrib/ogl/oglshapes.i index 6f1ebc26b4..57d32dae49 100644 --- a/wxPython/contrib/ogl/oglshapes.i +++ b/wxPython/contrib/ogl/oglshapes.i @@ -408,7 +408,7 @@ public: PyObject* GetDivisions() { wxList& list = self->GetDivisions(); - return wxPy_ConvertList(&list, "wxPyDivisionShape"); + return wxPy_ConvertShapeList(&list, "wxPyDivisionShape"); } } diff --git a/wxPython/contrib/ogl/oglshapes2.cpp b/wxPython/contrib/ogl/oglshapes2.cpp index 96560588ac..641bff8b01 100644 --- a/wxPython/contrib/ogl/oglshapes2.cpp +++ b/wxPython/contrib/ogl/oglshapes2.cpp @@ -4093,7 +4093,7 @@ static PyObject *_wrap_wxPyLineShape_MakeLineControlPoints(PyObject *self, PyObj static PyObject * wxPyLineShape_GetLineControlPoints(wxPyLineShape *self) { wxList* list = self->GetLineControlPoints(); - return wxPy_ConvertList(list, "wxPyControlPoint"); + return wxPy_ConvertShapeList(list, "wxPyControlPoint"); } static PyObject *_wrap_wxPyLineShape_GetLineControlPoints(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; diff --git a/wxPython/contrib/ogl/oglshapes2.i b/wxPython/contrib/ogl/oglshapes2.i index f4e28ee29f..22145b2f78 100644 --- a/wxPython/contrib/ogl/oglshapes2.i +++ b/wxPython/contrib/ogl/oglshapes2.i @@ -221,7 +221,7 @@ public: %addmethods { PyObject* GetLineControlPoints() { wxList* list = self->GetLineControlPoints(); - return wxPy_ConvertList(list, "wxPyControlPoint"); + return wxPy_ConvertShapeList(list, "wxPyControlPoint"); } } -- 2.45.2