]> git.saurik.com Git - wxWidgets.git/commitdiff
added GetTextExtent() overload returning wxSize (patch 1631508)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 10 Mar 2007 17:25:36 +0000 (17:25 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 10 Mar 2007 17:25:36 +0000 (17:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/window.tex
include/wx/window.h

index e170cc92da2dcd51806a3cd5d2d97d2532eea65e..249de5677993566b903dbc96a8e30fc072ef0de6 100644 (file)
@@ -1294,20 +1294,25 @@ Return the sizer associated with the window by a previous call to
 
 \membersection{wxWindow::GetTextExtent}\label{wxwindowgettextextent}
 
 
 \membersection{wxWindow::GetTextExtent}\label{wxwindowgettextextent}
 
-\constfunc{virtual void}{GetTextExtent}{\param{const wxString\& }{string}, \param{int* }{x}, \param{int* }{y},
+\constfunc{virtual void}{GetTextExtent}{\param{const wxString\& }{string}, \param{int* }{w}, \param{int* }{h},
  \param{int* }{descent = NULL}, \param{int* }{externalLeading = NULL},
  \param{const wxFont* }{font = NULL}, \param{bool}{ use16 = {\tt false}}}
 
  \param{int* }{descent = NULL}, \param{int* }{externalLeading = NULL},
  \param{const wxFont* }{font = NULL}, \param{bool}{ use16 = {\tt false}}}
 
+\constfunc{wxSize}{GetTextExtent}{\param{const wxString\& }{string}}
+
 Gets the dimensions of the string as it would be drawn on the
 window with the currently selected font.
 
 Gets the dimensions of the string as it would be drawn on the
 window with the currently selected font.
 
+The text extent is returned in \arg{w} and \arg{h} pointers (first form) or as a 
+\helpref{wxSize}{wxsize} object (second form).
+
 \wxheading{Parameters}
 
 \docparam{string}{String whose extent is to be measured.}
 
 \wxheading{Parameters}
 
 \docparam{string}{String whose extent is to be measured.}
 
-\docparam{x}{Return value for width.}
+\docparam{w}{Return value for width.}
 
 
-\docparam{y}{Return value for height.}
+\docparam{h}{Return value for height.}
 
 \docparam{descent}{Return value for descent (optional).}
 
 
 \docparam{descent}{Return value for descent (optional).}
 
index 04b76e9670a583402b23922a02a4421a6106e96e..733f3d02da64c8de7f062dd91507e7d9695884a3 100644 (file)
@@ -856,6 +856,13 @@ public:
                                const wxFont *theFont = (const wxFont *) NULL)
                                const = 0;
 
                                const wxFont *theFont = (const wxFont *) NULL)
                                const = 0;
 
+    wxSize GetTextExtent(const wxString& string) const
+    {
+        wxCoord w, h;
+        GetTextExtent(string, &w, &h);
+        return wxSize(w, h);
+    }
+
     // client <-> screen coords
     // ------------------------
 
     // client <-> screen coords
     // ------------------------