From 028285e4af7232447cbb88caec61a3129cde02a7 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 14 Jun 2006 11:42:01 +0000 Subject: [PATCH] wxCalendarCtrl workaround for occasional wrong combobox height reporting on wxMSW git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39715 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/calctrl.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index cb0b01b5f8..e5e98717bc 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -793,16 +793,27 @@ void wxCalendarCtrl::DoMoveWindow(int x, int y, int width, int height) wxSize sizeCombo = m_comboMonth->GetSize(); wxSize sizeStatic = m_staticMonth->GetSize(); wxSize sizeSpin = m_spinYear->GetSize(); - int dy = (sizeCombo.y - sizeStatic.y) / 2; + + // wxMSW sometimes reports the wrong combo height, + // so on this platform we'll use the spin control + // height instead. +#ifdef __WXMSW__ + int maxHeight = sizeSpin.y; + int requiredSpinHeight = -1; +#else + int maxHeight = sizeCombo.y; + int requiredSpinHeight = sizeCombo.y; +#endif + int dy = (maxHeight - sizeStatic.y) / 2; m_comboMonth->Move(x, y); - m_staticMonth->SetSize(x, y + dy, sizeCombo.x, sizeStatic.y); + m_staticMonth->SetSize(x, y + dy, sizeCombo.x, -1, sizeStatic.y); int xDiff = sizeCombo.x + HORZ_MARGIN; - m_spinYear->SetSize(x + xDiff, y, width - xDiff, sizeCombo.y); + m_spinYear->SetSize(x + xDiff, y, width - xDiff, requiredSpinHeight); m_staticYear->SetSize(x + xDiff, y + dy, width - xDiff, sizeStatic.y); - yDiff = wxMax(sizeSpin.y, sizeCombo.y) + VERT_MARGIN; + yDiff = wxMax(sizeSpin.y, maxHeight) + VERT_MARGIN; } else // no controls on the top { -- 2.45.2