From b081046a6646bba07fb953adb06ebfe8ffffc3f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Wed, 18 Aug 2004 09:15:49 +0000 Subject: [PATCH] Fix for the undocumented holes in spiner sizes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28826 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/control.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/msw/control.cpp b/src/msw/control.cpp index efe188ffba..d00df75d1d 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -212,18 +212,23 @@ wxSize wxControl::DoGetBestSize() const // wxChoice and others. wxSize wxControl::GetBestSpinerSize(const bool is_vertical) const { + // take size according to layout + wxSize bestSize(GetSystemMetrics(is_vertical ? SM_CXVSCROLL : SM_CXHSCROLL), + GetSystemMetrics(is_vertical ? SM_CYVSCROLL : SM_CYHSCROLL)); + + // correct size as for undocumented MSW variants cases (WinCE and perhaps others) + if (bestSize.x==0) + bestSize.x = bestSize.y; + if (bestSize.y==0) + bestSize.y = bestSize.x; + + // double size according to layout if (is_vertical) - { - // vertical control - return wxSize(GetSystemMetrics(SM_CXVSCROLL), - 2*GetSystemMetrics(SM_CYVSCROLL)); - } + bestSize.y *= 2; else - { - // horizontal control - return wxSize(2*GetSystemMetrics(SM_CXHSCROLL), - GetSystemMetrics(SM_CYHSCROLL)); - } + bestSize.x *= 2; + + return bestSize; } /* static */ wxVisualAttributes -- 2.50.0