From 59c516a34ad204cf096798b9176425655aaa0d18 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sun, 5 Nov 2006 21:37:32 +0000 Subject: [PATCH] New DrawText methods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43091 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_graphics.i | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/wxPython/src/_graphics.i b/wxPython/src/_graphics.i index 2eafd0be1b..e4ca583198 100644 --- a/wxPython/src/_graphics.i +++ b/wxPython/src/_graphics.i @@ -628,6 +628,10 @@ public: static wxGraphicsContext* Create( const wxWindowDC& dc); static wxGraphicsContext* Create( wxWindow* window ) ; + DocDeclStrName( + static wxGraphicsContext* , Create(), + "Create a lightwieght context that can be used for measuring text only.", "", + CreateMeasuringContext); %newobject CreateFromNative; DocDeclStr( @@ -790,15 +794,30 @@ this context.", ""); "Draws the path by first filling and then stroking.", ""); - DocDeclStr( - virtual void , DrawText( const wxString &str, wxDouble x, wxDouble y ), - "Draws a text at the defined position.", ""); - + %extend { + DocStr(DrawText, + "Draws a text string at the defined position.", ""); + void DrawText( const wxString &str, wxDouble x, wxDouble y, + const wxGraphicsBrush& backgroundBrush = wxNullGraphicsBrush ) + { + if ( !backgroundBrush.IsNull() ) + self->DrawText(str, x, y, backgroundBrush); + else + self->DrawText(str, x, y); + } - DocDeclStrName( - virtual void , DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ), - "Draws a text at the defined position, at the given angle.", "", - DrawRotatedText); + DocStr(DrawRotatedText, + "", ""); + void DrawRotatedText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, + const wxGraphicsBrush& backgroundBrush = wxNullGraphicsBrush ) + { + if ( !backgroundBrush.IsNull() ) + self->DrawText(str, x, y, angle, backgroundBrush); + else + self->DrawText(str, x, y, angle); + } + } + DocDeclAStrName( @@ -939,6 +958,9 @@ public : virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) ; virtual wxGraphicsContext * CreateContext( wxWindow* window ); + // create a context that can be used for measuring texts only, no drawing allowed + virtual wxGraphicsContext * CreateMeasuringContext(); + %newobject CreateContextFromNativeContext; virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); -- 2.45.2