}
//----------------------------------------------------------------------
+//---------------------------------------------------------------------------
+// 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) {
}
for (int x=0; x<count; x++) {
PyObject* o = PyList_GetItem(source, x);
- if (PyString_Check(o)) {
- char* st = PyString_AsString(o);
+ if (PyInstance_Check(o)) {
wxBitmap* pt;
- if (SWIG_GetPtr(st,(void **) &pt,"_wxBitmap_p")) {
+ if (SWIG_GetPtrObj(o, (void **) &pt,"_wxBitmap_p")) {
PyErr_SetString(PyExc_TypeError,"Expected _wxBitmap_p.");
return NULL;
}
}
for (int x=0; x<count; x++) {
PyObject* o = PyList_GetItem(source, x);
- if (PyString_Check(o)) {
- char* st = PyString_AsString(o);
+ if (PyInstance_Check(o)) {
wxAcceleratorEntry* ae;
- if (SWIG_GetPtr(st,(void **) &ae,"_wxAcceleratorEntry_p")) {
+ if (SWIG_GetPtrObj(o, (void **) &ae,"_wxAcceleratorEntry_p")) {
PyErr_SetString(PyExc_TypeError,"Expected _wxAcceleratorEntry_p.");
return NULL;
}