X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/32c988a34d4ce6b7ae079fe235853c495a38a3bc..a81c3c2383f9096ef5e96b708a0f1c1ffe7cc6a8:/wxPython/contrib/xrc/xrc.cpp?ds=inline diff --git a/wxPython/contrib/xrc/xrc.cpp b/wxPython/contrib/xrc/xrc.cpp index fe59e6ea96..175c7a154d 100644 --- a/wxPython/contrib/xrc/xrc.cpp +++ b/wxPython/contrib/xrc/xrc.cpp @@ -84,30 +84,9 @@ 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 is required for parameter"; -#endif #ifdef __cplusplus extern "C" { #endif -static int _wrap_wxTheXmlResource_set(PyObject *val) { - - PyErr_SetString(PyExc_TypeError,"Variable wxTheXmlResource is read-only."); - return 1; -} - -static PyObject *_wrap_wxTheXmlResource_get() { - PyObject * pyobj; - char ptemp[128]; - - SWIG_MakePtr(ptemp, (char *) wxTheXmlResource,"_wxXmlResource_p"); - pyobj = PyString_FromString(ptemp); - return pyobj; -} - static void *SwigwxXmlResourceTowxObject(void *ptr) { wxXmlResource *src; wxObject *dest; @@ -120,20 +99,19 @@ static void *SwigwxXmlResourceTowxObject(void *ptr) { static PyObject *_wrap_new_wxXmlResourceEmpty(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxXmlResource * _result; - bool _arg0 = (bool ) TRUE; - int tempbool0 = (int) TRUE; - char *_kwnames[] = { "use_locale", NULL }; + int _arg0 = (int ) (wxXRC_USE_LOCALE); + char *_kwnames[] = { "flags", NULL }; char _ptemp[128]; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|i:new_wxXmlResourceEmpty",_kwnames,&tempbool0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|i:new_wxXmlResourceEmpty",_kwnames,&_arg0)) return NULL; - _arg0 = (bool ) tempbool0; { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxXmlResource *)new_wxXmlResourceEmpty(_arg0); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxXmlResource *)new_wxXmlResourceEmpty(_arg0); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } if (_result) { SWIG_MakePtr(_ptemp, (char *) _result,"_wxXmlResource_p"); _resultobj = Py_BuildValue("s",_ptemp); @@ -144,8 +122,8 @@ static PyObject *_wrap_new_wxXmlResourceEmpty(PyObject *self, PyObject *args, Py return _resultobj; } -static wxXmlResource *new_wxXmlResource(const wxString *filemask,bool use_locale) { - wxXmlResource* res = new wxXmlResource(*filemask, use_locale); +static wxXmlResource *new_wxXmlResource(const wxString *filemask,int flags) { + wxXmlResource* res = new wxXmlResource(*filemask, flags); res->InitAllHandlers(); return res; } @@ -154,39 +132,25 @@ static PyObject *_wrap_new_wxXmlResource(PyObject *self, PyObject *args, PyObjec PyObject * _resultobj; wxXmlResource * _result; wxString * _arg0; - bool _arg1 = (bool ) TRUE; + int _arg1 = (int ) (wxXRC_USE_LOCALE); PyObject * _obj0 = 0; - int tempbool1 = (int) TRUE; - char *_kwnames[] = { "filemask","use_locale", NULL }; + char *_kwnames[] = { "filemask","flags", NULL }; char _ptemp[128]; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:new_wxXmlResource",_kwnames,&_obj0,&tempbool1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:new_wxXmlResource",_kwnames,&_obj0,&_arg1)) return NULL; { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj0) && !PyUnicode_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg0 = wxString_in_helper(_obj0); + if (_arg0 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj0, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg0 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj0)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg0 = new wxString(PyString_AS_STRING(_obj0), PyString_GET_SIZE(_obj0)); -#endif } - _arg1 = (bool ) tempbool1; { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxXmlResource *)new_wxXmlResource(_arg0,_arg1); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxXmlResource *)new_wxXmlResource(_arg0,_arg1); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } if (_result) { SWIG_MakePtr(_ptemp, (char *) _result,"_wxXmlResource_p"); _resultobj = Py_BuildValue("s",_ptemp); @@ -219,10 +183,11 @@ static PyObject *_wrap_delete_wxXmlResource(PyObject *self, PyObject *args, PyOb } } { - wxPy_BEGIN_ALLOW_THREADS; - delete_wxXmlResource(_arg0); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + delete_wxXmlResource(_arg0); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } Py_INCREF(Py_None); _resultobj = Py_None; return _resultobj; @@ -249,28 +214,16 @@ static PyObject *_wrap_wxXmlResource_Load(PyObject *self, PyObject *args, PyObje } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxXmlResource_Load(_arg0,*_arg1); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxXmlResource_Load(_arg0,*_arg1); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); { if (_obj1) @@ -297,10 +250,11 @@ static PyObject *_wrap_wxXmlResource_InitAllHandlers(PyObject *self, PyObject *a } } { - wxPy_BEGIN_ALLOW_THREADS; - wxXmlResource_InitAllHandlers(_arg0); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxXmlResource_InitAllHandlers(_arg0); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } Py_INCREF(Py_None); _resultobj = Py_None; return _resultobj; @@ -333,10 +287,11 @@ static PyObject *_wrap_wxXmlResource_AddHandler(PyObject *self, PyObject *args, } } { - wxPy_BEGIN_ALLOW_THREADS; - wxXmlResource_AddHandler(_arg0,_arg1); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxXmlResource_AddHandler(_arg0,_arg1); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } Py_INCREF(Py_None); _resultobj = Py_None; return _resultobj; @@ -360,10 +315,11 @@ static PyObject *_wrap_wxXmlResource_ClearHandlers(PyObject *self, PyObject *arg } } { - wxPy_BEGIN_ALLOW_THREADS; - wxXmlResource_ClearHandlers(_arg0); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxXmlResource_ClearHandlers(_arg0); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } Py_INCREF(Py_None); _resultobj = Py_None; return _resultobj; @@ -390,28 +346,16 @@ static PyObject *_wrap_wxXmlResource_LoadMenu(PyObject *self, PyObject *args, Py } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxMenu *)wxXmlResource_LoadMenu(_arg0,*_arg1); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxMenu *)wxXmlResource_LoadMenu(_arg0,*_arg1); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; }{ _resultobj = wxPyMake_wxObject(_result); } { if (_obj1) @@ -441,28 +385,16 @@ static PyObject *_wrap_wxXmlResource_LoadMenuBar(PyObject *self, PyObject *args, } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxMenuBar *)wxXmlResource_LoadMenuBar(_arg0,*_arg1); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxMenuBar *)wxXmlResource_LoadMenuBar(_arg0,*_arg1); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; }{ _resultobj = wxPyMake_wxObject(_result); } { if (_obj1) @@ -501,28 +433,16 @@ static PyObject *_wrap_wxXmlResource_LoadToolBar(PyObject *self, PyObject *args, } } { -#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 } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxToolBar *)wxXmlResource_LoadToolBar(_arg0,_arg1,*_arg2); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxToolBar *)wxXmlResource_LoadToolBar(_arg0,_arg1,*_arg2); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; }{ _resultobj = wxPyMake_wxObject(_result); } { if (_obj2) @@ -562,28 +482,16 @@ static PyObject *_wrap_wxXmlResource_LoadDialog(PyObject *self, PyObject *args, } } { -#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 } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxDialog *)wxXmlResource_LoadDialog(_arg0,_arg1,*_arg2); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxDialog *)wxXmlResource_LoadDialog(_arg0,_arg1,*_arg2); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } if (_result) { SWIG_MakePtr(_ptemp, (char *) _result,"_wxDialog_p"); _resultobj = Py_BuildValue("s",_ptemp); @@ -637,28 +545,16 @@ static PyObject *_wrap_wxXmlResource_LoadOnDialog(PyObject *self, PyObject *args } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj3) && !PyUnicode_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - 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); + _arg3 = wxString_in_helper(_obj3); + if (_arg3 == NULL) return NULL; - } - _arg3 = new wxString(PyString_AS_STRING(_obj3), PyString_GET_SIZE(_obj3)); -#endif } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxXmlResource_LoadOnDialog(_arg0,_arg1,_arg2,*_arg3); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxXmlResource_LoadOnDialog(_arg0,_arg1,_arg2,*_arg3); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); { if (_obj3) @@ -698,28 +594,16 @@ static PyObject *_wrap_wxXmlResource_LoadPanel(PyObject *self, PyObject *args, P } } { -#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 } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (wxPanel *)wxXmlResource_LoadPanel(_arg0,_arg1,*_arg2); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxPanel *)wxXmlResource_LoadPanel(_arg0,_arg1,*_arg2); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } if (_result) { SWIG_MakePtr(_ptemp, (char *) _result,"_wxPanel_p"); _resultobj = Py_BuildValue("s",_ptemp); @@ -773,28 +657,16 @@ static PyObject *_wrap_wxXmlResource_LoadOnPanel(PyObject *self, PyObject *args, } } { -#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 } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxXmlResource_LoadOnPanel(_arg0,_arg1,_arg2,*_arg3); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxXmlResource_LoadOnPanel(_arg0,_arg1,_arg2,*_arg3); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); { if (_obj3) @@ -842,28 +714,16 @@ static PyObject *_wrap_wxXmlResource_LoadFrame(PyObject *self, PyObject *args, P } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj3) && !PyUnicode_Check(_obj3)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - 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); + _arg3 = wxString_in_helper(_obj3); + if (_arg3 == NULL) return NULL; - } - _arg3 = new wxString(PyString_AS_STRING(_obj3), PyString_GET_SIZE(_obj3)); -#endif } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxXmlResource_LoadFrame(_arg0,_arg1,_arg2,*_arg3); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxXmlResource_LoadFrame(_arg0,_arg1,_arg2,*_arg3); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); { if (_obj3) @@ -894,28 +754,16 @@ static PyObject *_wrap_wxXmlResource_LoadBitmap(PyObject *self, PyObject *args, } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxBitmap (wxXmlResource_LoadBitmap(_arg0,*_arg1)); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxBitmap (wxXmlResource_LoadBitmap(_arg0,*_arg1)); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } SWIG_MakePtr(_ptemp, (void *) _result,"_wxBitmap_p"); _resultobj = Py_BuildValue("s",_ptemp); { @@ -947,28 +795,16 @@ static PyObject *_wrap_wxXmlResource_LoadIcon(PyObject *self, PyObject *args, Py } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } { - wxPy_BEGIN_ALLOW_THREADS; - _result = new wxIcon (wxXmlResource_LoadIcon(_arg0,*_arg1)); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxIcon (wxXmlResource_LoadIcon(_arg0,*_arg1)); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } SWIG_MakePtr(_ptemp, (void *) _result,"_wxIcon_p"); _resultobj = Py_BuildValue("s",_ptemp); { @@ -1003,22 +839,9 @@ static PyObject *_wrap_wxXmlResource_AttachUnknownControl(PyObject *self, PyObje } } { -#if PYTHON_API_VERSION >= 1009 - char* tmpPtr; int tmpSize; - if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) return NULL; - } - if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) - return NULL; - _arg1 = new wxString(tmpPtr, tmpSize); -#else - if (!PyString_Check(_obj1)) { - PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); - return NULL; - } - _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); -#endif } if (_argo2) { if (_argo2 == Py_None) { _arg2 = NULL; } @@ -1035,10 +858,11 @@ static PyObject *_wrap_wxXmlResource_AttachUnknownControl(PyObject *self, PyObje } } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (bool )wxXmlResource_AttachUnknownControl(_arg0,*_arg1,_arg2,_arg3); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxXmlResource_AttachUnknownControl(_arg0,*_arg1,_arg2,_arg3); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); { if (_obj1) @@ -1047,21 +871,32 @@ static PyObject *_wrap_wxXmlResource_AttachUnknownControl(PyObject *self, PyObje return _resultobj; } -static PyObject *_wrap_wxXmlResource_GetXMLID(PyObject *self, PyObject *args, PyObject *kwargs) { +static PyObject *_wrap_wxXmlResource_GetXRCID(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; int _result; - char * _arg0; + wxString * _arg0; + PyObject * _obj0 = 0; char *_kwnames[] = { "str_id", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"s:wxXmlResource_GetXMLID",_kwnames,&_arg0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxXmlResource_GetXRCID",_kwnames,&_obj0)) return NULL; { - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxXmlResource::GetXMLID(_arg0); + _arg0 = wxString_in_helper(_obj0); + if (_arg0 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxXmlResource::GetXRCID(*_arg0); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); +{ + if (_obj0) + delete _arg0; +} return _resultobj; } @@ -1084,10 +919,11 @@ static PyObject *_wrap_wxXmlResource_GetVersion(PyObject *self, PyObject *args, } } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (long )wxXmlResource_GetVersion(_arg0); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (long )wxXmlResource_GetVersion(_arg0); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("l",_result); return _resultobj; } @@ -1115,18 +951,80 @@ static PyObject *_wrap_wxXmlResource_CompareVersion(PyObject *self, PyObject *ar } } { - wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxXmlResource_CompareVersion(_arg0,_arg1,_arg2,_arg3,_arg4); + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (int )wxXmlResource_CompareVersion(_arg0,_arg1,_arg2,_arg3,_arg4); - wxPy_END_ALLOW_THREADS; + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; } _resultobj = Py_BuildValue("i",_result); return _resultobj; } +static PyObject *_wrap_wxXmlResource_Get(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxXmlResource * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxXmlResource_Get",_kwnames)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxXmlResource *)wxXmlResource::Get(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxXmlResource_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +static PyObject *_wrap_wxXmlResource_Set(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxXmlResource * _result; + wxXmlResource * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "res", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxXmlResource_Set",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxXmlResource_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlResource_Set. Expected _wxXmlResource_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxXmlResource *)wxXmlResource::Set(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxXmlResource_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + static PyMethodDef xrccMethods[] = { + { "wxXmlResource_Set", (PyCFunction) _wrap_wxXmlResource_Set, METH_VARARGS | METH_KEYWORDS }, + { "wxXmlResource_Get", (PyCFunction) _wrap_wxXmlResource_Get, METH_VARARGS | METH_KEYWORDS }, { "wxXmlResource_CompareVersion", (PyCFunction) _wrap_wxXmlResource_CompareVersion, METH_VARARGS | METH_KEYWORDS }, { "wxXmlResource_GetVersion", (PyCFunction) _wrap_wxXmlResource_GetVersion, METH_VARARGS | METH_KEYWORDS }, - { "wxXmlResource_GetXMLID", (PyCFunction) _wrap_wxXmlResource_GetXMLID, METH_VARARGS | METH_KEYWORDS }, + { "wxXmlResource_GetXRCID", (PyCFunction) _wrap_wxXmlResource_GetXRCID, METH_VARARGS | METH_KEYWORDS }, { "wxXmlResource_AttachUnknownControl", (PyCFunction) _wrap_wxXmlResource_AttachUnknownControl, METH_VARARGS | METH_KEYWORDS }, { "wxXmlResource_LoadIcon", (PyCFunction) _wrap_wxXmlResource_LoadIcon, METH_VARARGS | METH_KEYWORDS }, { "wxXmlResource_LoadBitmap", (PyCFunction) _wrap_wxXmlResource_LoadBitmap, METH_VARARGS | METH_KEYWORDS }, @@ -1167,8 +1065,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_byte","_unsigned_char",0}, { "_long","_unsigned_long",0}, { "_long","_signed_long",0}, - { "_class_wxObject","_class_wxXmlResource",SwigwxXmlResourceTowxObject}, - { "_class_wxObject","_wxXmlResource",SwigwxXmlResourceTowxObject}, { "_size_t","_wxCoord",0}, { "_size_t","_wxPrintQuality",0}, { "_size_t","_time_t",0}, @@ -1205,7 +1101,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_unsigned_short","_wxDateTime_t",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, - { "_wxObject","_class_wxXmlResource",SwigwxXmlResourceTowxObject}, { "_wxObject","_wxXmlResource",SwigwxXmlResourceTowxObject}, { "_signed_short","_WXTYPE",0}, { "_signed_short","_short",0}, @@ -1269,16 +1164,15 @@ SWIGEXPORT(void) initxrcc() { SWIG_globals = SWIG_newvarlink(); m = Py_InitModule("xrcc", xrccMethods); d = PyModule_GetDict(m); - PyDict_SetItemString(d,"cvar", SWIG_globals); - SWIG_addvarlink(SWIG_globals,"wxTheXmlResource",_wrap_wxTheXmlResource_get, _wrap_wxTheXmlResource_set); + PyDict_SetItemString(d,"wxXRC_USE_LOCALE", PyInt_FromLong((long) wxXRC_USE_LOCALE)); + PyDict_SetItemString(d,"wxXRC_NO_SUBCLASSING", PyInt_FromLong((long) wxXRC_NO_SUBCLASSING)); wxClassInfo::CleanUpClasses(); wxClassInfo::InitializeClasses(); - wxXmlInitXmlModule(); wxXmlInitResourceModule(); - wxTheXmlResource->InitAllHandlers(); + wxXmlResource::Get()->InitAllHandlers(); { int i;