From 752d967cfdd663a15f719afec0ab6e70f0d0401c Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 26 Oct 2006 03:32:59 +0000 Subject: [PATCH] GetTextExtent --> (width height) GetFullTextExtent --> (width, height, decent, externalLeading) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42422 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_graphics.i | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/wxPython/src/_graphics.i b/wxPython/src/_graphics.i index 9f55496112..6df55591bb 100644 --- a/wxPython/src/_graphics.i +++ b/wxPython/src/_graphics.i @@ -456,14 +456,33 @@ public: DrawRotatedText); - DocDeclAStr( + DocDeclAStrName( virtual void , GetTextExtent( const wxString &text, wxDouble *OUTPUT /*width*/, wxDouble *OUTPUT /*height*/, wxDouble *OUTPUT /*descent*/, wxDouble *OUTPUT /*externalLeading*/ ) const , - "GetTextExtent(self, text) --> (width, height, descent, externalLeading)", - "", ""); + "GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)", + "", "", + GetFullTextExtent); + + %extend { + DocAStr(GetTextExtent, + "GetTextExtent(self, text) --> (width, height)", + "", ""); + + PyObject* GetTextExtent( const wxString &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; + } + } %extend { -- 2.47.2