X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4268f79856cbe66b8ad31b86ee183879cede98e3..b4aa9fec6574268008b58ea6b3b3bef126c2d6b3:/wxPython/contrib/dllwidget/dllwidget_.cpp?ds=sidebyside diff --git a/wxPython/contrib/dllwidget/dllwidget_.cpp b/wxPython/contrib/dllwidget/dllwidget_.cpp index 00c32c91c7..9eec61d582 100644 --- a/wxPython/contrib/dllwidget/dllwidget_.cpp +++ b/wxPython/contrib/dllwidget/dllwidget_.cpp @@ -19,6 +19,8 @@ /* Implementation : PYTHON */ #define SWIGPYTHON +#include "Python.h" + #include #include /* Definitions for Windows/Unix exporting */ @@ -36,12 +38,9 @@ # define SWIGEXPORT(a) a #endif -#include "Python.h" - #ifdef __cplusplus extern "C" { #endif - extern void SWIG_MakePtr(char *, void *, char *); extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); extern char *SWIG_GetPtr(char *, void **, char *); @@ -55,7 +54,7 @@ extern PyObject *SWIG_newvarlink(void); #define SWIG_name "dllwidget_c" -#include "export.h" +#include "wxPython.h" #include "dllwidget.h" @@ -85,11 +84,8 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { return target; } -#if PYTHON_API_VERSION >= 1009 - static char* wxStringErrorMsg = "String or Unicode type required"; -#else - static char* wxStringErrorMsg = "String type required"; -#endif + // Put some wx default wxChar* values into wxStrings. + static const wxString wxPyEmptyString(wxT("")); #ifdef __cplusplus extern "C" { #endif @@ -131,8 +127,8 @@ static PyObject *_wrap_new_wxDllWidget(PyObject *self, PyObject *args, PyObject wxDllWidget * _result; wxWindow * _arg0; wxWindowID _arg1 = (wxWindowID ) -1; - wxString * _arg2 = (wxString *) &wxEmptyString; - wxString * _arg3 = (wxString *) &wxEmptyString; + wxString * _arg2 = (wxString *) &wxPyEmptyString; + wxString * _arg3 = (wxString *) &wxPyEmptyString; wxPoint * _arg4 = (wxPoint *) &wxDefaultPosition; wxSize * _arg5 = (wxSize *) &wxDefaultSize; long _arg6 = (long ) 0; @@ -158,41 +154,15 @@ static PyObject *_wrap_new_wxDllWidget(PyObject *self, PyObject *args, PyObject } if (_obj2) { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } if (_obj3) { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj3) && !PyUnicode_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg3 = wxString_in_helper(_obj3); + if (_arg3 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj3, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg3 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg3 = new wxString(PyString_AS_STRING(_obj3), PyString_GET_SIZE(_obj3)); -#endif } if (_obj4) { @@ -208,7 +178,7 @@ static PyObject *_wrap_new_wxDllWidget(PyObject *self, PyObject *args, PyObject } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxDllWidget *)new_wxDllWidget(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,_arg6); + _result = (wxDllWidget *)new_wxDllWidget(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,_arg6); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -250,7 +220,7 @@ static PyObject *_wrap_wxDllWidget_Ok(PyObject *self, PyObject *args, PyObject * } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (bool )wxDllWidget_Ok(_arg0); + _result = (bool )wxDllWidget_Ok(_arg0); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -264,7 +234,7 @@ static PyObject *_wrap_wxDllWidget_SendCommand(PyObject *self, PyObject *args, P int _result; wxDllWidget * _arg0; int _arg1; - wxString * _arg2 = (wxString *) &wxEmptyString; + wxString * _arg2 = (wxString *) &wxPyEmptyString; PyObject * _argo0 = 0; PyObject * _obj2 = 0; char *_kwnames[] = { "self","cmd","param", NULL }; @@ -281,26 +251,13 @@ static PyObject *_wrap_wxDllWidget_SendCommand(PyObject *self, PyObject *args, P } if (_obj2) { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) + _arg2 = wxString_in_helper(_obj2); + if (_arg2 == NULL) return NULL; - _arg2 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj2)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); -#endif } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (int )wxDllWidget_SendCommand(_arg0,_arg1,*_arg2); + _result = (int )wxDllWidget_SendCommand(_arg0,_arg1,*_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -332,7 +289,7 @@ static PyObject *_wrap_wxDllWidget_GetWidgetWindow(PyObject *self, PyObject *arg } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxWindow *)wxDllWidget_GetWidgetWindow(_arg0); + _result = (wxWindow *)wxDllWidget_GetWidgetWindow(_arg0); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -350,12 +307,16 @@ static PyObject *_wrap_wxDllWidget_GetDllExt(PyObject *self, PyObject *args, PyO return NULL; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = new wxString (wxDllWidget::GetDllExt()); + _result = new wxString (wxDllWidget::GetDllExt()); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); +#else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif } { delete _result;