From e7e5fe51c970049643b95a5cbfbda672054d0e43 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 19 Jul 2012 06:47:30 +0000 Subject: [PATCH] Add wxBitmap constructor accepting a list of strings of XPM data git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72145 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/bitmap.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/etg/bitmap.py b/etg/bitmap.py index b7df9156..fbb83e6c 100644 --- a/etg/bitmap.py +++ b/etg/bitmap.py @@ -42,11 +42,42 @@ def run(): tools.removeVirtuals(c) - c.find('wxBitmap').findOverload('(const char *const *bits)').ignore() c.find('wxBitmap.bits').type = 'const char*' c.find('wxBitmap.type').default = 'wxBITMAP_TYPE_ANY' c.find('LoadFile.type').default = 'wxBITMAP_TYPE_ANY' + c.find('wxBitmap').findOverload('(const char *const *bits)').ignore() + + c.addCppCtor('(PyObject* listOfBytes)', + doc="Construct a Bitmap from a list of strings formatted as XPM data.", + body="""\ + wxPyThreadBlocker blocker; + char** cArray = NULL; + int count; + char errMsg[] = "Expected a list of bytes objects."; + + if (!PyList_Check(listOfBytes)) { + PyErr_SetString(PyExc_TypeError, errMsg); + return NULL; + } + count = PyList_Size(listOfBytes); + cArray = new char*[count]; + + for(int x=0; x