Always handle wxDP_ALLOWNONE ourselves in best size computation

DTM_GETIDEALSIZE doesn't seem to account for it, so we need to do it
ourselves even when using it.

Closes #19120.
This commit is contained in:
Vadim Zeitlin
2021-03-25 14:53:29 +01:00
parent 4f6cf6da5b
commit 8ceca69064

View File

@@ -200,12 +200,15 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const
// Account for the drop-down arrow or spin arrows.
size.x += wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_X, m_parent);
// We need to account for the checkbox, if we have one.
if ( MSWAllowsNone() )
size.x += 3 * GetCharWidth();
}
// We need to account for the checkbox, if we have one -- DTM_GETIDEALSIZE
// doesn't take it into account (actually, it somehow returns _smaller_
// size when using DTS_SHOWNONE than when not using it, which doesn't make
// any sense at all).
if ( MSWAllowsNone() )
size.x += 3 * GetCharWidth();
int scrollY = wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_Y, m_parent);
size.y = wxMax(size.y, scrollY);