X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d559219f4016139d6c52d3b386903821a99c54d2..10534c0bb1fe8716745ff51fea4bf42d4a6fa9f8:/utils/wxPython/src/helpers.cpp diff --git a/utils/wxPython/src/helpers.cpp b/utils/wxPython/src/helpers.cpp index c74c75de36..19acec1d3b 100644 --- a/utils/wxPython/src/helpers.cpp +++ b/utils/wxPython/src/helpers.cpp @@ -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) { @@ -642,10 +663,9 @@ HELPEREXPORT wxBitmap** wxBitmap_LIST_helper(PyObject* source) { } for (int x=0; x