]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/src/helpers.cpp
Moved wxPy_ConvertList function from oglhelpers to helpers
[wxWidgets.git] / utils / wxPython / src / helpers.cpp
index c74c75de36903bb17c20f6dd89a224dedaaec99b..547dde92b327b2948a3a5e52c4c604cf582ca804 100644 (file)
@@ -494,9 +494,30 @@ PyObject* wxPyEvent::GetUserData() {
 }
 
 //----------------------------------------------------------------------
+//---------------------------------------------------------------------------
+// Convert a wxList to a Python List
+
+PyObject* wxPy_ConvertList(wxListBase* list, char* className) {
+    PyObject*   pyList;
+    PyObject*   pyObj;
+    wxObject*   wxObj;
+    wxNode*     node = list->First();
+
+    bool doSave = wxPyRestoreThread();
+    pyList = PyList_New(0);
+    while (node) {
+        wxObj = node->Data();
+        pyObj = wxPyConstructObject(wxObj, className);
+        PyList_Append(pyList, pyObj);
+        node = node->Next();
+    }
+    wxPySaveThread(doSave);
+    return pyList;
+}
+
 //----------------------------------------------------------------------
 // Some helper functions for typemaps in my_typemaps.i, so they won't be
-// imcluded in every file...
+// included in every file...
 
 
 HELPEREXPORT byte* byte_LIST_helper(PyObject* source) {