Make SetScrollRange behave like GetScrollRange does, i.e. send
messages to the control for SB_CTL case.
This commit is contained in:
parent
8b0b70ab50
commit
674c302c85
|
@ -1211,6 +1211,28 @@ LPINT lpMax /* [out] Where to store maximum value */)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* 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
|
* ScrollBarWndProc
|
||||||
|
@ -1340,14 +1362,17 @@ static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam,
|
||||||
return SCROLL_GetScrollPos(hwnd, SB_CTL);
|
return SCROLL_GetScrollPos(hwnd, SB_CTL);
|
||||||
|
|
||||||
case SBM_SETRANGE16:
|
case SBM_SETRANGE16:
|
||||||
SetScrollRange( hwnd, SB_CTL, LOWORD(lParam), HIWORD(lParam),
|
if (wParam) message = SBM_SETRANGEREDRAW;
|
||||||
wParam /* FIXME: Is this correct? */ );
|
wParam = LOWORD(lParam);
|
||||||
return 0;
|
lParam = HIWORD(lParam);
|
||||||
|
/* fall through */
|
||||||
|
case SBM_SETRANGEREDRAW:
|
||||||
case SBM_SETRANGE:
|
case SBM_SETRANGE:
|
||||||
{
|
{
|
||||||
INT oldPos = SCROLL_GetScrollPos( hwnd, SB_CTL );
|
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;
|
if (oldPos != SCROLL_GetScrollPos( hwnd, SB_CTL )) return oldPos;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1363,14 +1388,6 @@ static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam,
|
||||||
case SBM_ENABLE_ARROWS:
|
case SBM_ENABLE_ARROWS:
|
||||||
return EnableScrollBar( hwnd, SB_CTL, wParam );
|
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:
|
case SBM_SETSCROLLINFO:
|
||||||
return SetScrollInfo( hwnd, SB_CTL, (SCROLLINFO *)lParam, wParam );
|
return SetScrollInfo( hwnd, SB_CTL, (SCROLLINFO *)lParam, wParam );
|
||||||
|
|
||||||
|
@ -1665,14 +1682,19 @@ INT minVal, /* [in] New minimum value */
|
||||||
INT maxVal, /* [in] New maximum value */
|
INT maxVal, /* [in] New maximum value */
|
||||||
BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */)
|
BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */)
|
||||||
{
|
{
|
||||||
SCROLLINFO info;
|
BOOL ret;
|
||||||
|
|
||||||
info.cbSize = sizeof(info);
|
TRACE("hwnd=%p nBar=%d min=%d max=%d\n", hwnd, nBar, minVal, maxVal);
|
||||||
info.nMin = minVal;
|
|
||||||
info.nMax = maxVal;
|
/* Refer SB_CTL requests to the window */
|
||||||
info.fMask = SIF_RANGE;
|
if (nBar == SB_CTL)
|
||||||
SetScrollInfo( hwnd, nBar, &info, bRedraw );
|
ret = SendMessageW(hwnd, SBM_SETRANGE, minVal, maxVal);
|
||||||
return TRUE;
|
else
|
||||||
|
ret = SCROLL_SetScrollRange(hwnd, nBar, minVal, maxVal);
|
||||||
|
|
||||||
|
if (bRedraw)
|
||||||
|
SCROLL_RefreshScrollBar( hwnd, SB_CTL, TRUE, TRUE );
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue