From 3d9fe7b26de338412e6fe34b8a76bfd64d0f265c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 26 May 2002 12:19:53 +0000 Subject: [PATCH] add full 32 bit range support to wxSpinButton/Ctrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 2 ++ src/msw/spinbutt.cpp | 48 ++++++++++++++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index f5a7413ac2..f1658c6f21 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -177,6 +177,8 @@ wxMSW: - improvements to wxWindows applications behaviour when the system colours are changed - fixed wxProgressDialog for ranges > 65535 +- wxSpinButton and wxSpinCtrl now support full 32 bit range (if the version + of comctl32.dll installed on the system supports it) - wxFontEnumerator now returns all fonts, not only TrueType ones - bugs in handling wxFrame styles (border/caption related) fixed - showing a dialog from EVT_RADIOBUTTON handler doesn't lead to an infinite diff --git a/src/msw/spinbutt.cpp b/src/msw/spinbutt.cpp index 215abe2427..c676f9d398 100644 --- a/src/msw/spinbutt.cpp +++ b/src/msw/spinbutt.cpp @@ -179,19 +179,51 @@ wxSize wxSpinButton::DoGetBestSize() const int wxSpinButton::GetValue() const { +#ifdef UDM_GETPOS32 + if ( wxTheApp->GetComCtl32Version() >= 580 ) + { + // use the full 32 bit range if available + return ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0); + } +#endif // UDM_GETPOS32 + + // we're limited to 16 bit return (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0)); } void wxSpinButton::SetValue(int val) { - ::SendMessage(GetHwnd(), UDM_SETPOS, 0, (LPARAM) MAKELONG((short) val, 0)); + // wxSpinButtonBase::SetValue(val); -- no, it is pure virtual + +#ifdef UDM_SETPOS32 + if ( wxTheApp->GetComCtl32Version() >= 580 ) + { + // use the full 32 bit range if available + ::SendMessage(GetHwnd(), UDM_SETPOS32, 0, val); + } + else // we're limited to 16 bit +#endif // UDM_SETPOS32 + { + ::SendMessage(GetHwnd(), UDM_SETPOS, 0, MAKELONG((short) val, 0)); + } } void wxSpinButton::SetRange(int minVal, int maxVal) { wxSpinButtonBase::SetRange(minVal, maxVal); - ::SendMessage(GetHwnd(), UDM_SETRANGE, 0, - (LPARAM) MAKELONG((short)maxVal, (short)minVal)); + +#ifdef UDM_SETRANGE32 + if ( wxTheApp->GetComCtl32Version() >= 471 ) + { + // use the full 32 bit range if available + ::SendMessage(GetHwnd(), UDM_SETRANGE32, minVal, maxVal); + } + else // we're limited to 16 bit +#endif // UDM_SETRANGE32 + { + ::SendMessage(GetHwnd(), UDM_SETRANGE, 0, + (LPARAM) MAKELONG((short)maxVal, (short)minVal)); + } } bool wxSpinButton::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, @@ -214,14 +246,7 @@ bool wxSpinButton::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, bool wxSpinButton::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM *result) { -#ifndef __GNUWIN32__ -#if defined(__BORLANDC__) || defined(__WATCOMC__) LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam; -#elif defined(__VISUALC__) && (__VISUALC__ >= 1000) && (__VISUALC__ < 1020) - LPNM_UPDOWN lpnmud = (LPNM_UPDOWN)lParam; -#else - LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; -#endif if (lpnmud->hdr.hwndFrom != GetHwnd()) // make sure it is the right control return FALSE; @@ -237,9 +262,6 @@ bool wxSpinButton::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM * *result = event.IsAllowed() ? 0 : 1; return processed; -#else // GnuWin32 - return FALSE; -#endif } bool wxSpinButton::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD WXUNUSED(id)) -- 2.45.2