diff --git a/wxPython/demo/SplitTree.py b/wxPython/demo/SplitTree.py index 5de68027e4..c70802e8bb 100644 --- a/wxPython/demo/SplitTree.py +++ b/wxPython/demo/SplitTree.py @@ -31,7 +31,7 @@ class TestTree(wxRemotelyScrolledTreeCtrl): def OnPaint(self, evt): dc = wxPaintDC(self) - self.base_OnPaint(evt) + wxTreeCtrl.OnPaint(self, evt) # Reset the device origin since it may have been set dc.SetDeviceOrigin(0, 0) diff --git a/wxPython/src/controls2.i b/wxPython/src/controls2.i index 12990e015c..a4ff7294a9 100644 --- a/wxPython/src/controls2.i +++ b/wxPython/src/controls2.i @@ -1234,6 +1234,7 @@ public: #ifdef __WXMSW__ void SetItemDropHighlight(const wxTreeItemId& item, int highlight = TRUE); +#endif //bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, int textOnly = FALSE) %addmethods { @@ -1252,7 +1253,7 @@ public: } } } -#endif + %pragma(python) addtoclass = " # Redefine some methods that SWIG gets a bit confused on... @@ -1272,6 +1273,9 @@ public: val1.thisown = 1 return (val1,val2) " + + // This seems pretty bogus, but is currently needed for SplitTree + void OnPaint(wxPaintEvent& event); }; diff --git a/wxPython/src/gtk/controls2.cpp b/wxPython/src/gtk/controls2.cpp index 62535e36fa..ee9b7c89b6 100644 --- a/wxPython/src/gtk/controls2.cpp +++ b/wxPython/src/gtk/controls2.cpp @@ -9259,7 +9259,99 @@ static PyObject *_wrap_wxTreeCtrl_SetItemFont(PyObject *self, PyObject *args, Py return _resultobj; } +static PyObject * wxPyTreeCtrl_GetBoundingRect(wxPyTreeCtrl *self,const wxTreeItemId & item,int textOnly) { + wxRect rect; + if (self->GetBoundingRect(item, rect, textOnly)) { + wxPyTState* state = wxPyBeginBlockThreads(); + wxRect* r = new wxRect(rect); + PyObject* val = wxPyConstructObject((void*)r, "wxRect"); + wxPyEndBlockThreads(state); + return val; + } + else { + Py_INCREF(Py_None); + return Py_None; + } + } +static PyObject *_wrap_wxTreeCtrl_GetBoundingRect(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxPyTreeCtrl * _arg0; + wxTreeItemId * _arg1; + int _arg2 = (int ) FALSE; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","item","textOnly", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxTreeCtrl_GetBoundingRect",_kwnames,&_argo0,&_argo1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeCtrl_GetBoundingRect. Expected _wxPyTreeCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxTreeItemId_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeCtrl_GetBoundingRect. Expected _wxTreeItemId_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (PyObject *)wxPyTreeCtrl_GetBoundingRect(_arg0,*_arg1,_arg2); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +}{ + _resultobj = _result; +} + return _resultobj; +} + +#define wxTreeCtrl_OnPaint(_swigobj,_swigarg0) (_swigobj->OnPaint(_swigarg0)) +static PyObject *_wrap_wxTreeCtrl_OnPaint(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyTreeCtrl * _arg0; + wxPaintEvent * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","event", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeCtrl_OnPaint",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeCtrl_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeCtrl_OnPaint. Expected _wxPyTreeCtrl_p."); + return NULL; + } + } + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxPaintEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeCtrl_OnPaint. Expected _wxPaintEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + wxTreeCtrl_OnPaint(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + static PyMethodDef controls2cMethods[] = { + { "wxTreeCtrl_OnPaint", (PyCFunction) _wrap_wxTreeCtrl_OnPaint, METH_VARARGS | METH_KEYWORDS }, + { "wxTreeCtrl_GetBoundingRect", (PyCFunction) _wrap_wxTreeCtrl_GetBoundingRect, METH_VARARGS | METH_KEYWORDS }, { "wxTreeCtrl_SetItemFont", (PyCFunction) _wrap_wxTreeCtrl_SetItemFont, METH_VARARGS | METH_KEYWORDS }, { "wxTreeCtrl_SetItemBackgroundColour", (PyCFunction) _wrap_wxTreeCtrl_SetItemBackgroundColour, METH_VARARGS | METH_KEYWORDS }, { "wxTreeCtrl_SetItemTextColour", (PyCFunction) _wrap_wxTreeCtrl_SetItemTextColour, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/gtk/controls2.py b/wxPython/src/gtk/controls2.py index 37b1a5860d..eb626812d2 100644 --- a/wxPython/src/gtk/controls2.py +++ b/wxPython/src/gtk/controls2.py @@ -771,6 +771,7 @@ class wxTreeItemIdPtr : return val def __repr__(self): return "" % (self.this,) + Ok = IsOk class wxTreeItemId(wxTreeItemIdPtr): def __init__(self,*_args,**_kwargs): self.this = apply(controls2c.new_wxTreeItemId,_args,_kwargs) @@ -1061,6 +1062,12 @@ class wxTreeCtrlPtr(wxControlPtr): def SetItemFont(self, *_args, **_kwargs): val = apply(controls2c.wxTreeCtrl_SetItemFont,(self,) + _args, _kwargs) return val + def GetBoundingRect(self, *_args, **_kwargs): + val = apply(controls2c.wxTreeCtrl_GetBoundingRect,(self,) + _args, _kwargs) + return val + def OnPaint(self, *_args, **_kwargs): + val = apply(controls2c.wxTreeCtrl_OnPaint,(self,) + _args, _kwargs) + return val def __repr__(self): return "" % (self.this,) diff --git a/wxPython/src/gtk/wx.cpp b/wxPython/src/gtk/wx.cpp index 17367d190f..30b7b2cd55 100644 --- a/wxPython/src/gtk/wx.cpp +++ b/wxPython/src/gtk/wx.cpp @@ -2118,6 +2118,7 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxJOY_BUTTON_ANY", PyInt_FromLong((long) wxJOY_BUTTON_ANY)); PyDict_SetItemString(d,"wxWS_EX_VALIDATE_RECURSIVELY", PyInt_FromLong((long) wxWS_EX_VALIDATE_RECURSIVELY)); PyDict_SetItemString(d,"wxWS_EX_BLOCK_EVENTS", PyInt_FromLong((long) wxWS_EX_BLOCK_EVENTS)); + PyDict_SetItemString(d,"wxWS_EX_TRANSIENT", PyInt_FromLong((long) wxWS_EX_TRANSIENT)); PyDict_SetItemString(d,"wxMM_TEXT", PyInt_FromLong((long) wxMM_TEXT)); PyDict_SetItemString(d,"wxMM_LOMETRIC", PyInt_FromLong((long) wxMM_LOMETRIC)); PyDict_SetItemString(d,"wxMM_HIMETRIC", PyInt_FromLong((long) wxMM_HIMETRIC)); diff --git a/wxPython/src/gtk/wx.py b/wxPython/src/gtk/wx.py index 7a60992430..65cb308f90 100644 --- a/wxPython/src/gtk/wx.py +++ b/wxPython/src/gtk/wx.py @@ -434,6 +434,7 @@ wxJOY_BUTTON4 = wxc.wxJOY_BUTTON4 wxJOY_BUTTON_ANY = wxc.wxJOY_BUTTON_ANY wxWS_EX_VALIDATE_RECURSIVELY = wxc.wxWS_EX_VALIDATE_RECURSIVELY wxWS_EX_BLOCK_EVENTS = wxc.wxWS_EX_BLOCK_EVENTS +wxWS_EX_TRANSIENT = wxc.wxWS_EX_TRANSIENT wxMM_TEXT = wxc.wxMM_TEXT wxMM_LOMETRIC = wxc.wxMM_LOMETRIC wxMM_HIMETRIC = wxc.wxMM_HIMETRIC diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 1aab58d1da..f164ac7348 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -401,8 +401,10 @@ public: void SetAcceleratorTable(const wxAcceleratorTable& accel); wxAcceleratorTable *GetAcceleratorTable(); - - %name(base_OnPaint)void OnPaint(wxPaintEvent& event); +#ifdef __WXMSW__ + // This seems pretty bogus, but is currently needed for SplitTree + void OnPaint(wxPaintEvent& event); +#endif };