From: Julian Smart Date: Mon, 30 May 2005 08:45:59 +0000 (+0000) Subject: Applied patch [ 1207531 ] Fix for wxCalendarCtrl being UNUSABLE with some languages X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f6f735d3c225ac1d308dfaf3c57e1af5e0db10b6 Applied patch [ 1207531 ] Fix for wxCalendarCtrl being UNUSABLE with some languages git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index 13645353de..f21d61a1c0 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -840,10 +840,22 @@ void wxCalendarCtrl::RecalcGeometry() wxClientDC dc(this); dc.SetFont(GetFont()); + int day = 10; - // determine the column width (we assume that the weekday names are always - // wider (in any language) than the numbers) + // determine the column width (weekday names are not necessarily wider + // than the numbers (in some languages), so let's not assume that they are) m_widthCol = 0; + for ( day = 10; day <= 31; day++) + { + wxCoord width; + dc.GetTextExtent(wxString::Format(wxT("%d"), day), &width, &m_heightRow); + if ( width > m_widthCol ) + { + // 1.5 times the width gives nice margins even if the weekday + // names are short + m_widthCol = width+width/2; + } + } wxDateTime::WeekDay wd; for ( wd = wxDateTime::Sun; wd < wxDateTime::Inv_WeekDay; wxNextWDay(wd) ) {