]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed GetShapeList and similar methods to use OOR.
authorRobin Dunn <robin@alldunn.com>
Thu, 11 Apr 2002 23:12:02 +0000 (23:12 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 11 Apr 2002 23:12:02 +0000 (23:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
wxPython/contrib/ogl/ogl.cpp
wxPython/contrib/ogl/ogl.i
wxPython/contrib/ogl/oglbasic.cpp
wxPython/contrib/ogl/oglbasic.i
wxPython/contrib/ogl/oglcanvas.cpp
wxPython/contrib/ogl/oglcanvas.i
wxPython/contrib/ogl/oglcanvas.py
wxPython/contrib/ogl/oglhelpers.h
wxPython/contrib/ogl/oglshapes.cpp
wxPython/contrib/ogl/oglshapes.i
wxPython/contrib/ogl/oglshapes2.cpp
wxPython/contrib/ogl/oglshapes2.i

index 3c74a41f61012dae2df035a54d413111a3e59148..abd1f2f04e1caf52a4dc1bb251fdab9541e1c5d4 100644 (file)
@@ -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;
+}
 
 
 //---------------------------------------------------------------------------
index dfa1a664a29c7dadd325b65250a2816cce63d936..0d66d6528229743e2c7931b81aad69206d9422b5 100644 (file)
@@ -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;
+}
 
 
 //---------------------------------------------------------------------------
index c0bc910213d854833d20d66f649601dcf077d0f8..7bc2a3787c58d818e935fc1c2d15fedad5e83526 100644 (file)
@@ -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;
index 23380890165032b070978e1db7ccda8f6180f6f5..8fd19b783b224ae11a59aba97b20c53429b57532 100644 (file)
@@ -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");
         }
     }
 
index d79dfa4789ec4022185a8eb4d1fb589b581387d6..a3feab52c1c05a9270b42557e41bd1440041937c 100644 (file)
@@ -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;
index 38507e443f7d64c355a75e4eeb4106aa265ab04e..a2dd8f59b8d08ce87fe51c7f7e846075d6cc6f8d 100644 (file)
@@ -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()
+    "
+
 };
 
 
index c988e3860710f4cf5ccd1788086c8700b0e76157..d0126a265af0399b8e5c08ea9cff4297c1c18ae4 100644 (file)
@@ -209,6 +209,10 @@ class wxPyShapeCanvasPtr(wxScrolledWindowPtr):
         return val
     def __repr__(self):
         return "<C wxPyShapeCanvas instance at %s>" % (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)
index ef4be52d3d0ee7e755c429241758c4ed8f480f65..be345e7ae92fbe42edb7c7a17d20ed1fa63f3285 100644 (file)
 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);
 
 
 
index 2aab38ee816c5cb32fb5700ec443c903ed5d1f0c..0335330a47f31be00eb73059764b112a418c6719 100644 (file)
@@ -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;
index 6f1ebc26b4c7891cd252e372e9fb1146206a73ed..57d32dae4976c9b4907dbef461b8b0f4ad221dc1 100644 (file)
@@ -408,7 +408,7 @@ public:
 
         PyObject* GetDivisions() {
             wxList& list = self->GetDivisions();
-            return wxPy_ConvertList(&list, "wxPyDivisionShape");
+            return wxPy_ConvertShapeList(&list, "wxPyDivisionShape");
         }
     }
 
index 96560588accb73573c6b5ccb62f44e9673d35737..641bff8b01f08591815a4c4e61648d64b2601b43 100644 (file)
@@ -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;
index f4e28ee29fe05451b9cc0d9fb5795ef610cfa65b..22145b2f78d80fdeaa63a69c803e0845b5aea5a2 100644 (file)
@@ -221,7 +221,7 @@ public:
     %addmethods {
         PyObject* GetLineControlPoints() {
             wxList* list = self->GetLineControlPoints();
-            return wxPy_ConvertList(list, "wxPyControlPoint");
+            return wxPy_ConvertShapeList(list, "wxPyControlPoint");
         }
     }