From be68621e1e450800e7fa389b5216cd6c7a01f3cc Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 26 Oct 2006 03:33:56 +0000 Subject: [PATCH] reSWIGged git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/gtk/_gdi.py | 42 ++++++++++++----- wxPython/src/gtk/_gdi_wrap.cpp | 83 ++++++++++++++++++++++++++++------ wxPython/src/mac/_gdi.py | 42 ++++++++++++----- wxPython/src/mac/_gdi_wrap.cpp | 83 ++++++++++++++++++++++++++++------ wxPython/src/msw/_gdi.py | 42 ++++++++++++----- wxPython/src/msw/_gdi_wrap.cpp | 83 ++++++++++++++++++++++++++++------ 6 files changed, 297 insertions(+), 78 deletions(-) diff --git a/wxPython/src/gtk/_gdi.py b/wxPython/src/gtk/_gdi.py index 4523047e2e..b7d96bf06e 100644 --- a/wxPython/src/gtk/_gdi.py +++ b/wxPython/src/gtk/_gdi.py @@ -4590,16 +4590,26 @@ class BufferedDC(MemoryDC): This simple class provides a simple way to avoid flicker: when drawing on it, everything is in fact first drawn on an in-memory buffer (a `wx.Bitmap`) and then copied to the screen only once, when this object - is destroyed. + is destroyed. You can either provide a buffer bitmap yourself, and + reuse it the next time something needs painted, or you can let the + buffered DC create and provide a buffer bitmap itself. - It can be used in the same way as any other device context. + Buffered DCs can be used in the same way as any other device context. wx.BufferedDC itself typically replaces `wx.ClientDC`, if you want to use it in your EVT_PAINT handler, you should look at - `wx.BufferedPaintDC`. + `wx.BufferedPaintDC`. You can also use a wx.BufferedDC without + providing a target DC. In this case the operations done on the dc + will only be written to the buffer bitmap and *not* to any window, so + you will want to have provided the buffer bitmap and then reuse it + when it needs painted to the window. Please note that GTK+ 2.0 and OS X provide double buffering themselves - natively. wxBufferedDC is aware of this however, and will bypass the buffering - unless an explicit buffer bitmap is given. + natively. You may want to use `wx.Window.IsDoubleBuffered` to + determine whether you need to use buffering or not, or use + `wx.AutoBufferedPaintDC` to avoid needless double buffering on systems + that already do it automatically. + + """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') @@ -4926,7 +4936,9 @@ class GraphicsContext(object): Create(WindowDC dc) -> GraphicsContext Create(Window window) -> GraphicsContext """ - return _gdi_.GraphicsContext_Create(*args) + val = _gdi_.GraphicsContext_Create(*args) + val.__dc = args[0] # save a ref so the dc will not be deleted before self + return val Create = staticmethod(Create) def CreateFromNative(*args, **kwargs): @@ -4992,7 +5004,7 @@ class GraphicsContext(object): def SetRadialGradientBrush(*args, **kwargs): """ SetRadialGradientBrush(self, Double xo, Double yo, Double xc, Double yc, Double radius, - Colour oColor, Colour cColor) + Colour oColour, Colour cColour) """ return _gdi_.GraphicsContext_SetRadialGradientBrush(*args, **kwargs) @@ -5000,9 +5012,9 @@ class GraphicsContext(object): """SetFont(self, Font font)""" return _gdi_.GraphicsContext_SetFont(*args, **kwargs) - def SetTextColor(*args, **kwargs): - """SetTextColor(self, Colour col)""" - return _gdi_.GraphicsContext_SetTextColor(*args, **kwargs) + def SetTextColour(*args, **kwargs): + """SetTextColour(self, Colour col)""" + return _gdi_.GraphicsContext_SetTextColour(*args, **kwargs) def StrokePath(*args, **kwargs): """StrokePath(self, GraphicsPath path)""" @@ -5024,8 +5036,12 @@ class GraphicsContext(object): """DrawRotatedText(self, String str, Double x, Double y, Double angle)""" return _gdi_.GraphicsContext_DrawRotatedText(*args, **kwargs) + def GetFullTextExtent(*args, **kwargs): + """GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)""" + return _gdi_.GraphicsContext_GetFullTextExtent(*args, **kwargs) + def GetTextExtent(*args, **kwargs): - """GetTextExtend(self, text) --> (width, height, descent, externalLeading)""" + """GetTextExtent(self, text) --> (width, height)""" return _gdi_.GraphicsContext_GetTextExtent(*args, **kwargs) def GetPartialTextExtents(*args, **kwargs): @@ -5075,7 +5091,9 @@ def GraphicsContext_Create(*args): Create(WindowDC dc) -> GraphicsContext GraphicsContext_Create(Window window) -> GraphicsContext """ - return _gdi_.GraphicsContext_Create(*args) + val = _gdi_.GraphicsContext_Create(*args) + val.__dc = args[0] # save a ref so the dc will not be deleted before self + return val def GraphicsContext_CreateFromNative(*args, **kwargs): """GraphicsContext_CreateFromNative(void context) -> GraphicsContext""" diff --git a/wxPython/src/gtk/_gdi_wrap.cpp b/wxPython/src/gtk/_gdi_wrap.cpp index 707540c764..14b3af7224 100644 --- a/wxPython/src/gtk/_gdi_wrap.cpp +++ b/wxPython/src/gtk/_gdi_wrap.cpp @@ -3636,7 +3636,7 @@ public: void SetRadialGradientBrush( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble , const wxColour &, const wxColour &) {} void SetFont( const wxFont & ) {} - void SetTextColor( const wxColour & ) {} + void SetTextColour( const wxColour & ) {} void StrokePath( const wxGraphicsPath * ) {} void FillPath( const wxGraphicsPath *, int ) {} void DrawPath( const wxGraphicsPath *, int ) {} @@ -3682,6 +3682,16 @@ public: #endif +SWIGINTERN PyObject *wxGraphicsContext_GetTextExtent(wxGraphicsContext *self,wxString const &text){ + wxDouble width = 0.0, + height = 0.0; + self->GetTextExtent(text, &width, &height, NULL, NULL); + // thread wrapers are turned off for this .i file, so no need to acquire GIL... + PyObject* rv = PyTuple_New(2); + PyTuple_SET_ITEM(rv, 0, PyFloat_FromDouble(width)); + PyTuple_SET_ITEM(rv, 1, PyFloat_FromDouble(height)); + return rv; + } SWIGINTERN wxArrayDouble wxGraphicsContext_GetPartialTextExtents(wxGraphicsContext *self,wxString const &text){ wxArrayDouble widths; self->GetPartialTextExtents(text, widths); @@ -24881,7 +24891,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_Create__SWIG_0(PyObject *SWIGUNUSEDPA result = (wxGraphicsContext *)wxGraphicsContext::Create((wxWindowDC const &)*arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -24905,7 +24915,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_Create__SWIG_1(PyObject *SWIGUNUSEDPA result = (wxGraphicsContext *)wxGraphicsContext::Create(arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -24958,7 +24968,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_CreateFromNative(PyObject *SWIGUNUSED result = (wxGraphicsContext *)wxGraphicsContext::CreateFromNative(arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -24984,7 +24994,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_CreatePath(PyObject *SWIGUNUSEDPARM(s result = (wxGraphicsPath *)(arg1)->CreatePath(); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsPath, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsPath, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -25508,7 +25518,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetRadialGradientBrush(PyObject *SWIG PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; char * kwnames[] = { - (char *) "self",(char *) "xo",(char *) "yo",(char *) "xc",(char *) "yc",(char *) "radius",(char *) "oColor",(char *) "cColor", NULL + (char *) "self",(char *) "xo",(char *) "yo",(char *) "xc",(char *) "yc",(char *) "radius",(char *) "oColour",(char *) "cColour", NULL }; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOOOO:GraphicsContext_SetRadialGradientBrush",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; @@ -25600,7 +25610,7 @@ fail: } -SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColour(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; wxColour *arg2 = 0 ; @@ -25613,10 +25623,10 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM (char *) "self",(char *) "col", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_SetTextColor",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_SetTextColour",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_SetTextColor" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_SetTextColour" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); } arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); { @@ -25624,7 +25634,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM if ( ! wxColour_helper(obj1, &arg2)) SWIG_fail; } { - (arg1)->SetTextColor((wxColour const &)*arg2); + (arg1)->SetTextColour((wxColour const &)*arg2); if (PyErr_Occurred()) SWIG_fail; } resultobj = SWIG_Py_Void(); @@ -25895,7 +25905,7 @@ fail: } -SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GraphicsContext_GetFullTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; wxString *arg2 = 0 ; @@ -25924,10 +25934,10 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPAR arg4 = &temp4; arg5 = &temp5; arg6 = &temp6; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetFullTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetFullTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext const *""'"); } arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); { @@ -25978,6 +25988,50 @@ fail: } +SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; + wxString *arg2 = 0 ; + PyObject *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool temp2 = false ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "text", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); + } + arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); + { + arg2 = wxString_in_helper(obj1); + if (arg2 == NULL) SWIG_fail; + temp2 = true; + } + { + result = (PyObject *)wxGraphicsContext_GetTextExtent(arg1,(wxString const &)*arg2); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = result; + { + if (temp2) + delete arg2; + } + return resultobj; +fail: + { + if (temp2) + delete arg2; + } + return NULL; +} + + SWIGINTERN PyObject *_wrap_GraphicsContext_GetPartialTextExtents(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; @@ -35031,12 +35085,13 @@ static PyMethodDef SwigMethods[] = { { (char *)"GraphicsContext_SetLinearGradientBrush", (PyCFunction) _wrap_GraphicsContext_SetLinearGradientBrush, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_SetRadialGradientBrush", (PyCFunction) _wrap_GraphicsContext_SetRadialGradientBrush, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_SetFont", (PyCFunction) _wrap_GraphicsContext_SetFont, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"GraphicsContext_SetTextColor", (PyCFunction) _wrap_GraphicsContext_SetTextColor, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GraphicsContext_SetTextColour", (PyCFunction) _wrap_GraphicsContext_SetTextColour, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_StrokePath", (PyCFunction) _wrap_GraphicsContext_StrokePath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_FillPath", (PyCFunction) _wrap_GraphicsContext_FillPath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawPath", (PyCFunction) _wrap_GraphicsContext_DrawPath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawText", (PyCFunction) _wrap_GraphicsContext_DrawText, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawRotatedText", (PyCFunction) _wrap_GraphicsContext_DrawRotatedText, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GraphicsContext_GetFullTextExtent", (PyCFunction) _wrap_GraphicsContext_GetFullTextExtent, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_GetTextExtent", (PyCFunction) _wrap_GraphicsContext_GetTextExtent, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_GetPartialTextExtents", (PyCFunction) _wrap_GraphicsContext_GetPartialTextExtents, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawBitmap", (PyCFunction) _wrap_GraphicsContext_DrawBitmap, METH_VARARGS | METH_KEYWORDS, NULL}, diff --git a/wxPython/src/mac/_gdi.py b/wxPython/src/mac/_gdi.py index 693e32ff09..6bdfc2d8c7 100644 --- a/wxPython/src/mac/_gdi.py +++ b/wxPython/src/mac/_gdi.py @@ -4589,16 +4589,26 @@ class BufferedDC(MemoryDC): This simple class provides a simple way to avoid flicker: when drawing on it, everything is in fact first drawn on an in-memory buffer (a `wx.Bitmap`) and then copied to the screen only once, when this object - is destroyed. + is destroyed. You can either provide a buffer bitmap yourself, and + reuse it the next time something needs painted, or you can let the + buffered DC create and provide a buffer bitmap itself. - It can be used in the same way as any other device context. + Buffered DCs can be used in the same way as any other device context. wx.BufferedDC itself typically replaces `wx.ClientDC`, if you want to use it in your EVT_PAINT handler, you should look at - `wx.BufferedPaintDC`. + `wx.BufferedPaintDC`. You can also use a wx.BufferedDC without + providing a target DC. In this case the operations done on the dc + will only be written to the buffer bitmap and *not* to any window, so + you will want to have provided the buffer bitmap and then reuse it + when it needs painted to the window. Please note that GTK+ 2.0 and OS X provide double buffering themselves - natively. wxBufferedDC is aware of this however, and will bypass the buffering - unless an explicit buffer bitmap is given. + natively. You may want to use `wx.Window.IsDoubleBuffered` to + determine whether you need to use buffering or not, or use + `wx.AutoBufferedPaintDC` to avoid needless double buffering on systems + that already do it automatically. + + """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') @@ -4953,7 +4963,9 @@ class GraphicsContext(object): Create(WindowDC dc) -> GraphicsContext Create(Window window) -> GraphicsContext """ - return _gdi_.GraphicsContext_Create(*args) + val = _gdi_.GraphicsContext_Create(*args) + val.__dc = args[0] # save a ref so the dc will not be deleted before self + return val Create = staticmethod(Create) def CreateFromNative(*args, **kwargs): @@ -5019,7 +5031,7 @@ class GraphicsContext(object): def SetRadialGradientBrush(*args, **kwargs): """ SetRadialGradientBrush(self, Double xo, Double yo, Double xc, Double yc, Double radius, - Colour oColor, Colour cColor) + Colour oColour, Colour cColour) """ return _gdi_.GraphicsContext_SetRadialGradientBrush(*args, **kwargs) @@ -5027,9 +5039,9 @@ class GraphicsContext(object): """SetFont(self, Font font)""" return _gdi_.GraphicsContext_SetFont(*args, **kwargs) - def SetTextColor(*args, **kwargs): - """SetTextColor(self, Colour col)""" - return _gdi_.GraphicsContext_SetTextColor(*args, **kwargs) + def SetTextColour(*args, **kwargs): + """SetTextColour(self, Colour col)""" + return _gdi_.GraphicsContext_SetTextColour(*args, **kwargs) def StrokePath(*args, **kwargs): """StrokePath(self, GraphicsPath path)""" @@ -5051,8 +5063,12 @@ class GraphicsContext(object): """DrawRotatedText(self, String str, Double x, Double y, Double angle)""" return _gdi_.GraphicsContext_DrawRotatedText(*args, **kwargs) + def GetFullTextExtent(*args, **kwargs): + """GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)""" + return _gdi_.GraphicsContext_GetFullTextExtent(*args, **kwargs) + def GetTextExtent(*args, **kwargs): - """GetTextExtend(self, text) --> (width, height, descent, externalLeading)""" + """GetTextExtent(self, text) --> (width, height)""" return _gdi_.GraphicsContext_GetTextExtent(*args, **kwargs) def GetPartialTextExtents(*args, **kwargs): @@ -5102,7 +5118,9 @@ def GraphicsContext_Create(*args): Create(WindowDC dc) -> GraphicsContext GraphicsContext_Create(Window window) -> GraphicsContext """ - return _gdi_.GraphicsContext_Create(*args) + val = _gdi_.GraphicsContext_Create(*args) + val.__dc = args[0] # save a ref so the dc will not be deleted before self + return val def GraphicsContext_CreateFromNative(*args, **kwargs): """GraphicsContext_CreateFromNative(void context) -> GraphicsContext""" diff --git a/wxPython/src/mac/_gdi_wrap.cpp b/wxPython/src/mac/_gdi_wrap.cpp index ceb431498e..3dc4626839 100644 --- a/wxPython/src/mac/_gdi_wrap.cpp +++ b/wxPython/src/mac/_gdi_wrap.cpp @@ -3640,7 +3640,7 @@ public: void SetRadialGradientBrush( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble , const wxColour &, const wxColour &) {} void SetFont( const wxFont & ) {} - void SetTextColor( const wxColour & ) {} + void SetTextColour( const wxColour & ) {} void StrokePath( const wxGraphicsPath * ) {} void FillPath( const wxGraphicsPath *, int ) {} void DrawPath( const wxGraphicsPath *, int ) {} @@ -3686,6 +3686,16 @@ public: #endif +SWIGINTERN PyObject *wxGraphicsContext_GetTextExtent(wxGraphicsContext *self,wxString const &text){ + wxDouble width = 0.0, + height = 0.0; + self->GetTextExtent(text, &width, &height, NULL, NULL); + // thread wrapers are turned off for this .i file, so no need to acquire GIL... + PyObject* rv = PyTuple_New(2); + PyTuple_SET_ITEM(rv, 0, PyFloat_FromDouble(width)); + PyTuple_SET_ITEM(rv, 1, PyFloat_FromDouble(height)); + return rv; + } SWIGINTERN wxArrayDouble wxGraphicsContext_GetPartialTextExtents(wxGraphicsContext *self,wxString const &text){ wxArrayDouble widths; self->GetPartialTextExtents(text, widths); @@ -25090,7 +25100,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_Create__SWIG_0(PyObject *SWIGUNUSEDPA result = (wxGraphicsContext *)wxGraphicsContext::Create((wxWindowDC const &)*arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -25114,7 +25124,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_Create__SWIG_1(PyObject *SWIGUNUSEDPA result = (wxGraphicsContext *)wxGraphicsContext::Create(arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -25167,7 +25177,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_CreateFromNative(PyObject *SWIGUNUSED result = (wxGraphicsContext *)wxGraphicsContext::CreateFromNative(arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -25193,7 +25203,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_CreatePath(PyObject *SWIGUNUSEDPARM(s result = (wxGraphicsPath *)(arg1)->CreatePath(); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsPath, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsPath, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -25717,7 +25727,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetRadialGradientBrush(PyObject *SWIG PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; char * kwnames[] = { - (char *) "self",(char *) "xo",(char *) "yo",(char *) "xc",(char *) "yc",(char *) "radius",(char *) "oColor",(char *) "cColor", NULL + (char *) "self",(char *) "xo",(char *) "yo",(char *) "xc",(char *) "yc",(char *) "radius",(char *) "oColour",(char *) "cColour", NULL }; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOOOO:GraphicsContext_SetRadialGradientBrush",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; @@ -25809,7 +25819,7 @@ fail: } -SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColour(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; wxColour *arg2 = 0 ; @@ -25822,10 +25832,10 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM (char *) "self",(char *) "col", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_SetTextColor",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_SetTextColour",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_SetTextColor" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_SetTextColour" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); } arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); { @@ -25833,7 +25843,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM if ( ! wxColour_helper(obj1, &arg2)) SWIG_fail; } { - (arg1)->SetTextColor((wxColour const &)*arg2); + (arg1)->SetTextColour((wxColour const &)*arg2); if (PyErr_Occurred()) SWIG_fail; } resultobj = SWIG_Py_Void(); @@ -26104,7 +26114,7 @@ fail: } -SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GraphicsContext_GetFullTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; wxString *arg2 = 0 ; @@ -26133,10 +26143,10 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPAR arg4 = &temp4; arg5 = &temp5; arg6 = &temp6; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetFullTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetFullTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext const *""'"); } arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); { @@ -26187,6 +26197,50 @@ fail: } +SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; + wxString *arg2 = 0 ; + PyObject *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool temp2 = false ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "text", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); + } + arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); + { + arg2 = wxString_in_helper(obj1); + if (arg2 == NULL) SWIG_fail; + temp2 = true; + } + { + result = (PyObject *)wxGraphicsContext_GetTextExtent(arg1,(wxString const &)*arg2); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = result; + { + if (temp2) + delete arg2; + } + return resultobj; +fail: + { + if (temp2) + delete arg2; + } + return NULL; +} + + SWIGINTERN PyObject *_wrap_GraphicsContext_GetPartialTextExtents(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; @@ -35247,12 +35301,13 @@ static PyMethodDef SwigMethods[] = { { (char *)"GraphicsContext_SetLinearGradientBrush", (PyCFunction) _wrap_GraphicsContext_SetLinearGradientBrush, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_SetRadialGradientBrush", (PyCFunction) _wrap_GraphicsContext_SetRadialGradientBrush, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_SetFont", (PyCFunction) _wrap_GraphicsContext_SetFont, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"GraphicsContext_SetTextColor", (PyCFunction) _wrap_GraphicsContext_SetTextColor, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GraphicsContext_SetTextColour", (PyCFunction) _wrap_GraphicsContext_SetTextColour, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_StrokePath", (PyCFunction) _wrap_GraphicsContext_StrokePath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_FillPath", (PyCFunction) _wrap_GraphicsContext_FillPath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawPath", (PyCFunction) _wrap_GraphicsContext_DrawPath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawText", (PyCFunction) _wrap_GraphicsContext_DrawText, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawRotatedText", (PyCFunction) _wrap_GraphicsContext_DrawRotatedText, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GraphicsContext_GetFullTextExtent", (PyCFunction) _wrap_GraphicsContext_GetFullTextExtent, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_GetTextExtent", (PyCFunction) _wrap_GraphicsContext_GetTextExtent, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_GetPartialTextExtents", (PyCFunction) _wrap_GraphicsContext_GetPartialTextExtents, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawBitmap", (PyCFunction) _wrap_GraphicsContext_DrawBitmap, METH_VARARGS | METH_KEYWORDS, NULL}, diff --git a/wxPython/src/msw/_gdi.py b/wxPython/src/msw/_gdi.py index 2ea7487ffd..00cf81c853 100644 --- a/wxPython/src/msw/_gdi.py +++ b/wxPython/src/msw/_gdi.py @@ -4683,16 +4683,26 @@ class BufferedDC(MemoryDC): This simple class provides a simple way to avoid flicker: when drawing on it, everything is in fact first drawn on an in-memory buffer (a `wx.Bitmap`) and then copied to the screen only once, when this object - is destroyed. + is destroyed. You can either provide a buffer bitmap yourself, and + reuse it the next time something needs painted, or you can let the + buffered DC create and provide a buffer bitmap itself. - It can be used in the same way as any other device context. + Buffered DCs can be used in the same way as any other device context. wx.BufferedDC itself typically replaces `wx.ClientDC`, if you want to use it in your EVT_PAINT handler, you should look at - `wx.BufferedPaintDC`. + `wx.BufferedPaintDC`. You can also use a wx.BufferedDC without + providing a target DC. In this case the operations done on the dc + will only be written to the buffer bitmap and *not* to any window, so + you will want to have provided the buffer bitmap and then reuse it + when it needs painted to the window. Please note that GTK+ 2.0 and OS X provide double buffering themselves - natively. wxBufferedDC is aware of this however, and will bypass the buffering - unless an explicit buffer bitmap is given. + natively. You may want to use `wx.Window.IsDoubleBuffered` to + determine whether you need to use buffering or not, or use + `wx.AutoBufferedPaintDC` to avoid needless double buffering on systems + that already do it automatically. + + """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') @@ -5051,7 +5061,9 @@ class GraphicsContext(object): Create(WindowDC dc) -> GraphicsContext Create(Window window) -> GraphicsContext """ - return _gdi_.GraphicsContext_Create(*args) + val = _gdi_.GraphicsContext_Create(*args) + val.__dc = args[0] # save a ref so the dc will not be deleted before self + return val Create = staticmethod(Create) def CreateFromNative(*args, **kwargs): @@ -5117,7 +5129,7 @@ class GraphicsContext(object): def SetRadialGradientBrush(*args, **kwargs): """ SetRadialGradientBrush(self, Double xo, Double yo, Double xc, Double yc, Double radius, - Colour oColor, Colour cColor) + Colour oColour, Colour cColour) """ return _gdi_.GraphicsContext_SetRadialGradientBrush(*args, **kwargs) @@ -5125,9 +5137,9 @@ class GraphicsContext(object): """SetFont(self, Font font)""" return _gdi_.GraphicsContext_SetFont(*args, **kwargs) - def SetTextColor(*args, **kwargs): - """SetTextColor(self, Colour col)""" - return _gdi_.GraphicsContext_SetTextColor(*args, **kwargs) + def SetTextColour(*args, **kwargs): + """SetTextColour(self, Colour col)""" + return _gdi_.GraphicsContext_SetTextColour(*args, **kwargs) def StrokePath(*args, **kwargs): """StrokePath(self, GraphicsPath path)""" @@ -5149,8 +5161,12 @@ class GraphicsContext(object): """DrawRotatedText(self, String str, Double x, Double y, Double angle)""" return _gdi_.GraphicsContext_DrawRotatedText(*args, **kwargs) + def GetFullTextExtent(*args, **kwargs): + """GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)""" + return _gdi_.GraphicsContext_GetFullTextExtent(*args, **kwargs) + def GetTextExtent(*args, **kwargs): - """GetTextExtend(self, text) --> (width, height, descent, externalLeading)""" + """GetTextExtent(self, text) --> (width, height)""" return _gdi_.GraphicsContext_GetTextExtent(*args, **kwargs) def GetPartialTextExtents(*args, **kwargs): @@ -5200,7 +5216,9 @@ def GraphicsContext_Create(*args): Create(WindowDC dc) -> GraphicsContext GraphicsContext_Create(Window window) -> GraphicsContext """ - return _gdi_.GraphicsContext_Create(*args) + val = _gdi_.GraphicsContext_Create(*args) + val.__dc = args[0] # save a ref so the dc will not be deleted before self + return val def GraphicsContext_CreateFromNative(*args, **kwargs): """GraphicsContext_CreateFromNative(void context) -> GraphicsContext""" diff --git a/wxPython/src/msw/_gdi_wrap.cpp b/wxPython/src/msw/_gdi_wrap.cpp index e2c5f64fde..a0a646cddc 100644 --- a/wxPython/src/msw/_gdi_wrap.cpp +++ b/wxPython/src/msw/_gdi_wrap.cpp @@ -3618,7 +3618,7 @@ public: void SetRadialGradientBrush( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble , const wxColour &, const wxColour &) {} void SetFont( const wxFont & ) {} - void SetTextColor( const wxColour & ) {} + void SetTextColour( const wxColour & ) {} void StrokePath( const wxGraphicsPath * ) {} void FillPath( const wxGraphicsPath *, int ) {} void DrawPath( const wxGraphicsPath *, int ) {} @@ -3664,6 +3664,16 @@ public: #endif +SWIGINTERN PyObject *wxGraphicsContext_GetTextExtent(wxGraphicsContext *self,wxString const &text){ + wxDouble width = 0.0, + height = 0.0; + self->GetTextExtent(text, &width, &height, NULL, NULL); + // thread wrapers are turned off for this .i file, so no need to acquire GIL... + PyObject* rv = PyTuple_New(2); + PyTuple_SET_ITEM(rv, 0, PyFloat_FromDouble(width)); + PyTuple_SET_ITEM(rv, 1, PyFloat_FromDouble(height)); + return rv; + } SWIGINTERN wxArrayDouble wxGraphicsContext_GetPartialTextExtents(wxGraphicsContext *self,wxString const &text){ wxArrayDouble widths; self->GetPartialTextExtents(text, widths); @@ -25830,7 +25840,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_Create__SWIG_0(PyObject *SWIGUNUSEDPA result = (wxGraphicsContext *)wxGraphicsContext::Create((wxWindowDC const &)*arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -25854,7 +25864,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_Create__SWIG_1(PyObject *SWIGUNUSEDPA result = (wxGraphicsContext *)wxGraphicsContext::Create(arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -25907,7 +25917,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_CreateFromNative(PyObject *SWIGUNUSED result = (wxGraphicsContext *)wxGraphicsContext::CreateFromNative(arg1); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsContext, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -25933,7 +25943,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_CreatePath(PyObject *SWIGUNUSEDPARM(s result = (wxGraphicsPath *)(arg1)->CreatePath(); if (PyErr_Occurred()) SWIG_fail; } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsPath, 0 | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_wxGraphicsPath, SWIG_POINTER_OWN | 0 ); return resultobj; fail: return NULL; @@ -26457,7 +26467,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetRadialGradientBrush(PyObject *SWIG PyObject * obj6 = 0 ; PyObject * obj7 = 0 ; char * kwnames[] = { - (char *) "self",(char *) "xo",(char *) "yo",(char *) "xc",(char *) "yc",(char *) "radius",(char *) "oColor",(char *) "cColor", NULL + (char *) "self",(char *) "xo",(char *) "yo",(char *) "xc",(char *) "yc",(char *) "radius",(char *) "oColour",(char *) "cColour", NULL }; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOOOOOO:GraphicsContext_SetRadialGradientBrush",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; @@ -26549,7 +26559,7 @@ fail: } -SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColour(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; wxColour *arg2 = 0 ; @@ -26562,10 +26572,10 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM (char *) "self",(char *) "col", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_SetTextColor",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_SetTextColour",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_SetTextColor" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_SetTextColour" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); } arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); { @@ -26573,7 +26583,7 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_SetTextColor(PyObject *SWIGUNUSEDPARM if ( ! wxColour_helper(obj1, &arg2)) SWIG_fail; } { - (arg1)->SetTextColor((wxColour const &)*arg2); + (arg1)->SetTextColour((wxColour const &)*arg2); if (PyErr_Occurred()) SWIG_fail; } resultobj = SWIG_Py_Void(); @@ -26844,7 +26854,7 @@ fail: } -SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_GraphicsContext_GetFullTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; wxString *arg2 = 0 ; @@ -26873,10 +26883,10 @@ SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPAR arg4 = &temp4; arg5 = &temp5; arg6 = &temp6; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetFullTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetFullTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext const *""'"); } arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); { @@ -26927,6 +26937,50 @@ fail: } +SWIGINTERN PyObject *_wrap_GraphicsContext_GetTextExtent(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; + wxString *arg2 = 0 ; + PyObject *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool temp2 = false ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "text", NULL + }; + + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:GraphicsContext_GetTextExtent",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_wxGraphicsContext, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GraphicsContext_GetTextExtent" "', expected argument " "1"" of type '" "wxGraphicsContext *""'"); + } + arg1 = reinterpret_cast< wxGraphicsContext * >(argp1); + { + arg2 = wxString_in_helper(obj1); + if (arg2 == NULL) SWIG_fail; + temp2 = true; + } + { + result = (PyObject *)wxGraphicsContext_GetTextExtent(arg1,(wxString const &)*arg2); + if (PyErr_Occurred()) SWIG_fail; + } + resultobj = result; + { + if (temp2) + delete arg2; + } + return resultobj; +fail: + { + if (temp2) + delete arg2; + } + return NULL; +} + + SWIGINTERN PyObject *_wrap_GraphicsContext_GetPartialTextExtents(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxGraphicsContext *arg1 = (wxGraphicsContext *) 0 ; @@ -36009,12 +36063,13 @@ static PyMethodDef SwigMethods[] = { { (char *)"GraphicsContext_SetLinearGradientBrush", (PyCFunction) _wrap_GraphicsContext_SetLinearGradientBrush, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_SetRadialGradientBrush", (PyCFunction) _wrap_GraphicsContext_SetRadialGradientBrush, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_SetFont", (PyCFunction) _wrap_GraphicsContext_SetFont, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"GraphicsContext_SetTextColor", (PyCFunction) _wrap_GraphicsContext_SetTextColor, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GraphicsContext_SetTextColour", (PyCFunction) _wrap_GraphicsContext_SetTextColour, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_StrokePath", (PyCFunction) _wrap_GraphicsContext_StrokePath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_FillPath", (PyCFunction) _wrap_GraphicsContext_FillPath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawPath", (PyCFunction) _wrap_GraphicsContext_DrawPath, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawText", (PyCFunction) _wrap_GraphicsContext_DrawText, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawRotatedText", (PyCFunction) _wrap_GraphicsContext_DrawRotatedText, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"GraphicsContext_GetFullTextExtent", (PyCFunction) _wrap_GraphicsContext_GetFullTextExtent, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_GetTextExtent", (PyCFunction) _wrap_GraphicsContext_GetTextExtent, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_GetPartialTextExtents", (PyCFunction) _wrap_GraphicsContext_GetPartialTextExtents, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"GraphicsContext_DrawBitmap", (PyCFunction) _wrap_GraphicsContext_DrawBitmap, METH_VARARGS | METH_KEYWORDS, NULL}, -- 2.45.2