Fix wxSpinCtrl arrow position in RTL layout and High DPI

Just use hardcoded 2px overlap between the text control and the spin
buttons, as it doesn't seem to depend on the DPI and works in both LTR
and RTL modes, unlike the existing code, which claimed to work but
actually didn't.

Closes https://github.com/wxWidgets/wxWidgets/pull/1660
This commit is contained in:
Maarten Bent
2019-11-22 00:02:46 +01:00
committed by Vadim Zeitlin
parent a77b8f85bf
commit 84edda2ba0

View File

@@ -728,17 +728,9 @@ bool wxSpinCtrl::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM *re
int wxSpinCtrl::GetOverlap() const
{
if ( !GetHwnd() )
{
// We can be called from GetSizeFromTextSize() before the window is
// created and still need to return something reasonable in this case,
// so return the overlap equal to the default border size.
return FromDIP(2);
}
// The sign here is correct because the button is positioned inside its
// buddy window.
return wxGetWindowRect(m_hwndBuddy).right - wxGetWindowRect(GetHwnd()).left;
// Don't use FromDIP here. The gap between the control border and the
// button seems to be always 1px.
return 2;
}
wxSize wxSpinCtrl::DoGetBestSize() const