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')
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):
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)
"""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)"""
"""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):
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"""
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 ) {}
#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);
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;
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;
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;
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;
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;
}
-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 ;
(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);
{
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();
}
-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 ;
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);
{
}
+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 ;
{ (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},
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')
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):
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)
"""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)"""
"""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):
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"""
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 ) {}
#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);
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;
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;
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;
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;
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;
}
-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 ;
(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);
{
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();
}
-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 ;
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);
{
}
+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 ;
{ (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},
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')
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):
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)
"""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)"""
"""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):
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"""
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 ) {}
#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);
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;
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;
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;
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;
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;
}
-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 ;
(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);
{
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();
}
-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 ;
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);
{
}
+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 ;
{ (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},