Merged wxPython 2.4.x to the 2.5 branch (Finally!!!)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4,3 +4,35 @@
|
||||
wxTheXmlResource = wxXmlResource_Get()
|
||||
|
||||
wx.wxXmlNodePtr = wxXmlNodePtr
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Create a factory for handling the subclass property of the object tag.
|
||||
|
||||
|
||||
def _my_import(name):
|
||||
mod = __import__(name)
|
||||
components = name.split('.')
|
||||
for comp in components[1:]:
|
||||
mod = getattr(mod, comp)
|
||||
return mod
|
||||
|
||||
|
||||
class wxXmlSubclassFactory_Python(wxXmlSubclassFactory):
|
||||
def __init__(self):
|
||||
wxXmlSubclassFactory.__init__(self)
|
||||
|
||||
def Create(self, className):
|
||||
assert className.find('.') != -1, "Module name must be specified!"
|
||||
mname = className[:className.rfind('.')]
|
||||
cname = className[className.rfind('.')+1:]
|
||||
module = _my_import(mname)
|
||||
klass = getattr(module, cname)
|
||||
inst = klass()
|
||||
return inst
|
||||
|
||||
|
||||
wxXmlResource_AddSubclassFactory(wxXmlSubclassFactory_Python())
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
/* Implementation : PYTHON */
|
||||
|
||||
#define SWIGPYTHON
|
||||
#include "Python.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
/* 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 *);
|
||||
@@ -98,6 +97,16 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
static const wxString wxPyBitmapString(wxT("bitmap"));
|
||||
static const wxString wxPyIconString(wxT("icon"));
|
||||
static const wxString wxPyFontString(wxT("font"));
|
||||
|
||||
class wxPyXmlSubclassFactory : public wxXmlSubclassFactory
|
||||
{
|
||||
public:
|
||||
wxPyXmlSubclassFactory() {}
|
||||
DEC_PYCALLBACK_OBJECT_STRING_pure(Create);
|
||||
PYPRIVATE;
|
||||
};
|
||||
|
||||
IMP_PYCALLBACK_OBJECT_STRING_pure(wxPyXmlSubclassFactory, wxXmlSubclassFactory, Create);
|
||||
// C++ version of Python aware wxXmlResourceHandler, for the pure virtual
|
||||
// callbacks, as well as to make some protected things public so they can
|
||||
// be wrapped.
|
||||
@@ -111,34 +120,6 @@ public:
|
||||
DEC_PYCALLBACK_OBJECT__pure(DoCreateResource);
|
||||
DEC_PYCALLBACK_BOOL_NODE_pure(CanHandle);
|
||||
|
||||
// wxObject* DoCreateResource() {
|
||||
// wxObject* rv = NULL;
|
||||
// wxPyBeginBlockThreads();
|
||||
// if (wxPyCBH_findCallback(m_myInst, "DoCreateResource")) {
|
||||
// PyObject* ro;
|
||||
// ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
|
||||
// if (ro) {
|
||||
// SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p");
|
||||
// Py_DECREF(ro);
|
||||
// }
|
||||
// }
|
||||
// wxPyEndBlockThreads();
|
||||
// return rv;
|
||||
// }
|
||||
|
||||
// bool CanHandle(wxXmlNode* a) {
|
||||
// bool rv=FALSE;
|
||||
// wxPyBeginBlockThreads();
|
||||
// if (wxPyCBH_findCallback(m_myInst, "CanHandle")) {
|
||||
// PyObject* obj = wxPyConstructObject((void*)a, "wxXmlNode", 0);
|
||||
// rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
|
||||
// Py_DECREF(obj);
|
||||
// }
|
||||
// wxPyEndBlockThreads();
|
||||
// return rv;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// accessors for protected members
|
||||
|
||||
@@ -576,6 +557,33 @@ static PyObject *_wrap_wxXmlResource_ClearHandlers(PyObject *self, PyObject *arg
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject *_wrap_wxXmlResource_AddSubclassFactory(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPyXmlSubclassFactory * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "factory", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxXmlResource_AddSubclassFactory",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyXmlSubclassFactory_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlResource_AddSubclassFactory. Expected _wxPyXmlSubclassFactory_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxXmlResource::AddSubclassFactory(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxXmlResource_LoadMenu(_swigobj,_swigarg0) (_swigobj->LoadMenu(_swigarg0))
|
||||
static PyObject *_wrap_wxXmlResource_LoadMenu(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
@@ -1521,6 +1529,99 @@ static PyObject *_wrap_wxXmlResource_GetFlags(PyObject *self, PyObject *args, Py
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxXmlResource_SetFlags(_swigobj,_swigarg0) (_swigobj->SetFlags(_swigarg0))
|
||||
static PyObject *_wrap_wxXmlResource_SetFlags(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxXmlResource * _arg0;
|
||||
int _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self","flags", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxXmlResource_SetFlags",_kwnames,&_argo0,&_arg1))
|
||||
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_SetFlags. Expected _wxXmlResource_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxXmlResource_SetFlags(_arg0,_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define new_wxXmlSubclassFactory() (new wxPyXmlSubclassFactory())
|
||||
static PyObject *_wrap_new_wxXmlSubclassFactory(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPyXmlSubclassFactory * _result;
|
||||
char *_kwnames[] = { NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxXmlSubclassFactory",_kwnames))
|
||||
return NULL;
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxPyXmlSubclassFactory *)new_wxXmlSubclassFactory();
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyXmlSubclassFactory_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxXmlSubclassFactory__setCallbackInfo(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setCallbackInfo(_swigarg0,_swigarg1))
|
||||
static PyObject *_wrap_wxXmlSubclassFactory__setCallbackInfo(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxPyXmlSubclassFactory * _arg0;
|
||||
PyObject * _arg1;
|
||||
PyObject * _arg2;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
char *_kwnames[] = { "self","self","_class", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxXmlSubclassFactory__setCallbackInfo",_kwnames,&_argo0,&_obj1,&_obj2))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyXmlSubclassFactory_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlSubclassFactory__setCallbackInfo. Expected _wxPyXmlSubclassFactory_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = _obj1;
|
||||
}
|
||||
{
|
||||
_arg2 = _obj2;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxXmlSubclassFactory__setCallbackInfo(_arg0,_arg1,_arg2);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define new_wxXmlProperty(_swigarg0,_swigarg1,_swigarg2) (new wxXmlProperty(_swigarg0,_swigarg1,_swigarg2))
|
||||
static PyObject *_wrap_new_wxXmlProperty(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
@@ -1606,7 +1707,7 @@ static PyObject *_wrap_wxXmlProperty_GetName(PyObject *self, PyObject *args, PyO
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -1643,7 +1744,7 @@ static PyObject *_wrap_wxXmlProperty_GetValue(PyObject *self, PyObject *args, Py
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -2260,7 +2361,7 @@ static PyObject *_wrap_wxXmlNode_GetName(PyObject *self, PyObject *args, PyObjec
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -2297,7 +2398,7 @@ static PyObject *_wrap_wxXmlNode_GetContent(PyObject *self, PyObject *args, PyOb
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -2488,7 +2589,7 @@ static PyObject *_wrap_wxXmlNode_GetPropVal(PyObject *self, PyObject *args, PyOb
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -3143,8 +3244,7 @@ static PyObject *_wrap_wxXmlDocument_SaveToStream(PyObject *self, PyObject *args
|
||||
}
|
||||
}
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxOutputStream_p")) {
|
||||
if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxOutputStream_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxXmlDocument_SaveToStream. Expected _wxOutputStream_p.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -3248,7 +3348,7 @@ static PyObject *_wrap_wxXmlDocument_GetVersion(PyObject *self, PyObject *args,
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -3285,7 +3385,7 @@ static PyObject *_wrap_wxXmlDocument_GetFileEncoding(PyObject *self, PyObject *a
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -3443,7 +3543,7 @@ static PyObject *_wrap_wxXmlDocument_GetEncoding(PyObject *self, PyObject *args,
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -3454,6 +3554,51 @@ static PyObject *_wrap_wxXmlDocument_GetEncoding(PyObject *self, PyObject *args,
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void wxXmlDocument_SetEncoding(wxXmlDocument *self,const wxString & enc) {
|
||||
#if wxUSE_UNICODE
|
||||
// do nothing
|
||||
#else
|
||||
self->SetEncoding(enc);
|
||||
#endif
|
||||
}
|
||||
static PyObject *_wrap_wxXmlDocument_SetEncoding(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxXmlDocument * _arg0;
|
||||
wxString * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","enc", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxXmlDocument_SetEncoding",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxXmlDocument_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxXmlDocument_SetEncoding. Expected _wxXmlDocument_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = wxString_in_helper(_obj1);
|
||||
if (_arg1 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
wxXmlDocument_SetEncoding(_arg0,*_arg1);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void *SwigwxPyXmlResourceHandlerTowxObject(void *ptr) {
|
||||
wxPyXmlResourceHandler *src;
|
||||
wxObject *dest;
|
||||
@@ -3714,7 +3859,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetClass(PyObject *self, PyObject *a
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -3920,7 +4065,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetNodeContent(PyObject *self, PyObj
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -4049,7 +4194,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetParamValue(PyObject *self, PyObje
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -4209,7 +4354,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetText(PyObject *self, PyObject *ar
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -4278,7 +4423,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetName(PyObject *self, PyObject *ar
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
@@ -4569,8 +4714,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetBitmap(PyObject *self, PyObject *
|
||||
return NULL;
|
||||
}
|
||||
if (_argo2) {
|
||||
if (_argo2 == Py_None) { _arg2 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArtClient_p")) {
|
||||
if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArtClient_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxXmlResourceHandler_GetBitmap. Expected _wxArtClient_p.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -4629,8 +4773,7 @@ static PyObject *_wrap_wxXmlResourceHandler_GetIcon(PyObject *self, PyObject *ar
|
||||
return NULL;
|
||||
}
|
||||
if (_argo2) {
|
||||
if (_argo2 == Py_None) { _arg2 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArtClient_p")) {
|
||||
if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArtClient_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxXmlResourceHandler_GetIcon. Expected _wxArtClient_p.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -4942,6 +5085,7 @@ static PyMethodDef xrccMethods[] = {
|
||||
{ "wxXmlResourceHandler_CreateResource", (PyCFunction) _wrap_wxXmlResourceHandler_CreateResource, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResourceHandler__setCallbackInfo", (PyCFunction) _wrap_wxXmlResourceHandler__setCallbackInfo, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxXmlResourceHandler", (PyCFunction) _wrap_new_wxXmlResourceHandler, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlDocument_SetEncoding", (PyCFunction) _wrap_wxXmlDocument_SetEncoding, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlDocument_GetEncoding", (PyCFunction) _wrap_wxXmlDocument_GetEncoding, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlDocument_SetFileEncoding", (PyCFunction) _wrap_wxXmlDocument_SetFileEncoding, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlDocument_SetVersion", (PyCFunction) _wrap_wxXmlDocument_SetVersion, METH_VARARGS | METH_KEYWORDS },
|
||||
@@ -4990,6 +5134,9 @@ static PyMethodDef xrccMethods[] = {
|
||||
{ "wxXmlProperty_GetValue", (PyCFunction) _wrap_wxXmlProperty_GetValue, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlProperty_GetName", (PyCFunction) _wrap_wxXmlProperty_GetName, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxXmlProperty", (PyCFunction) _wrap_new_wxXmlProperty, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlSubclassFactory__setCallbackInfo", (PyCFunction) _wrap_wxXmlSubclassFactory__setCallbackInfo, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxXmlSubclassFactory", (PyCFunction) _wrap_new_wxXmlSubclassFactory, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_SetFlags", (PyCFunction) _wrap_wxXmlResource_SetFlags, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_GetFlags", (PyCFunction) _wrap_wxXmlResource_GetFlags, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_Set", (PyCFunction) _wrap_wxXmlResource_Set, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_Get", (PyCFunction) _wrap_wxXmlResource_Get, METH_VARARGS | METH_KEYWORDS },
|
||||
@@ -5011,6 +5158,7 @@ static PyMethodDef xrccMethods[] = {
|
||||
{ "wxXmlResource_LoadMenuBarOnFrame", (PyCFunction) _wrap_wxXmlResource_LoadMenuBarOnFrame, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_LoadMenuBar", (PyCFunction) _wrap_wxXmlResource_LoadMenuBar, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_LoadMenu", (PyCFunction) _wrap_wxXmlResource_LoadMenu, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_AddSubclassFactory", (PyCFunction) _wrap_wxXmlResource_AddSubclassFactory, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_ClearHandlers", (PyCFunction) _wrap_wxXmlResource_ClearHandlers, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_InsertHandler", (PyCFunction) _wrap_wxXmlResource_InsertHandler, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxXmlResource_AddHandler", (PyCFunction) _wrap_wxXmlResource_AddHandler, METH_VARARGS | METH_KEYWORDS },
|
||||
|
@@ -48,6 +48,9 @@
|
||||
static const wxString wxPyIconString(wxT("icon"));
|
||||
static const wxString wxPyFontString(wxT("font"));
|
||||
%}
|
||||
|
||||
class wxPyXmlSubclassFactory;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
enum wxXmlResourceFlags
|
||||
@@ -128,6 +131,12 @@ public:
|
||||
// Removes all handlers
|
||||
void ClearHandlers();
|
||||
|
||||
// Registers subclasses factory for use in XRC. This function is not meant
|
||||
// for public use, please see the comment above wxXmlSubclassFactory
|
||||
// definition.
|
||||
static void AddSubclassFactory(wxPyXmlSubclassFactory *factory);
|
||||
|
||||
|
||||
// Loads menu from resource. Returns NULL on failure.
|
||||
wxMenu *LoadMenu(const wxString& name);
|
||||
|
||||
@@ -199,6 +208,9 @@ public:
|
||||
// Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
|
||||
int GetFlags();
|
||||
|
||||
// Set flags after construction.
|
||||
void SetFlags(int flags) { m_flags = flags; }
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -215,6 +227,31 @@ XMLCTRL = XRCCTRL
|
||||
"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// wxXmlSubclassFactory
|
||||
|
||||
|
||||
%{
|
||||
class wxPyXmlSubclassFactory : public wxXmlSubclassFactory
|
||||
{
|
||||
public:
|
||||
wxPyXmlSubclassFactory() {}
|
||||
DEC_PYCALLBACK_OBJECT_STRING_pure(Create);
|
||||
PYPRIVATE;
|
||||
};
|
||||
|
||||
IMP_PYCALLBACK_OBJECT_STRING_pure(wxPyXmlSubclassFactory, wxXmlSubclassFactory, Create);
|
||||
%}
|
||||
|
||||
|
||||
%name(wxXmlSubclassFactory)class wxPyXmlSubclassFactory {
|
||||
public:
|
||||
wxPyXmlSubclassFactory();
|
||||
|
||||
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxXmlSubclassFactory)"
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// In order to provide wrappers for wxXmlResourceHandler we need to also
|
||||
// provide the classes for representing and parsing XML.
|
||||
@@ -374,6 +411,13 @@ public:
|
||||
return self->GetEncoding();
|
||||
#endif
|
||||
}
|
||||
void SetEncoding(const wxString& enc) {
|
||||
#if wxUSE_UNICODE
|
||||
// do nothing
|
||||
#else
|
||||
self->SetEncoding(enc);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -396,34 +440,6 @@ public:
|
||||
DEC_PYCALLBACK_OBJECT__pure(DoCreateResource);
|
||||
DEC_PYCALLBACK_BOOL_NODE_pure(CanHandle);
|
||||
|
||||
// wxObject* DoCreateResource() {
|
||||
// wxObject* rv = NULL;
|
||||
// wxPyBeginBlockThreads();
|
||||
// if (wxPyCBH_findCallback(m_myInst, "DoCreateResource")) {
|
||||
// PyObject* ro;
|
||||
// ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
|
||||
// if (ro) {
|
||||
// SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p");
|
||||
// Py_DECREF(ro);
|
||||
// }
|
||||
// }
|
||||
// wxPyEndBlockThreads();
|
||||
// return rv;
|
||||
// }
|
||||
|
||||
// bool CanHandle(wxXmlNode* a) {
|
||||
// bool rv=FALSE;
|
||||
// wxPyBeginBlockThreads();
|
||||
// if (wxPyCBH_findCallback(m_myInst, "CanHandle")) {
|
||||
// PyObject* obj = wxPyConstructObject((void*)a, "wxXmlNode", 0);
|
||||
// rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
|
||||
// Py_DECREF(obj);
|
||||
// }
|
||||
// wxPyEndBlockThreads();
|
||||
// return rv;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// accessors for protected members
|
||||
|
||||
|
@@ -56,9 +56,12 @@ class wxXmlResourcePtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self,xrcc=xrcc):
|
||||
if self.thisown == 1 :
|
||||
xrcc.delete_wxXmlResource(self)
|
||||
def __del__(self, delfunc=xrcc.delete_wxXmlResource):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def Load(self, *_args, **_kwargs):
|
||||
val = apply(xrcc.wxXmlResource_Load,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -135,6 +138,9 @@ class wxXmlResourcePtr(wxObjectPtr):
|
||||
def GetFlags(self, *_args, **_kwargs):
|
||||
val = apply(xrcc.wxXmlResource_GetFlags,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetFlags(self, *_args, **_kwargs):
|
||||
val = apply(xrcc.wxXmlResource_SetFlags,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxXmlResource instance at %s>" % (self.this,)
|
||||
class wxXmlResource(wxXmlResourcePtr):
|
||||
@@ -152,6 +158,24 @@ def wxEmptyXmlResource(*_args,**_kwargs):
|
||||
return val
|
||||
|
||||
|
||||
class wxXmlSubclassFactoryPtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||
val = apply(xrcc.wxXmlSubclassFactory__setCallbackInfo,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxXmlSubclassFactory instance at %s>" % (self.this,)
|
||||
class wxXmlSubclassFactory(wxXmlSubclassFactoryPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(xrcc.new_wxXmlSubclassFactory,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setCallbackInfo(self, wxXmlSubclassFactory)
|
||||
|
||||
|
||||
|
||||
|
||||
class wxXmlPropertyPtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
@@ -189,9 +213,12 @@ class wxXmlNodePtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self,xrcc=xrcc):
|
||||
if self.thisown == 1 :
|
||||
xrcc.delete_wxXmlNode(self)
|
||||
def __del__(self, delfunc=xrcc.delete_wxXmlNode):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def AddChild(self, *_args, **_kwargs):
|
||||
val = apply(xrcc.wxXmlNode_AddChild,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -281,9 +308,12 @@ class wxXmlDocumentPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self,xrcc=xrcc):
|
||||
if self.thisown == 1 :
|
||||
xrcc.delete_wxXmlDocument(self)
|
||||
def __del__(self, delfunc=xrcc.delete_wxXmlDocument):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def Load(self, *_args, **_kwargs):
|
||||
val = apply(xrcc.wxXmlDocument_Load,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -321,6 +351,9 @@ class wxXmlDocumentPtr(wxObjectPtr):
|
||||
def GetEncoding(self, *_args, **_kwargs):
|
||||
val = apply(xrcc.wxXmlDocument_GetEncoding,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetEncoding(self, *_args, **_kwargs):
|
||||
val = apply(xrcc.wxXmlDocument_SetEncoding,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxXmlDocument instance at %s>" % (self.this,)
|
||||
class wxXmlDocument(wxXmlDocumentPtr):
|
||||
@@ -474,6 +507,8 @@ class wxXmlResourceHandler(wxXmlResourceHandlerPtr):
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
wxXmlResource_AddSubclassFactory = xrcc.wxXmlResource_AddSubclassFactory
|
||||
|
||||
wxXmlResource_GetXRCID = xrcc.wxXmlResource_GetXRCID
|
||||
|
||||
def wxXmlResource_Get(*_args, **_kwargs):
|
||||
@@ -515,3 +550,35 @@ wxXML_HTML_DOCUMENT_NODE = xrcc.wxXML_HTML_DOCUMENT_NODE
|
||||
wxTheXmlResource = wxXmlResource_Get()
|
||||
|
||||
wx.wxXmlNodePtr = wxXmlNodePtr
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Create a factory for handling the subclass property of the object tag.
|
||||
|
||||
|
||||
def _my_import(name):
|
||||
mod = __import__(name)
|
||||
components = name.split('.')
|
||||
for comp in components[1:]:
|
||||
mod = getattr(mod, comp)
|
||||
return mod
|
||||
|
||||
|
||||
class wxXmlSubclassFactory_Python(wxXmlSubclassFactory):
|
||||
def __init__(self):
|
||||
wxXmlSubclassFactory.__init__(self)
|
||||
|
||||
def Create(self, className):
|
||||
assert className.find('.') != -1, "Module name must be specified!"
|
||||
mname = className[:className.rfind('.')]
|
||||
cname = className[className.rfind('.')+1:]
|
||||
module = _my_import(mname)
|
||||
klass = getattr(module, cname)
|
||||
inst = klass()
|
||||
return inst
|
||||
|
||||
|
||||
wxXmlResource_AddSubclassFactory(wxXmlSubclassFactory_Python())
|
||||
|
||||
|
Reference in New Issue
Block a user