added GetTextExtent() overload returning wxSize (patch 1631508)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-10 17:25:36 +00:00
parent 192f8ddc0b
commit 6b06226335
2 changed files with 15 additions and 3 deletions

View 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{int* }{descent = NULL}, \param{int* }{externalLeading = NULL},
\param{const wxFont* }{font = NULL}, \param{bool}{ use16 = {\tt false}}} \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 Gets the dimensions of the string as it would be drawn on the
window with the currently selected font. 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} \wxheading{Parameters}
\docparam{string}{String whose extent is to be measured.} \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).}

View File

@@ -856,6 +856,13 @@ public:
const wxFont *theFont = (const wxFont *) NULL) const wxFont *theFont = (const wxFont *) NULL)
const = 0; 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
// ------------------------ // ------------------------