Skip to content
Snippets Groups Projects
scroll.c 35.5 KiB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
    HDC hdc;

    if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
Alexandre Julliard's avatar
Alexandre Julliard committed
    dprintf_scroll( stddeb, "EnableScrollBar: %04x %d %d\n", hwnd, nBar, flags );
Alexandre Julliard's avatar
Alexandre Julliard committed
    flags &= ESB_DISABLE_BOTH;
    if (infoPtr->flags == flags) return FALSE;
    infoPtr->flags = flags;

      /* Redraw the whole scroll bar */
Alexandre Julliard's avatar
Alexandre Julliard committed
    hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
Alexandre Julliard's avatar
Alexandre Julliard committed
    SCROLL_DrawScrollBar( hwnd, hdc, nBar );
    ReleaseDC( hwnd, hdc );
    return TRUE;
}
Alexandre Julliard's avatar
Alexandre Julliard committed


/*************************************************************************
 *           SetScrollInfo32   (USER32.500)
 */
INT32 SetScrollInfo32( HWND32 hwnd, INT32 nBar, LPSCROLLINFO32 lpsi,
                       BOOL32 bRedraw )
{
    SCROLLBAR_INFO *infoPtr;

    if (!(infoPtr = SCROLL_GetScrollInfo(hwnd, nBar))) return 0;

    if (lpsi->fMask & SIF_PAGE) {
	/* fixme: The page size isn't used in the current
	 * scrolling code - it's new for win32
	 */
	infoPtr->Page = lpsi->nPage;
    }
    if (lpsi->fMask & SIF_POS)
        SetScrollPos(hwnd, nBar, lpsi->nPos, FALSE);
    if (lpsi->fMask & SIF_RANGE)
        SetScrollRange(hwnd, nBar, lpsi->nMin, lpsi->nMax, FALSE);
    if (lpsi->fMask & SIF_DISABLENOSCROLL) {
	/* fixme: Disable scroll bar if the new parameters make
	 * the scroll bar unneeded
	 */
	dprintf_scroll(stddeb, "SetScrollInfo: SIF_DISABLENOSCROLL not supported yet\n");
    }

    if (bRedraw) SCROLL_RefreshScrollBar(hwnd, nBar);

    /* return current thumb position */
    return (infoPtr->CurVal);
}


/*************************************************************************
 *           GetScrollInfo32   (USER32.283)
 */
BOOL32 GetScrollInfo32( HWND32 hwnd, INT32 nBar, LPSCROLLINFO32 lpsi )
{
    SCROLLBAR_INFO *infoPtr;

    if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;

    if (lpsi->fMask & SIF_PAGE) lpsi->nPage = infoPtr->Page;
    if (lpsi->fMask & SIF_POS) lpsi->nPos = infoPtr->CurVal;
    if (lpsi->fMask & SIF_TRACKPOS)
        lpsi->nTrackPos = hwndTracking ? uTrackingPos : 0;
    if (lpsi->fMask & SIF_RANGE)
    {
	lpsi->nMin = infoPtr->MinVal;
	lpsi->nMax = infoPtr->MaxVal;
    }
    return TRUE;
}