Make SetScrollRange behave like GetScrollRange does
Dmitry Timoshkov
dmitry at baikal.ru
Wed Jun 9 01:19:47 CDT 2004
Hello,
SetScrollRange should behave same way as GetScrollRange is implemented
now, i.e. send messages to the control for SB_CTL case. Applications
which subclass scroll bar might depend on that.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Make SetScrollRange behave like GetScrollRange does, i.e. send
messages to the control for SB_CTL case.
--- cvs/hq/wine/controls/scroll.c 2004-05-06 16:29:41.000000000 +0900
+++ wine/controls/scroll.c 2004-06-09 14:22:31.000000000 +0900
@@ -1211,6 +1211,28 @@ LPINT lpMax /* [out] Where to store maxi
}
+/*************************************************************************
+ * SCROLL_SetScrollRange
+ *
+ */
+static BOOL SCROLL_SetScrollRange(
+ HWND hwnd, /* [in] Handle of window */
+ INT nBar, /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */
+ INT minVal, /* [out] minimum value */
+ INT maxVal /* [out] maximum value */)
+{
+ LPSCROLLBAR_INFO infoPtr = SCROLL_GetScrollBarInfo(hwnd, nBar);
+
+ TRACE("hwnd=%p nBar=%d min=%d max=%d\n", hwnd, nBar, minVal, maxVal);
+
+ if (infoPtr)
+ {
+ infoPtr->minVal = minVal;
+ infoPtr->maxVal = maxVal;
+ }
+ return infoPtr ? TRUE : FALSE;
+}
+
/***********************************************************************
* ScrollBarWndProc
@@ -1340,14 +1362,17 @@ static LRESULT WINAPI ScrollBarWndProc(
return SCROLL_GetScrollPos(hwnd, SB_CTL);
case SBM_SETRANGE16:
- SetScrollRange( hwnd, SB_CTL, LOWORD(lParam), HIWORD(lParam),
- wParam /* FIXME: Is this correct? */ );
- return 0;
-
+ if (wParam) message = SBM_SETRANGEREDRAW;
+ wParam = LOWORD(lParam);
+ lParam = HIWORD(lParam);
+ /* fall through */
+ case SBM_SETRANGEREDRAW:
case SBM_SETRANGE:
{
INT oldPos = SCROLL_GetScrollPos( hwnd, SB_CTL );
- SetScrollRange( hwnd, SB_CTL, wParam, lParam, FALSE );
+ SCROLL_SetScrollRange( hwnd, SB_CTL, wParam, lParam );
+ if (message == SBM_SETRANGEREDRAW)
+ SCROLL_RefreshScrollBar( hwnd, SB_CTL, TRUE, TRUE );
if (oldPos != SCROLL_GetScrollPos( hwnd, SB_CTL )) return oldPos;
}
return 0;
@@ -1363,14 +1388,6 @@ static LRESULT WINAPI ScrollBarWndProc(
case SBM_ENABLE_ARROWS:
return EnableScrollBar( hwnd, SB_CTL, wParam );
- case SBM_SETRANGEREDRAW:
- {
- INT oldPos = SCROLL_GetScrollPos( hwnd, SB_CTL );
- SetScrollRange( hwnd, SB_CTL, wParam, lParam, TRUE );
- if (oldPos != SCROLL_GetScrollPos( hwnd, SB_CTL )) return oldPos;
- }
- return 0;
-
case SBM_SETSCROLLINFO:
return SetScrollInfo( hwnd, SB_CTL, (SCROLLINFO *)lParam, wParam );
@@ -1665,14 +1682,19 @@ INT minVal, /* [in] New minimum value */
INT maxVal, /* [in] New maximum value */
BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */)
{
- SCROLLINFO info;
+ BOOL ret;
- info.cbSize = sizeof(info);
- info.nMin = minVal;
- info.nMax = maxVal;
- info.fMask = SIF_RANGE;
- SetScrollInfo( hwnd, nBar, &info, bRedraw );
- return TRUE;
+ TRACE("hwnd=%p nBar=%d min=%d max=%d\n", hwnd, nBar, minVal, maxVal);
+
+ /* Refer SB_CTL requests to the window */
+ if (nBar == SB_CTL)
+ ret = SendMessageW(hwnd, SBM_SETRANGE, minVal, maxVal);
+ else
+ ret = SCROLL_SetScrollRange(hwnd, nBar, minVal, maxVal);
+
+ if (bRedraw)
+ SCROLL_RefreshScrollBar( hwnd, SB_CTL, TRUE, TRUE );
+ return ret;
}
More information about the wine-patches
mailing list