]> git.saurik.com Git - wxWidgets.git/commitdiff
GetTextExtent --> (width height)
authorRobin Dunn <robin@alldunn.com>
Thu, 26 Oct 2006 03:32:59 +0000 (03:32 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 26 Oct 2006 03:32:59 +0000 (03:32 +0000)
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

index 9f55496112310bd5e52b8da6ed2d386dccdca786..6df55591bbf10b1a6a48c1fb07020091552d61d6 100644 (file)
@@ -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 {