X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1bce253a23047c6153e130d02e776d3d34b05793..77c8efc8c37da6d6a5e2e8022d21d1cd7d76371d:/src/common/textmeasurecmn.cpp?ds=sidebyside diff --git a/src/common/textmeasurecmn.cpp b/src/common/textmeasurecmn.cpp index df91ca38bd..4db3b892fb 100644 --- a/src/common/textmeasurecmn.cpp +++ b/src/common/textmeasurecmn.cpp @@ -53,6 +53,13 @@ wxTextMeasureBase::wxTextMeasureBase(const wxWindow *win, const wxFont *theFont) m_useDCImpl = false; } +wxFont wxTextMeasureBase::GetFont() const +{ + return m_font ? *m_font + : m_win ? m_win->GetFont() + : m_dc->GetFont(); +} + void wxTextMeasureBase::CallGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, @@ -158,18 +165,15 @@ void wxTextMeasureBase::GetMultiLineTextExtent(const wxString& text, *heightOneLine = heightLine; } -void wxTextMeasureBase::GetLargestStringExtent(const wxVector& strings, - wxCoord *width, - wxCoord *height) +wxSize wxTextMeasureBase::GetLargestStringExtent(size_t n, + const wxString* strings) { MeasuringGuard guard(*this); wxCoord w, h, widthMax = 0, heightMax = 0; - for ( wxVector::const_iterator i = strings.begin(); - i != strings.end(); - ++i ) + for ( size_t i = 0; i < n; ++i ) { - CallGetTextExtent(*i, &w, &h); + CallGetTextExtent(strings[i], &w, &h); if ( w > widthMax ) widthMax = w; @@ -177,10 +181,7 @@ void wxTextMeasureBase::GetLargestStringExtent(const wxVector& strings heightMax = h; } - if ( width ) - *width = widthMax; - if ( height ) - *height = heightMax; + return wxSize(widthMax, heightMax); } bool wxTextMeasureBase::GetPartialTextExtents(const wxString& text,