From 49df1f5269f90cc58f724c95265e4843b32c3a25 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sun, 17 Mar 2002 00:20:45 +0000 Subject: [PATCH] Newly SWIGged sources for wxGTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/gtk/gdi.cpp | 2 +- wxPython/src/gtk/grid.cpp | 87 +++++++++++++------------------- wxPython/src/gtk/html.cpp | 6 +-- wxPython/src/gtk/mdi.cpp | 8 +++ wxPython/src/gtk/mdi.py | 8 +++ wxPython/src/gtk/misc2.cpp | 96 +++++++++++++++++++++++++++++++++--- wxPython/src/gtk/misc2.py | 4 ++ wxPython/src/gtk/streams.cpp | 68 +++++++++---------------- wxPython/src/gtk/windows.cpp | 87 +++++++++++++++++++++++++++----- wxPython/src/gtk/windows.py | 7 +++ wxPython/src/gtk/wx.cpp | 14 +++++- wxPython/src/gtk/wx.py | 11 ++++- 12 files changed, 272 insertions(+), 126 deletions(-) diff --git a/wxPython/src/gtk/gdi.cpp b/wxPython/src/gtk/gdi.cpp index f2a36eee02..50fcc9d758 100644 --- a/wxPython/src/gtk/gdi.cpp +++ b/wxPython/src/gtk/gdi.cpp @@ -4731,7 +4731,7 @@ static void wxColourDatabase_Append(wxColourDatabase *self,const wxString & nam wxString cName = name; cName.MakeUpper(); wxString cName2 = cName; - if ( !cName2.Replace("GRAY", "GREY") ) + if ( !cName2.Replace(wxT("GRAY"), wxT("GREY")) ) cName2.clear(); wxNode *node = self->First(); diff --git a/wxPython/src/gtk/grid.cpp b/wxPython/src/gtk/grid.cpp index 3b59ce1521..6c30192a39 100644 --- a/wxPython/src/gtk/grid.cpp +++ b/wxPython/src/gtk/grid.cpp @@ -173,50 +173,46 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { } -// TODO: unicode fix #define PYCALLBACK_STRING_INTINT_pure(CBNAME) \ wxString CBNAME(int a, int b) { \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ wxString rval; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ if (ro) { \ - PyObject* str = PyObject_Str(ro); \ - rval = PyString_AsString(str); \ - Py_DECREF(ro); Py_DECREF(str); \ + rval = Py2wxString(ro); \ + Py_DECREF(ro); \ } \ } \ - wxPyEndBlockThreads(); \ + wxPyEndBlockThreads(); \ return rval; \ } -// TODO: unicode fix #define PYCALLBACK__INTINTSTRING_pure(CBNAME) \ void CBNAME(int a, int b, const wxString& c) { \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ - wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\ - wxPyEndBlockThreads(); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,wx2PyString(c)));\ + wxPyEndBlockThreads(); \ } -// TODO: unicode fix + #define PYCALLBACK_STRING_INTINT(PCLASS, CBNAME) \ wxString CBNAME(int a, int b) { \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ wxString rval; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",a,b)); \ if (ro) { \ - PyObject* str = PyObject_Str(ro); \ - rval = PyString_AsString(str); \ - Py_DECREF(ro); Py_DECREF(str); \ + rval = Py2wxString(ro); \ + Py_DECREF(ro); \ } \ } \ - wxPyEndBlockThreads(); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a, b); \ return rval; \ @@ -226,15 +222,14 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { } -// TODO: unicode fix #define PYCALLBACK_BOOL_INTINTSTRING(PCLASS, CBNAME) \ bool CBNAME(int a, int b, const wxString& c) { \ bool rval = 0; \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ - rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)", a,b,c.c_str()));\ - wxPyEndBlockThreads(); \ + rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)", a,b,wx2PyString(c)));\ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a,b,c); \ return rval; \ @@ -359,22 +354,20 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { } -// TODO: unicode fix #define PYCALLBACK_STRING_INT(PCLASS, CBNAME) \ wxString CBNAME(int a) { \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ wxString rval; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \ if (ro) { \ - PyObject* str = PyObject_Str(ro); \ - rval = PyString_AsString(str); \ - Py_DECREF(ro); Py_DECREF(str); \ + rval = Py2wxString(ro); \ + Py_DECREF(ro); \ } \ } \ - wxPyEndBlockThreads(); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ @@ -384,14 +377,13 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { } -// TODO: unicode fix #define PYCALLBACK__INTSTRING(PCLASS, CBNAME) \ void CBNAME(int a, const wxString& c) { \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ - wxPyCBH_callCallback(m_myInst, Py_BuildValue("(is)", a,c.c_str())); \ - wxPyEndBlockThreads(); \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iO)", a, wx2PyString(c))); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a,c); \ } \ @@ -406,10 +398,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { bool CBNAME() { \ bool rval = 0; \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ - wxPyEndBlockThreads(); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ @@ -423,10 +415,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { #define PYCALLBACK__SIZETINT(PCLASS, CBNAME) \ void CBNAME(size_t a, int b) { \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)", a,b)); \ - wxPyEndBlockThreads(); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a,b); \ } \ @@ -440,10 +432,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { #define PYCALLBACK__INTINTLONG(PCLASS, CBNAME) \ void CBNAME(int a, int b, long c) { \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ - wxPyEndBlockThreads(); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a,b,c); \ } \ @@ -457,10 +449,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { #define PYCALLBACK__INTINTDOUBLE(PCLASS, CBNAME) \ void CBNAME(int a, int b, double c) { \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iif)", a,b,c)); \ - wxPyEndBlockThreads(); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a,b,c); \ } \ @@ -473,10 +465,10 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { #define PYCALLBACK__INTINTBOOL(PCLASS, CBNAME) \ void CBNAME(int a, int b, bool c) { \ bool found; \ - wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c)); \ - wxPyEndBlockThreads(); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a,b,c); \ } \ @@ -724,15 +716,8 @@ public: PyObject* ro; ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ii)",row,col)); if (ro) { -#if wxUSE_UNICODE - PyObject* str = PyObject_Unicode(ro); - rval = PyUnicode_AS_UNICODE(str); -#else - PyObject* str = PyObject_Str(ro); - rval = PyString_AsString(str); -#endif + rval = Py2wxString(ro); Py_DECREF(ro); - Py_DECREF(str); } } wxPyEndBlockThreads(); @@ -742,11 +727,7 @@ public: void SetValue(int row, int col, const wxString& val) { wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetValue")) { -#if wxUSE_UNICODE - wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiu)",row,col,val.c_str())); -#else - wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",row,col,val.c_str())); -#endif + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",row,col,wx2PyString(val))); } wxPyEndBlockThreads(); } diff --git a/wxPython/src/gtk/html.cpp b/wxPython/src/gtk/html.cpp index 6923dd81fc..f802282cec 100644 --- a/wxPython/src/gtk/html.cpp +++ b/wxPython/src/gtk/html.cpp @@ -252,15 +252,13 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type, wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "OnOpeningURL"))) { PyObject* ro; - ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(is)", type, url.c_str())); + ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)", type, wx2PyString(url))); if (PyString_Check(ro) #if PYTHON_API_VERSION >= 1009 || PyUnicode_Check(ro) #endif ) { - PyObject* str = PyObject_Str(ro); - *redirect = PyString_AsString(str); - Py_DECREF(str); + *redirect = Py2wxString(ro); rval = wxHTML_REDIRECT; } else { diff --git a/wxPython/src/gtk/mdi.cpp b/wxPython/src/gtk/mdi.cpp index ab11a398c3..d625e02355 100644 --- a/wxPython/src/gtk/mdi.cpp +++ b/wxPython/src/gtk/mdi.cpp @@ -1073,6 +1073,14 @@ SWIGEXPORT(void) initmdic() { SWIG_globals = SWIG_newvarlink(); m = Py_InitModule("mdic", mdicMethods); d = PyModule_GetDict(m); + PyDict_SetItemString(d,"IDM_WINDOWTILE", PyInt_FromLong((long) 4001)); + PyDict_SetItemString(d,"IDM_WINDOWTILEHOR", PyInt_FromLong((long) 4001)); + PyDict_SetItemString(d,"IDM_WINDOWCASCADE", PyInt_FromLong((long) 4002)); + PyDict_SetItemString(d,"IDM_WINDOWICONS", PyInt_FromLong((long) 4003)); + PyDict_SetItemString(d,"IDM_WINDOWNEXT", PyInt_FromLong((long) 4004)); + PyDict_SetItemString(d,"IDM_WINDOWTILEVERT", PyInt_FromLong((long) 4005)); + PyDict_SetItemString(d,"wxFIRST_MDI_CHILD", PyInt_FromLong((long) 4100)); + PyDict_SetItemString(d,"wxLAST_MDI_CHILD", PyInt_FromLong((long) 4600)); { int i; for (i = 0; _swig_mapping[i].n1; i++) diff --git a/wxPython/src/gtk/mdi.py b/wxPython/src/gtk/mdi.py index 15ae5c30fb..b08d696d40 100644 --- a/wxPython/src/gtk/mdi.py +++ b/wxPython/src/gtk/mdi.py @@ -130,3 +130,11 @@ def wxPreMDIClientWindow(*_args,**_kwargs): #-------------- VARIABLE WRAPPERS ------------------ +IDM_WINDOWTILE = mdic.IDM_WINDOWTILE +IDM_WINDOWTILEHOR = mdic.IDM_WINDOWTILEHOR +IDM_WINDOWCASCADE = mdic.IDM_WINDOWCASCADE +IDM_WINDOWICONS = mdic.IDM_WINDOWICONS +IDM_WINDOWNEXT = mdic.IDM_WINDOWNEXT +IDM_WINDOWTILEVERT = mdic.IDM_WINDOWTILEVERT +wxFIRST_MDI_CHILD = mdic.wxFIRST_MDI_CHILD +wxLAST_MDI_CHILD = mdic.wxLAST_MDI_CHILD diff --git a/wxPython/src/gtk/misc2.cpp b/wxPython/src/gtk/misc2.cpp index 24fbfd690f..51803c7610 100644 --- a/wxPython/src/gtk/misc2.cpp +++ b/wxPython/src/gtk/misc2.cpp @@ -156,7 +156,8 @@ public: bool found; wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) - wxPyCBH_callCallback(m_myInst, Py_BuildValue("(isi)", level, szString, t)); // TODO: unicode fix + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, + wx2PyString(szString), t)); wxPyEndBlockThreads(); if (! found) wxLog::DoLog(level, szString, t); @@ -166,7 +167,8 @@ public: bool found; wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) - wxPyCBH_callCallback(m_myInst, Py_BuildValue("(si)", szString, t)); // TODO: unicode fix + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", + wx2PyString(szString), t)); wxPyEndBlockThreads(); if (! found) wxLog::DoLogString(szString, t); @@ -287,11 +289,11 @@ extern "C" { static PyObject *_wrap_wxFileSelector(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxString * _result; - char * _arg0 = (char *) wxFileSelectorPromptStr; - char * _arg1 = (char *) NULL; - char * _arg2 = (char *) NULL; - char * _arg3 = (char *) NULL; - char * _arg4 = (char *) wxFileSelectorDefaultWildcardStr; + wxChar * _arg0 = (wxChar *) wxFileSelectorPromptStr; + wxChar * _arg1 = (wxChar *) NULL; + wxChar * _arg2 = (wxChar *) NULL; + wxChar * _arg3 = (wxChar *) NULL; + wxChar * _arg4 = (wxChar *) wxFileSelectorDefaultWildcardStr; int _arg5 = (int ) 0; wxWindow * _arg6 = (wxWindow *) NULL; int _arg7 = (int ) -1; @@ -328,6 +330,84 @@ static PyObject *_wrap_wxFileSelector(PyObject *self, PyObject *args, PyObject * return _resultobj; } +static PyObject *_wrap_wxLoadFileSelector(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxChar * _arg0; + wxChar * _arg1; + wxChar * _arg2 = (wxChar *) NULL; + wxWindow * _arg3 = (wxWindow *) NULL; + PyObject * _argo3 = 0; + char *_kwnames[] = { "what","extension","default_name","parent", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"ss|sO:wxLoadFileSelector",_kwnames,&_arg0,&_arg1,&_arg2,&_argo3)) + return NULL; + if (_argo3) { + if (_argo3 == Py_None) { _arg3 = NULL; } + else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxLoadFileSelector. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxString (wxLoadFileSelector(_arg0,_arg1,_arg2,_arg3)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif +} +{ + delete _result; +} + return _resultobj; +} + +static PyObject *_wrap_wxSaveFileSelector(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxChar * _arg0; + wxChar * _arg1; + wxChar * _arg2 = (wxChar *) NULL; + wxWindow * _arg3 = (wxWindow *) NULL; + PyObject * _argo3 = 0; + char *_kwnames[] = { "what","extension","default_name","parent", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"ss|sO:wxSaveFileSelector",_kwnames,&_arg0,&_arg1,&_arg2,&_argo3)) + return NULL; + if (_argo3) { + if (_argo3 == Py_None) { _arg3 = NULL; } + else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxSaveFileSelector. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxString (wxSaveFileSelector(_arg0,_arg1,_arg2,_arg3)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); +#else + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif +} +{ + delete _result; +} + return _resultobj; +} + static PyObject *_wrap_wxGetTextFromUser(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxString * _result; @@ -10025,6 +10105,8 @@ static PyMethodDef misc2cMethods[] = { { "wxGetSingleChoice", (PyCFunction) _wrap_wxGetSingleChoice, METH_VARARGS | METH_KEYWORDS }, { "wxGetPasswordFromUser", (PyCFunction) _wrap_wxGetPasswordFromUser, METH_VARARGS | METH_KEYWORDS }, { "wxGetTextFromUser", (PyCFunction) _wrap_wxGetTextFromUser, METH_VARARGS | METH_KEYWORDS }, + { "wxSaveFileSelector", (PyCFunction) _wrap_wxSaveFileSelector, METH_VARARGS | METH_KEYWORDS }, + { "wxLoadFileSelector", (PyCFunction) _wrap_wxLoadFileSelector, METH_VARARGS | METH_KEYWORDS }, { "wxFileSelector", (PyCFunction) _wrap_wxFileSelector, METH_VARARGS | METH_KEYWORDS }, { NULL, NULL } }; diff --git a/wxPython/src/gtk/misc2.py b/wxPython/src/gtk/misc2.py index ca7c61f44d..7e1214c397 100644 --- a/wxPython/src/gtk/misc2.py +++ b/wxPython/src/gtk/misc2.py @@ -993,6 +993,10 @@ class wxFileHistory(wxFileHistoryPtr): wxFileSelector = misc2c.wxFileSelector +wxLoadFileSelector = misc2c.wxLoadFileSelector + +wxSaveFileSelector = misc2c.wxSaveFileSelector + wxGetTextFromUser = misc2c.wxGetTextFromUser wxGetPasswordFromUser = misc2c.wxGetPasswordFromUser diff --git a/wxPython/src/gtk/streams.cpp b/wxPython/src/gtk/streams.cpp index 572ae04e3c..ac2708efe7 100644 --- a/wxPython/src/gtk/streams.cpp +++ b/wxPython/src/gtk/streams.cpp @@ -214,7 +214,7 @@ static PyObject *_wrap_wxInputStream_eof(PyObject *self, PyObject *args, PyObjec #define wxInputStream_read(_swigobj,_swigarg0) (_swigobj->read(_swigarg0)) static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxString * _result; + PyObject * _result; wxPyInputStream * _arg0; int _arg1 = (int ) -1; PyObject * _argo0 = 0; @@ -232,16 +232,12 @@ static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObje } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxString *)wxInputStream_read(_arg0,_arg1); + _result = (PyObject *)wxInputStream_read(_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ -#if wxUSE_UNICODE - _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); -#else - _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); -#endif + _resultobj = _result; } return _resultobj; } @@ -249,7 +245,7 @@ static PyObject *_wrap_wxInputStream_read(PyObject *self, PyObject *args, PyObje #define wxInputStream_readline(_swigobj,_swigarg0) (_swigobj->readline(_swigarg0)) static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxString * _result; + PyObject * _result; wxPyInputStream * _arg0; int _arg1 = (int ) -1; PyObject * _argo0 = 0; @@ -267,16 +263,12 @@ static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, Py } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxString *)wxInputStream_readline(_arg0,_arg1); + _result = (PyObject *)wxInputStream_readline(_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ -#if wxUSE_UNICODE - _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); -#else - _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); -#endif + _resultobj = _result; } return _resultobj; } @@ -284,7 +276,7 @@ static PyObject *_wrap_wxInputStream_readline(PyObject *self, PyObject *args, Py #define wxInputStream_readlines(_swigobj,_swigarg0) (_swigobj->readlines(_swigarg0)) static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxStringPtrList * _result; + PyObject * _result; wxPyInputStream * _arg0; int _arg1 = (int ) -1; PyObject * _argo0 = 0; @@ -302,28 +294,12 @@ static PyObject *_wrap_wxInputStream_readlines(PyObject *self, PyObject *args, P } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxStringPtrList *)wxInputStream_readlines(_arg0,_arg1); + _result = (PyObject *)wxInputStream_readlines(_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; }{ - if (_result) { - _resultobj = PyList_New(_result->GetCount()); - wxStringPtrList::Node *node = _result->GetFirst(); - for (int i=0; node; i++) { - wxString *s = node->GetData(); -#if wxUSE_UNICODE - PyList_SetItem(_resultobj, i, PyUnicode_FromUnicode(s->c_str(), s->Len())); -#else - PyList_SetItem(_resultobj, i, PyString_FromStringAndSize(s->c_str(), s->Len())); -#endif - node = node->GetNext(); - delete s; - } - delete _result; - } - else - _resultobj=0; + _resultobj = _result; } return _resultobj; } @@ -386,16 +362,24 @@ static PyObject *_wrap_wxInputStream_tell(PyObject *self, PyObject *args, PyObje return _resultobj; } -static void wxOutputStream_write(wxOutputStream *self,const wxString & str) { - self->Write(str.c_str(), str.Length()); +static void wxOutputStream_write(wxOutputStream *self,PyObject * obj) { + // We use only strings for the streams, not unicode + PyObject* str = PyObject_Str(obj); + if (! str) { + PyErr_SetString(PyExc_TypeError, "Unable to convert to string"); + return; + } + self->Write(PyString_AS_STRING(str), + PyString_GET_SIZE(str)); + Py_DECREF(str); } static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxOutputStream * _arg0; - wxString * _arg1; + PyObject * _arg1; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","str", NULL }; + char *_kwnames[] = { "self","obj", NULL }; self = self; if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxOutputStream_write",_kwnames,&_argo0,&_obj1)) @@ -408,22 +392,16 @@ static PyObject *_wrap_wxOutputStream_write(PyObject *self, PyObject *args, PyOb } } { - _arg1 = wxString_in_helper(_obj1); - if (_arg1 == NULL) - return NULL; + _arg1 = _obj1; } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxOutputStream_write(_arg0,*_arg1); + wxOutputStream_write(_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; } Py_INCREF(Py_None); _resultobj = Py_None; -{ - if (_obj1) - delete _arg1; -} return _resultobj; } diff --git a/wxPython/src/gtk/windows.cpp b/wxPython/src/gtk/windows.cpp index fc0c77339b..393513dacf 100644 --- a/wxPython/src/gtk/windows.cpp +++ b/wxPython/src/gtk/windows.cpp @@ -5062,17 +5062,19 @@ static PyObject *_wrap_wxWindow_GetToolTip(PyObject *self, PyObject *args, PyObj return _resultobj; } -#define wxWindow_SetSizer(_swigobj,_swigarg0) (_swigobj->SetSizer(_swigarg0)) +#define wxWindow_SetSizer(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetSizer(_swigarg0,_swigarg1)) static PyObject *_wrap_wxWindow_SetSizer(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxWindow * _arg0; wxSizer * _arg1; + bool _arg2 = (bool ) TRUE; PyObject * _argo0 = 0; PyObject * _argo1 = 0; - char *_kwnames[] = { "self","sizer", NULL }; + int tempbool2 = (int) TRUE; + char *_kwnames[] = { "self","sizer","deleteOld", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxWindow_SetSizer",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxWindow_SetSizer",_kwnames,&_argo0,&_argo1,&tempbool2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -5088,9 +5090,10 @@ static PyObject *_wrap_wxWindow_SetSizer(PyObject *self, PyObject *args, PyObjec return NULL; } } + _arg2 = (bool ) tempbool2; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxWindow_SetSizer(_arg0,_arg1); + wxWindow_SetSizer(_arg0,_arg1,_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -5359,6 +5362,36 @@ static PyObject *_wrap_wxWindow_GetBestSize(PyObject *self, PyObject *args, PyOb return _resultobj; } +#define wxWindow_GetMaxSize(_swigobj) (_swigobj->GetMaxSize()) +static PyObject *_wrap_wxWindow_GetMaxSize(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSize * _result; + wxWindow * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_GetMaxSize",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_GetMaxSize. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxSize (wxWindow_GetMaxSize(_arg0)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxSize_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + #define wxWindow_SetCaret(_swigobj,_swigarg0) (_swigobj->SetCaret(_swigarg0)) static PyObject *_wrap_wxWindow_SetCaret(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -5949,7 +5982,7 @@ static PyObject *_wrap_wxWindow_GetAcceleratorTable(PyObject *self, PyObject *ar #define wxWindow_GetDefaultItem(_swigobj) (_swigobj->GetDefaultItem()) static PyObject *_wrap_wxWindow_GetDefaultItem(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxButton * _result; + wxWindow * _result; wxWindow * _arg0; PyObject * _argo0 = 0; char *_kwnames[] = { "self", NULL }; @@ -5966,7 +5999,7 @@ static PyObject *_wrap_wxWindow_GetDefaultItem(PyObject *self, PyObject *args, P } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxButton *)wxWindow_GetDefaultItem(_arg0); + _result = (wxWindow *)wxWindow_GetDefaultItem(_arg0); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -5977,8 +6010,9 @@ static PyObject *_wrap_wxWindow_GetDefaultItem(PyObject *self, PyObject *args, P #define wxWindow_SetDefaultItem(_swigobj,_swigarg0) (_swigobj->SetDefaultItem(_swigarg0)) static PyObject *_wrap_wxWindow_SetDefaultItem(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; + wxWindow * _result; wxWindow * _arg0; - wxButton * _arg1; + wxWindow * _arg1; PyObject * _argo0 = 0; PyObject * _argo1 = 0; char *_kwnames[] = { "self","btn", NULL }; @@ -5995,19 +6029,18 @@ static PyObject *_wrap_wxWindow_SetDefaultItem(PyObject *self, PyObject *args, P } if (_argo1) { if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxButton_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxWindow_SetDefaultItem. Expected _wxButton_p."); + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxWindow_SetDefaultItem. Expected _wxWindow_p."); return NULL; } } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxWindow_SetDefaultItem(_arg0,_arg1); + _result = (wxWindow *)wxWindow_SetDefaultItem(_arg0,_arg1); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; -} Py_INCREF(Py_None); - _resultobj = Py_None; +}{ _resultobj = wxPyMake_wxObject(_result); } return _resultobj; } @@ -7021,6 +7054,34 @@ static PyObject *_wrap_wxScrolledWindow_AdjustScrollbars(PyObject *self, PyObjec return _resultobj; } +#define wxScrolledWindow_Layout(_swigobj) (_swigobj->Layout()) +static PyObject *_wrap_wxScrolledWindow_Layout(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxScrolledWindow * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxScrolledWindow_Layout",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxScrolledWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxScrolledWindow_Layout. Expected _wxScrolledWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxScrolledWindow_Layout(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + static void *SwigwxMenuTowxEvtHandler(void *ptr) { wxMenu *src; wxEvtHandler *dest; @@ -9975,6 +10036,7 @@ static PyMethodDef windowscMethods[] = { { "wxMenu_AppendMenu", (PyCFunction) _wrap_wxMenu_AppendMenu, METH_VARARGS | METH_KEYWORDS }, { "wxMenu_Append", (PyCFunction) _wrap_wxMenu_Append, METH_VARARGS | METH_KEYWORDS }, { "new_wxMenu", (PyCFunction) _wrap_new_wxMenu, METH_VARARGS | METH_KEYWORDS }, + { "wxScrolledWindow_Layout", (PyCFunction) _wrap_wxScrolledWindow_Layout, METH_VARARGS | METH_KEYWORDS }, { "wxScrolledWindow_AdjustScrollbars", (PyCFunction) _wrap_wxScrolledWindow_AdjustScrollbars, METH_VARARGS | METH_KEYWORDS }, { "wxScrolledWindow_GetScaleY", (PyCFunction) _wrap_wxScrolledWindow_GetScaleY, METH_VARARGS | METH_KEYWORDS }, { "wxScrolledWindow_GetScaleX", (PyCFunction) _wrap_wxScrolledWindow_GetScaleX, METH_VARARGS | METH_KEYWORDS }, @@ -10022,6 +10084,7 @@ static PyMethodDef windowscMethods[] = { { "wxWindow_Freeze", (PyCFunction) _wrap_wxWindow_Freeze, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetCaret", (PyCFunction) _wrap_wxWindow_GetCaret, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetCaret", (PyCFunction) _wrap_wxWindow_SetCaret, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_GetMaxSize", (PyCFunction) _wrap_wxWindow_GetMaxSize, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetBestSize", (PyCFunction) _wrap_wxWindow_GetBestSize, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetDropTarget", (PyCFunction) _wrap_wxWindow_GetDropTarget, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetDropTarget", (PyCFunction) _wrap_wxWindow_SetDropTarget, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/gtk/windows.py b/wxPython/src/gtk/windows.py index aae5c351e5..a410e9809f 100644 --- a/wxPython/src/gtk/windows.py +++ b/wxPython/src/gtk/windows.py @@ -535,6 +535,10 @@ class wxWindowPtr(wxEvtHandlerPtr): val = apply(windowsc.wxWindow_GetBestSize,(self,) + _args, _kwargs) if val: val = wxSizePtr(val) ; val.thisown = 1 return val + def GetMaxSize(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_GetMaxSize,(self,) + _args, _kwargs) + if val: val = wxSizePtr(val) ; val.thisown = 1 + return val def SetCaret(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_SetCaret,(self,) + _args, _kwargs) return val @@ -703,6 +707,9 @@ class wxScrolledWindowPtr(wxPanelPtr): def AdjustScrollbars(self, *_args, **_kwargs): val = apply(windowsc.wxScrolledWindow_AdjustScrollbars,(self,) + _args, _kwargs) return val + def Layout(self, *_args, **_kwargs): + val = apply(windowsc.wxScrolledWindow_Layout,(self,) + _args, _kwargs) + return val def __repr__(self): return "" % (self.this,) ViewStart = GetViewStart diff --git a/wxPython/src/gtk/wx.cpp b/wxPython/src/gtk/wx.cpp index 652c1af2a1..922620c573 100644 --- a/wxPython/src/gtk/wx.cpp +++ b/wxPython/src/gtk/wx.cpp @@ -647,6 +647,9 @@ static wxPyCoreAPI API = { wxPy_ConvertList, wxString_in_helper, + Py2wxString, + wx2PyString, + byte_LIST_helper, int_LIST_helper, long_LIST_helper, @@ -2059,11 +2062,18 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxID_YES", PyInt_FromLong((long) wxID_YES)); PyDict_SetItemString(d,"wxID_NO", PyInt_FromLong((long) wxID_NO)); PyDict_SetItemString(d,"wxID_STATIC", PyInt_FromLong((long) wxID_STATIC)); - PyDict_SetItemString(d,"wxID_SEPARATOR", PyInt_FromLong((long) wxID_SEPARATOR)); PyDict_SetItemString(d,"wxID_FORWARD", PyInt_FromLong((long) wxID_FORWARD)); PyDict_SetItemString(d,"wxID_BACKWARD", PyInt_FromLong((long) wxID_BACKWARD)); - PyDict_SetItemString(d,"wxID_SETUP", PyInt_FromLong((long) wxID_SETUP)); + PyDict_SetItemString(d,"wxID_DEFAULT", PyInt_FromLong((long) wxID_DEFAULT)); PyDict_SetItemString(d,"wxID_MORE", PyInt_FromLong((long) wxID_MORE)); + PyDict_SetItemString(d,"wxID_SETUP", PyInt_FromLong((long) wxID_SETUP)); + PyDict_SetItemString(d,"wxID_RESET", PyInt_FromLong((long) wxID_RESET)); + PyDict_SetItemString(d,"wxID_CONTEXT_HELP", PyInt_FromLong((long) wxID_CONTEXT_HELP)); + PyDict_SetItemString(d,"wxID_YESTOALL", PyInt_FromLong((long) wxID_YESTOALL)); + PyDict_SetItemString(d,"wxID_NOTOALL", PyInt_FromLong((long) wxID_NOTOALL)); + PyDict_SetItemString(d,"wxID_ABORT", PyInt_FromLong((long) wxID_ABORT)); + PyDict_SetItemString(d,"wxID_RETRY", PyInt_FromLong((long) wxID_RETRY)); + PyDict_SetItemString(d,"wxID_IGNORE", PyInt_FromLong((long) wxID_IGNORE)); PyDict_SetItemString(d,"wxOPEN", PyInt_FromLong((long) wxOPEN)); PyDict_SetItemString(d,"wxSAVE", PyInt_FromLong((long) wxSAVE)); PyDict_SetItemString(d,"wxHIDE_READONLY", PyInt_FromLong((long) wxHIDE_READONLY)); diff --git a/wxPython/src/gtk/wx.py b/wxPython/src/gtk/wx.py index b213f84dfd..3edbf59183 100644 --- a/wxPython/src/gtk/wx.py +++ b/wxPython/src/gtk/wx.py @@ -378,11 +378,18 @@ wxID_APPLY = wxc.wxID_APPLY wxID_YES = wxc.wxID_YES wxID_NO = wxc.wxID_NO wxID_STATIC = wxc.wxID_STATIC -wxID_SEPARATOR = wxc.wxID_SEPARATOR wxID_FORWARD = wxc.wxID_FORWARD wxID_BACKWARD = wxc.wxID_BACKWARD -wxID_SETUP = wxc.wxID_SETUP +wxID_DEFAULT = wxc.wxID_DEFAULT wxID_MORE = wxc.wxID_MORE +wxID_SETUP = wxc.wxID_SETUP +wxID_RESET = wxc.wxID_RESET +wxID_CONTEXT_HELP = wxc.wxID_CONTEXT_HELP +wxID_YESTOALL = wxc.wxID_YESTOALL +wxID_NOTOALL = wxc.wxID_NOTOALL +wxID_ABORT = wxc.wxID_ABORT +wxID_RETRY = wxc.wxID_RETRY +wxID_IGNORE = wxc.wxID_IGNORE wxOPEN = wxc.wxOPEN wxSAVE = wxc.wxSAVE wxHIDE_READONLY = wxc.wxHIDE_READONLY -- 2.45.2