From ea841e434034a980c1b6d229e9b0286dc813a0a2 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 9 Apr 2003 19:44:44 +0000 Subject: [PATCH] SWIGged updates for wxGTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20113 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/gtk/controls2.py | 4 ++++ wxPython/src/gtk/html.cpp | 40 +++++++++++++++++++++++++++++++++++ wxPython/src/gtk/html.py | 3 +++ wxPython/src/gtk/wx.py | 28 ++++++++++++++++++++++++ 4 files changed, 75 insertions(+) diff --git a/wxPython/src/gtk/controls2.py b/wxPython/src/gtk/controls2.py index ac3bba3614..c3cb9d1bee 100644 --- a/wxPython/src/gtk/controls2.py +++ b/wxPython/src/gtk/controls2.py @@ -831,7 +831,11 @@ class wxTreeItemIdPtr : return val def __repr__(self): return "<%s.%s instance; proxy of C++ wxTreeItemId instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this) + Ok = IsOk + def __nonzero__(self): + return self.IsOk() + class wxTreeItemId(wxTreeItemIdPtr): def __init__(self,*_args,**_kwargs): self.this = controls2c.new_wxTreeItemId(*_args,**_kwargs) diff --git a/wxPython/src/gtk/html.cpp b/wxPython/src/gtk/html.cpp index 78689bc256..8280e57f85 100644 --- a/wxPython/src/gtk/html.cpp +++ b/wxPython/src/gtk/html.cpp @@ -4465,6 +4465,45 @@ static PyObject *_wrap_wxHtmlWindow_LoadPage(PyObject *self, PyObject *args, PyO return _resultobj; } +#define wxHtmlWindow_LoadFile(_swigobj,_swigarg0) (_swigobj->LoadFile(_swigarg0)) +static PyObject *_wrap_wxHtmlWindow_LoadFile(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyHtmlWindow * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","filename", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxHtmlWindow_LoadFile",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyHtmlWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxHtmlWindow_LoadFile. Expected _wxPyHtmlWindow_p."); + return NULL; + } + } +{ + _arg1 = wxString_in_helper(_obj1); + if (_arg1 == NULL) + return NULL; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxHtmlWindow_LoadFile(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + #define wxHtmlWindow_AppendToPage(_swigobj,_swigarg0) (_swigobj->AppendToPage(_swigarg0)) static PyObject *_wrap_wxHtmlWindow_AppendToPage(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -6575,6 +6614,7 @@ static PyMethodDef htmlcMethods[] = { { "wxHtmlWindow_GetOpenedAnchor", (PyCFunction) _wrap_wxHtmlWindow_GetOpenedAnchor, METH_VARARGS | METH_KEYWORDS }, { "wxHtmlWindow_GetOpenedPage", (PyCFunction) _wrap_wxHtmlWindow_GetOpenedPage, METH_VARARGS | METH_KEYWORDS }, { "wxHtmlWindow_AppendToPage", (PyCFunction) _wrap_wxHtmlWindow_AppendToPage, METH_VARARGS | METH_KEYWORDS }, + { "wxHtmlWindow_LoadFile", (PyCFunction) _wrap_wxHtmlWindow_LoadFile, METH_VARARGS | METH_KEYWORDS }, { "wxHtmlWindow_LoadPage", (PyCFunction) _wrap_wxHtmlWindow_LoadPage, METH_VARARGS | METH_KEYWORDS }, { "wxHtmlWindow_SetPage", (PyCFunction) _wrap_wxHtmlWindow_SetPage, METH_VARARGS | METH_KEYWORDS }, { "wxHtmlWindow__setCallbackInfo", (PyCFunction) _wrap_wxHtmlWindow__setCallbackInfo, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/gtk/html.py b/wxPython/src/gtk/html.py index 2392d0cf70..bee666b5fa 100644 --- a/wxPython/src/gtk/html.py +++ b/wxPython/src/gtk/html.py @@ -550,6 +550,9 @@ class wxHtmlWindowPtr(wxScrolledWindowPtr): def LoadPage(self, *_args, **_kwargs): val = htmlc.wxHtmlWindow_LoadPage(self, *_args, **_kwargs) return val + def LoadFile(self, *_args, **_kwargs): + val = htmlc.wxHtmlWindow_LoadFile(self, *_args, **_kwargs) + return val def AppendToPage(self, *_args, **_kwargs): val = htmlc.wxHtmlWindow_AppendToPage(self, *_args, **_kwargs) return val diff --git a/wxPython/src/gtk/wx.py b/wxPython/src/gtk/wx.py index 1868dce5dc..a7e55b92e2 100644 --- a/wxPython/src/gtk/wx.py +++ b/wxPython/src/gtk/wx.py @@ -1737,6 +1737,34 @@ class _wxPyDeadObject: def __nonzero__(self): return 0 +#---------------------------------------------------------------------- + +class wxNotebookPage(wxPanel): + """ + There is an old (and apparently unsolvable) bug when placing a + window with a nonstandard background colour in a wxNotebook, as + the notbooks's background colour would always be used when the + window is refreshed. The solution is to place a panel in the + notbook and the coloured window o nthe panel, sized to cover the + panel. This simple class does that for you, just put an instance + of this in the notebook and make your regular window a child of + this one and it will handle the resize for you. + """ + def __init__(self, parent, id=-1, + pos=wxDefaultPosition, size=wxDefaultSize, + style=wxTAB_TRAVERSAL, name="panel"): + wxPanel.__init__(self, parent, id, pos, size, style, name) + self.child = None + EVT_SIZE(self, self.OnSize) + def OnSize(self, evt): + if self.child is None: + children = self.GetChildren() + if len(children): + self.child = children[0] + if self.child: + self.child.SetPosition((0,0)) + self.child.SetSize(self.GetSize()) + #---------------------------------------------------------------------- #----------------------------------------------------------------------