X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d95de15439c6bdeab9f42e4e4c8f96effef33762..02a525b385836d41f63e3bbebec869c7b8249026:/src/msw/control.cpp diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 431350abb2..ef6dfe5b98 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -206,6 +206,37 @@ wxSize wxControl::DoGetBestSize() const return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT); } +// This is a helper for all wxControls made with UPDOWN native control. +// In wxMSW it was only wxSpinCtrl derived from wxSpinButton but in +// WinCE of Smartphones this happens also for native wxTextCtrl, +// wxChoice and others. +wxSize wxControl::GetBestSpinerSize(const bool is_vertical) const +{ + // take size according to layout + wxSize bestSize( +#if defined(__SMARTPHONE__) && defined(__WXWINCE__) + 0,GetCharHeight() +#else + GetSystemMetrics(is_vertical ? SM_CXVSCROLL : SM_CXHSCROLL), + GetSystemMetrics(is_vertical ? SM_CYVSCROLL : SM_CYHSCROLL) +#endif + ); + + // 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) + bestSize.y *= 2; + else + bestSize.x *= 2; + + return bestSize; +} + /* static */ wxVisualAttributes wxControl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { @@ -236,25 +267,6 @@ wxControl::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(varian return attrs; } -// This is a helper for all wxControls derived from UPDOWN native control. -// In wxMSW it was only wxSpinCtrl derived from wxSpinButton but in -// Smartphones this happens also for native wxTextCtrl, wxChoice and others. -wxSize wxControl::GetBestSpinerSize(bool is_vertical) -{ - if (is_vertical) - { - // vertical control - return wxSize(GetSystemMetrics(SM_CXVSCROLL), - 2*GetSystemMetrics(SM_CYVSCROLL)); - } - else - { - // horizontal control - return wxSize(2*GetSystemMetrics(SM_CXHSCROLL), - GetSystemMetrics(SM_CYHSCROLL)); - } -} - // ---------------------------------------------------------------------------- // message handling // ----------------------------------------------------------------------------