SWIGged updates for wxGTK

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-04-08 21:34:42 +00:00
parent db0ff83efb
commit 87439dd8ae
13 changed files with 330 additions and 55 deletions

View File

@@ -519,8 +519,23 @@ public:
wxPyConstructObject((void*)&dc, "wxDC", 0),
row, col));
if (ro) {
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p"))
const char* errmsg = "GetBestSize should return a 2-tuple of integers or a wxSize object.";
if (!SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) {
rval = *ptr;
}
else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {
PyObject* o1 = PySequence_GetItem(ro, 0);
PyObject* o2 = PySequence_GetItem(ro, 1);
if (PyNumber_Check(o1) && PyNumber_Check(o2))
rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2));
else
PyErr_SetString(PyExc_TypeError, errmsg);
Py_DECREF(o1);
Py_DECREF(o2);
}
else {
PyErr_SetString(PyExc_TypeError, errmsg);
}
Py_DECREF(ro);
}
}