mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
Fix many of the scrollbar issues. However, MDI Scrollbars are still not working perfectly. Patch by tinus <o112w8r02@sneakemail.com>. Fixes bug 606
svn path=/trunk/; revision=14946
This commit is contained in:
parent
dff743f85a
commit
6c331c3529
2 changed files with 32 additions and 7 deletions
|
@ -2034,8 +2034,16 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
|
||||||
#ifndef __REACTOS__
|
#ifndef __REACTOS__
|
||||||
HWND *list;
|
HWND *list;
|
||||||
#else
|
#else
|
||||||
|
WINDOWINFO WindowInfo;
|
||||||
HWND hWndCurrent;
|
HWND hWndCurrent;
|
||||||
#endif
|
#endif
|
||||||
|
/* The rectangle returned by GetClientRect always has 0,0 as top left
|
||||||
|
* because it is in client coordinates. The rectangles returned by
|
||||||
|
* GetWindowRect are in screen coordinates to make this complicated.
|
||||||
|
*
|
||||||
|
* Apparently (in ReactOS at least) the rcClient returned by GetWindowInfo
|
||||||
|
* is in screen coordinates too.
|
||||||
|
*/
|
||||||
|
|
||||||
GetClientRect( hwnd, &clientRect );
|
GetClientRect( hwnd, &clientRect );
|
||||||
SetRectEmpty( &childRect );
|
SetRectEmpty( &childRect );
|
||||||
|
@ -2063,6 +2071,13 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
|
||||||
HeapFree( GetProcessHeap(), 0, list );
|
HeapFree( GetProcessHeap(), 0, list );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
WindowInfo.cbSize = sizeof(WindowInfo);
|
||||||
|
if (!GetWindowInfo(hwnd, &WindowInfo))
|
||||||
|
{
|
||||||
|
ERR("Can't get window info\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hWndCurrent = GetWindow(hwnd, GW_CHILD);
|
hWndCurrent = GetWindow(hwnd, GW_CHILD);
|
||||||
while (hWndCurrent != NULL)
|
while (hWndCurrent != NULL)
|
||||||
{
|
{
|
||||||
|
@ -2077,6 +2092,9 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
|
||||||
RECT WindowRect;
|
RECT WindowRect;
|
||||||
|
|
||||||
GetWindowRect( hWndCurrent, &WindowRect );
|
GetWindowRect( hWndCurrent, &WindowRect );
|
||||||
|
OffsetRect(&WindowRect,
|
||||||
|
-WindowInfo.rcClient.left,
|
||||||
|
-WindowInfo.rcClient.top);
|
||||||
UnionRect( &childRect, &WindowRect, &childRect );
|
UnionRect( &childRect, &WindowRect, &childRect );
|
||||||
}
|
}
|
||||||
hWndCurrent = GetWindow(hWndCurrent, GW_HWNDNEXT);
|
hWndCurrent = GetWindow(hWndCurrent, GW_HWNDNEXT);
|
||||||
|
@ -2086,23 +2104,30 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
|
||||||
|
|
||||||
/* set common info values */
|
/* set common info values */
|
||||||
info.cbSize = sizeof(info);
|
info.cbSize = sizeof(info);
|
||||||
info.fMask = SIF_POS | SIF_RANGE;
|
info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
|
||||||
|
|
||||||
/* set the specific */
|
/* set the specific scrollbars*/
|
||||||
|
/* Note how we set nPos to 0 because we scroll the clients instead of
|
||||||
|
* the window, and we set nPage to 1 bigger than the clientRect because
|
||||||
|
* otherwise the scrollbar never disables. This causes a somewhat ugly
|
||||||
|
* effect though while scrolling.
|
||||||
|
*/
|
||||||
switch( scroll )
|
switch( scroll )
|
||||||
{
|
{
|
||||||
case SB_BOTH:
|
case SB_BOTH:
|
||||||
case SB_HORZ:
|
case SB_HORZ:
|
||||||
info.nMin = childRect.left;
|
info.nMin = childRect.left;
|
||||||
info.nMax = childRect.right - clientRect.right;
|
info.nMax = childRect.right;
|
||||||
info.nPos = clientRect.left - childRect.left;
|
info.nPos = 0;
|
||||||
|
info.nPage = 1 + clientRect.right - clientRect.left;
|
||||||
SetScrollInfo(hwnd, SB_HORZ, &info, TRUE);
|
SetScrollInfo(hwnd, SB_HORZ, &info, TRUE);
|
||||||
if (scroll == SB_HORZ) break;
|
if (scroll == SB_HORZ) break;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case SB_VERT:
|
case SB_VERT:
|
||||||
info.nMin = childRect.top;
|
info.nMin = childRect.top;
|
||||||
info.nMax = childRect.bottom - clientRect.bottom;
|
info.nMax = childRect.bottom;
|
||||||
info.nPos = clientRect.top - childRect.top;
|
info.nPos = 0;
|
||||||
|
info.nPage = 1 + clientRect.bottom - clientRect.top;
|
||||||
SetScrollInfo(hwnd, SB_VERT, &info, TRUE);
|
SetScrollInfo(hwnd, SB_VERT, &info, TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,7 +360,7 @@ IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedr
|
||||||
/* Check if the scrollbar should be hidden or disabled */
|
/* Check if the scrollbar should be hidden or disabled */
|
||||||
if (0 != (lpsi->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL)))
|
if (0 != (lpsi->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL)))
|
||||||
{
|
{
|
||||||
if (Info->nMin >= Info->nMax - max(Info->nPage - 1, 0))
|
if (Info->nMin >= (int)(Info->nMax - max(Info->nPage - 1, 0)))
|
||||||
{
|
{
|
||||||
/* Hide or disable scroll-bar */
|
/* Hide or disable scroll-bar */
|
||||||
if (0 != (lpsi->fMask & SIF_DISABLENOSCROLL))
|
if (0 != (lpsi->fMask & SIF_DISABLENOSCROLL))
|
||||||
|
|
Loading…
Reference in a new issue