mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
Scrollbar improvements
svn path=/trunk/; revision=3885
This commit is contained in:
parent
afe60dcdbf
commit
69ccaa8434
4 changed files with 164 additions and 162 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: scrollbar.c,v 1.4 2002/11/24 20:13:43 jfilby Exp $
|
/* $Id: scrollbar.c,v 1.5 2002/12/21 19:23:50 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -84,7 +84,7 @@ WINBOOL STDCALL
|
||||||
GetScrollBarInfo (HWND hwnd, LONG idObject, PSCROLLBARINFO psbi)
|
GetScrollBarInfo (HWND hwnd, LONG idObject, PSCROLLBARINFO psbi)
|
||||||
{
|
{
|
||||||
int ret = NtUserGetScrollBarInfo (hwnd, idObject, psbi);
|
int ret = NtUserGetScrollBarInfo (hwnd, idObject, psbi);
|
||||||
DbgPrint("GetScrollBarInfo: psbi: %08x\n", psbi);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,8 @@ SCROLL_DrawInterior (HWND hwnd, HDC hdc, INT nBar,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* hBrush = DefWndControlColor (hdc, CTLCOLOR_SCROLLBAR); */
|
/* hBrush = NtUserGetControlColor (hdc, CTLCOLOR_SCROLLBAR); FIXME */ /* DefWndControlColor */
|
||||||
|
hBrush = GetSysColorBrush(COLOR_SCROLLBAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
hSavePen = SelectObject (hdc, GetSysColorPen (COLOR_WINDOWFRAME));
|
hSavePen = SelectObject (hdc, GetSysColorPen (COLOR_WINDOWFRAME));
|
||||||
|
@ -119,7 +120,7 @@ SCROLL_DrawInterior (HWND hwnd, HDC hdc, INT nBar,
|
||||||
|
|
||||||
/* Calculate the scroll rectangle */
|
/* Calculate the scroll rectangle */
|
||||||
r = *rect;
|
r = *rect;
|
||||||
DbgPrint ("[DrawInterior:r1:%d,%d,%d,%d]", r.left, r.top, r.right, r.bottom);
|
|
||||||
if (nBar == SB_VERT)
|
if (nBar == SB_VERT)
|
||||||
{
|
{
|
||||||
r.top += arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
|
r.top += arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
|
||||||
|
@ -162,7 +163,6 @@ SCROLL_DrawInterior (HWND hwnd, HDC hdc, INT nBar,
|
||||||
r.right = r.left + thumbSize;
|
r.right = r.left + thumbSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
DbgPrint ("[DrawInterior:r2:%d,%d,%d,%d]", r.left, r.top, r.right, r.bottom);
|
|
||||||
/* Draw the thumb */
|
/* Draw the thumb */
|
||||||
DrawEdge (hdc, &r, EDGE_RAISED, BF_RECT | BF_MIDDLE);
|
DrawEdge (hdc, &r, EDGE_RAISED, BF_RECT | BF_MIDDLE);
|
||||||
|
|
||||||
|
@ -178,26 +178,24 @@ SCROLL_DrawMovingThumb (HDC hdc, RECT * rect, int nBar,
|
||||||
{
|
{
|
||||||
INT pos = SCROLL_TrackingPos;
|
INT pos = SCROLL_TrackingPos;
|
||||||
INT max_size;
|
INT max_size;
|
||||||
DbgPrint ("[SCROLL_DrawMovingThumb:0 - no PAUSE!]");
|
|
||||||
/* for (;;); */
|
|
||||||
if (nBar == SB_VERT)
|
if (nBar == SB_VERT)
|
||||||
max_size = rect->bottom - rect->top;
|
max_size = rect->bottom - rect->top;
|
||||||
else if (nBar == SB_HORZ)
|
else if (nBar == SB_HORZ)
|
||||||
max_size = rect->right - rect->left;
|
max_size = rect->right - rect->left;
|
||||||
|
|
||||||
max_size -= (arrowSize - SCROLL_ARROW_THUMB_OVERLAP) + thumbSize;
|
max_size -= (arrowSize - SCROLL_ARROW_THUMB_OVERLAP) + thumbSize;
|
||||||
DbgPrint ("[SCROLL_DrawMovingThumb:1]");
|
|
||||||
if (pos < (arrowSize - SCROLL_ARROW_THUMB_OVERLAP))
|
if (pos < (arrowSize - SCROLL_ARROW_THUMB_OVERLAP))
|
||||||
pos = (arrowSize - SCROLL_ARROW_THUMB_OVERLAP);
|
pos = (arrowSize - SCROLL_ARROW_THUMB_OVERLAP);
|
||||||
else if (pos > max_size)
|
else if (pos > max_size)
|
||||||
pos = max_size;
|
pos = max_size;
|
||||||
DbgPrint ("[SCROLL_DrawMovingThumb:2]");
|
|
||||||
SCROLL_DrawInterior (SCROLL_TrackingWin, hdc, SCROLL_TrackingBar,
|
SCROLL_DrawInterior (SCROLL_TrackingWin, hdc, SCROLL_TrackingBar,
|
||||||
rect, arrowSize, thumbSize, pos,
|
rect, arrowSize, thumbSize, pos,
|
||||||
0, FALSE, FALSE);
|
0, FALSE, FALSE);
|
||||||
DbgPrint ("[SCROLL_DrawMovingThumb:3]");
|
|
||||||
SCROLL_MovingThumb = !SCROLL_MovingThumb;
|
SCROLL_MovingThumb = !SCROLL_MovingThumb;
|
||||||
DbgPrint ("[SCROLL_DrawMovingThumb:e]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ported from WINE20020904 */
|
/* Ported from WINE20020904 */
|
||||||
|
@ -229,7 +227,7 @@ SCROLL_DrawArrows (HDC hdc, PSCROLLBARINFO info,
|
||||||
|
|
||||||
DrawFrameControl (hdc, &r, DFC_SCROLL,
|
DrawFrameControl (hdc, &r, DFC_SCROLL,
|
||||||
scrollDirFlag1 | (top_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0)
|
scrollDirFlag1 | (top_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0)
|
||||||
/* | (info->flags&ESB_DISABLE_LTUP ? DFCS_INACTIVE : 0) */
|
/* | (info.flags&ESB_DISABLE_LTUP ? DFCS_INACTIVE : 0) */
|
||||||
);
|
);
|
||||||
r = *rect;
|
r = *rect;
|
||||||
if (nBar == SB_VERT)
|
if (nBar == SB_VERT)
|
||||||
|
@ -238,7 +236,7 @@ SCROLL_DrawArrows (HDC hdc, PSCROLLBARINFO info,
|
||||||
r.left = r.right - arrowSize;
|
r.left = r.right - arrowSize;
|
||||||
DrawFrameControl (hdc, &r, DFC_SCROLL,
|
DrawFrameControl (hdc, &r, DFC_SCROLL,
|
||||||
scrollDirFlag2 | (bottom_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0)
|
scrollDirFlag2 | (bottom_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0)
|
||||||
/* | (info->flags&ESB_DISABLE_RTDN ? DFCS_INACTIVE : 0) */
|
/* | (info.flags&ESB_DISABLE_RTDN ? DFCS_INACTIVE : 0) */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,64 +246,62 @@ void
|
||||||
SCROLL_DrawScrollBar (HWND hwnd, HDC hdc, INT nBar,
|
SCROLL_DrawScrollBar (HWND hwnd, HDC hdc, INT nBar,
|
||||||
BOOL arrows, BOOL interior)
|
BOOL arrows, BOOL interior)
|
||||||
{
|
{
|
||||||
INT arrowSize, thumbSize, thumbPos;
|
INT arrowSize = 20, thumbSize = 20, thumbPos = 1; /* FIXME: Should not be assign values, but rather obtaining */
|
||||||
/* WND *wndPtr = WIN_FindWndPtr( hwnd ); */
|
/* WND *wndPtr = WIN_FindWndPtr( hwnd ); */
|
||||||
PSCROLLBARINFO info;
|
SCROLLBARINFO info;
|
||||||
BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
|
BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
|
||||||
DbgPrint("[SCROLL_DrawScrollBar:0]");
|
|
||||||
GetScrollBarInfo (hwnd, nBar, info);
|
info.cbSize = sizeof(SCROLLBARINFO);
|
||||||
DbgPrint("[SCROLL_DrawScrollBar:1]");
|
GetScrollBarInfo (hwnd, nBar, &info);
|
||||||
DbgPrint("info: %08x\n", info);
|
|
||||||
DbgPrint("info->rcScrollBar: %d,%d,%d,%d\n", info->rcScrollBar.left, info->rcScrollBar.top, info->rcScrollBar.right, info->rcScrollBar.bottom);
|
|
||||||
/* if (!wndPtr || !info ||
|
/* if (!wndPtr || !info ||
|
||||||
((nBar == SB_VERT) && !(wndPtr->dwStyle & WS_VSCROLL)) ||
|
((nBar == SB_VERT) && !(wndPtr->dwStyle & WS_VSCROLL)) ||
|
||||||
((nBar == SB_HORZ) && !(wndPtr->dwStyle & WS_HSCROLL))) goto END;
|
((nBar == SB_HORZ) && !(wndPtr->dwStyle & WS_HSCROLL))) goto END;
|
||||||
if (!WIN_IsWindowDrawable( hwnd, FALSE )) goto END;
|
if (!WIN_IsWindowDrawable( hwnd, FALSE )) goto END;
|
||||||
hwnd = wndPtr->hwndSelf; */ /* make it a full handle */
|
hwnd = wndPtr->hwndSelf; */ /* make it a full handle */
|
||||||
|
|
||||||
if (IsRectEmpty (&(info->rcScrollBar))) goto END;
|
if (IsRectEmpty (&(info.rcScrollBar))) goto END;
|
||||||
DbgPrint("[SCROLL_DrawScrollBar:2]");
|
|
||||||
if (Save_SCROLL_MovingThumb && (SCROLL_TrackingWin == hwnd) && (SCROLL_TrackingBar == nBar))
|
if (Save_SCROLL_MovingThumb && (SCROLL_TrackingWin == hwnd) && (SCROLL_TrackingBar == nBar))
|
||||||
{
|
{
|
||||||
DbgPrint("[SCROLL_DrawScrollBar:2a]");
|
SCROLL_DrawMovingThumb (hdc, &(info.rcScrollBar), nBar, arrowSize, thumbSize);
|
||||||
SCROLL_DrawMovingThumb (hdc, &info->rcScrollBar, nBar, arrowSize, thumbSize);
|
|
||||||
}
|
}
|
||||||
DbgPrint("[SCROLL_DrawScrollBar:3]");
|
|
||||||
/* Draw the arrows */
|
/* Draw the arrows */
|
||||||
if (arrows && arrowSize)
|
if (arrows && arrowSize)
|
||||||
{
|
{
|
||||||
if (SCROLL_trackVertical == TRUE /* && GetCapture () == hwnd */)
|
if (SCROLL_trackVertical == TRUE /* && GetCapture () == hwnd */)
|
||||||
{
|
{
|
||||||
SCROLL_DrawArrows (hdc, info, &info->rcScrollBar, arrowSize, nBar,
|
SCROLL_DrawArrows (hdc, &info, &(info.rcScrollBar), arrowSize, nBar,
|
||||||
(SCROLL_trackHitTest == SCROLL_TOP_ARROW),
|
(SCROLL_trackHitTest == SCROLL_TOP_ARROW),
|
||||||
(SCROLL_trackHitTest == SCROLL_BOTTOM_ARROW));
|
(SCROLL_trackHitTest == SCROLL_BOTTOM_ARROW));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCROLL_DrawArrows (hdc, info, &info->rcScrollBar, arrowSize, nBar, FALSE, FALSE);
|
SCROLL_DrawArrows (hdc, &info, &(info.rcScrollBar), arrowSize, nBar, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interior)
|
if (interior)
|
||||||
{
|
{
|
||||||
SCROLL_DrawInterior (hwnd, hdc, nBar, &info->rcScrollBar, arrowSize, thumbSize,
|
SCROLL_DrawInterior (hwnd, hdc, nBar, &(info.rcScrollBar), arrowSize, thumbSize,
|
||||||
thumbPos, /* info->flags FIXME */ 0, FALSE, FALSE);
|
thumbPos, /* info->flags FIXME */ 0, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Save_SCROLL_MovingThumb &&
|
if (Save_SCROLL_MovingThumb &&
|
||||||
(SCROLL_TrackingWin == hwnd) && (SCROLL_TrackingBar == nBar))
|
(SCROLL_TrackingWin == hwnd) && (SCROLL_TrackingBar == nBar))
|
||||||
SCROLL_DrawMovingThumb (hdc, &info->rcScrollBar, nBar, arrowSize, thumbSize);
|
SCROLL_DrawMovingThumb (hdc, &info.rcScrollBar, nBar, arrowSize, thumbSize);
|
||||||
/* if scroll bar has focus, reposition the caret */
|
/* if scroll bar has focus, reposition the caret */
|
||||||
|
|
||||||
/* if (hwnd == GetFocus () && (nBar == SB_CTL))
|
/* if (hwnd == GetFocus () && (nBar == SB_CTL))
|
||||||
{
|
{
|
||||||
if (nBar == SB_HORZ)
|
if (nBar == SB_HORZ)
|
||||||
{
|
{
|
||||||
SetCaretPos (thumbPos + 1, info->rcScrollBar.top + 1);
|
SetCaretPos (thumbPos + 1, info.rcScrollBar.top + 1);
|
||||||
}
|
}
|
||||||
else if (nBAR == SB_VERT)
|
else if (nBAR == SB_VERT)
|
||||||
{
|
{
|
||||||
SetCaretPos (info->rcScrollBar.top + 1, thumbPos + 1);
|
SetCaretPos (info.rcScrollBar.top + 1, thumbPos + 1);
|
||||||
}
|
}
|
||||||
} */
|
} */
|
||||||
END:
|
END:
|
||||||
|
@ -359,7 +355,6 @@ SetScrollRange (HWND hWnd,
|
||||||
WINBOOL STDCALL
|
WINBOOL STDCALL
|
||||||
ShowScrollBar (HWND hWnd, int wBar, WINBOOL bShow)
|
ShowScrollBar (HWND hWnd, int wBar, WINBOOL bShow)
|
||||||
{
|
{
|
||||||
DbgPrint("[ShowScrollBar]");
|
|
||||||
NtUserShowScrollBar (hWnd, wBar, bShow);
|
NtUserShowScrollBar (hWnd, wBar, bShow);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: scrollbar.c,v 1.1 2002/11/24 20:15:37 jfilby Exp $
|
/* $Id: scrollbar.c,v 1.2 2002/12/21 19:24:51 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -35,25 +35,21 @@
|
||||||
* the top. Return TRUE if the scrollbar is vertical, FALSE if horizontal.
|
* the top. Return TRUE if the scrollbar is vertical, FALSE if horizontal.
|
||||||
*/
|
*/
|
||||||
static BOOL
|
static BOOL
|
||||||
SCROLL_GetScrollBarRect (PWINDOW_OBJECT Window, INT nBar, PRECT lprect,
|
SCROLL_GetScrollBarRect (PWINDOW_OBJECT Window, INT nBar, PRECT lprect /* ,
|
||||||
PINT arrowSize, PINT thumbSize, PINT thumbPos)
|
PINT arrowSize, PINT thumbSize, PINT thumbPos */ )
|
||||||
{
|
{
|
||||||
INT pixels;
|
INT pixels, thumbSize, arrowSize;
|
||||||
BOOL vertical;
|
BOOL vertical;
|
||||||
RECT ClientRect;
|
RECT ClientRect = Window->ClientRect;
|
||||||
|
RECT WindowRect = Window->WindowRect;
|
||||||
ULONG Style;
|
ULONG Style;
|
||||||
DbgPrint("[SCROLL_GetScrollBarRect]");
|
|
||||||
W32kGetClientRect (Window, &ClientRect);
|
|
||||||
DbgPrint("[WindowRect:%d,%d,%d,%d]\n", Window->WindowRect.left, Window->WindowRect.top, Window->WindowRect.right, Window->WindowRect.bottom);
|
|
||||||
DbgPrint("[ClientRect:%d,%d,%d,%d]\n", ClientRect.left, ClientRect.top, ClientRect.right, ClientRect.bottom);
|
|
||||||
|
|
||||||
switch (nBar)
|
switch (nBar)
|
||||||
{
|
{
|
||||||
case SB_HORZ:
|
case SB_HORZ:
|
||||||
DbgPrint ("[SCROLL_GetScrollBarRect:SB_HORZ]");
|
lprect->left = ClientRect.left - WindowRect.left;
|
||||||
lprect->left = ClientRect.left - Window->WindowRect.left;
|
lprect->top = ClientRect.bottom - WindowRect.top;
|
||||||
lprect->top = ClientRect.bottom - Window->WindowRect.top;
|
lprect->right = ClientRect.right - WindowRect.left;
|
||||||
lprect->right = ClientRect.right - Window->WindowRect.left;
|
|
||||||
lprect->bottom = lprect->top + NtUserGetSystemMetrics (SM_CYHSCROLL);
|
lprect->bottom = lprect->top + NtUserGetSystemMetrics (SM_CYHSCROLL);
|
||||||
if (Window->Style & WS_BORDER)
|
if (Window->Style & WS_BORDER)
|
||||||
{
|
{
|
||||||
|
@ -66,15 +62,10 @@ DbgPrint("[ClientRect:%d,%d,%d,%d]\n", ClientRect.left, ClientRect.top, ClientRe
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_VERT:
|
case SB_VERT:
|
||||||
DbgPrint ("[SCROLL_GetScrollBarRect:SB_VERT]\n");
|
lprect->left = ClientRect.right - WindowRect.left;
|
||||||
/* lprect->left = ClientRect.right - Window->WindowRect.left;
|
lprect->top = ClientRect.top - WindowRect.top;
|
||||||
lprect->top = ClientRect.top - Window->WindowRect.top;
|
|
||||||
lprect->right = lprect->left + NtUserGetSystemMetrics (SM_CXVSCROLL);
|
lprect->right = lprect->left + NtUserGetSystemMetrics (SM_CXVSCROLL);
|
||||||
lprect->bottom = ClientRect.bottom - WindowRect.top; */
|
lprect->bottom = ClientRect.bottom - WindowRect.top;
|
||||||
lprect->left = Window->WindowRect.left + ClientRect.right;
|
|
||||||
lprect->top = Window->WindowRect.bottom - ClientRect.bottom;
|
|
||||||
lprect->right = lprect->left + NtUserGetSystemMetrics (SM_CXVSCROLL);
|
|
||||||
lprect->bottom = Window->WindowRect.bottom;
|
|
||||||
if (Window->Style & WS_BORDER)
|
if (Window->Style & WS_BORDER)
|
||||||
{
|
{
|
||||||
lprect->top--;
|
lprect->top--;
|
||||||
|
@ -82,25 +73,15 @@ DbgPrint("[ClientRect:%d,%d,%d,%d]\n", ClientRect.left, ClientRect.top, ClientRe
|
||||||
}
|
}
|
||||||
else if (Window->Style & WS_HSCROLL)
|
else if (Window->Style & WS_HSCROLL)
|
||||||
lprect->bottom++;
|
lprect->bottom++;
|
||||||
DbgPrint ("[VERTDIMEN:%d,%d,%d,%d]\n", lprect->left, lprect->top,
|
|
||||||
lprect->right, lprect->bottom);
|
|
||||||
DbgPrint ("[Window:%d,%d,%d,%d]\n", Window->WindowRect.left, Window->WindowRect.top,
|
|
||||||
Window->WindowRect.right, Window->WindowRect.bottom);
|
|
||||||
DbgPrint ("[Client:%d,%d,%d,%d]\n", ClientRect.left, ClientRect.top,
|
|
||||||
ClientRect.right, ClientRect.bottom);
|
|
||||||
DbgPrint ("[NtUserGetSystemMetrics(SM_CXVSCROLL):%d]\n",
|
|
||||||
NtUserGetSystemMetrics (SM_CXVSCROLL));
|
|
||||||
vertical = TRUE;
|
vertical = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_CTL:
|
case SB_CTL:
|
||||||
DbgPrint ("[SCROLL_GetScrollBarRect:SB_CTL]");
|
|
||||||
W32kGetClientRect (Window, lprect);
|
W32kGetClientRect (Window, lprect);
|
||||||
vertical = ((Window->Style & SBS_VERT) != 0);
|
vertical = ((Window->Style & SBS_VERT) != 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint ("[SCROLL_GetScrollBarRect:FAIL]");
|
|
||||||
W32kReleaseWindowObject(Window);
|
W32kReleaseWindowObject(Window);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -112,19 +93,16 @@ DbgPrint("[ClientRect:%d,%d,%d,%d]\n", ClientRect.left, ClientRect.top, ClientRe
|
||||||
|
|
||||||
if (pixels <= 2 * NtUserGetSystemMetrics (SM_CXVSCROLL) + SCROLL_MIN_RECT)
|
if (pixels <= 2 * NtUserGetSystemMetrics (SM_CXVSCROLL) + SCROLL_MIN_RECT)
|
||||||
{
|
{
|
||||||
if (pixels > SCROLL_MIN_RECT)
|
info.dxyLineButton = info.xyThumbTop = info.xyThumbBottom = 0;
|
||||||
*arrowSize = (pixels - SCROLL_MIN_RECT) / 2;
|
|
||||||
else
|
|
||||||
*arrowSize = 0;
|
|
||||||
*thumbPos = *thumbSize = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* PSCROLLBARINFO info;
|
SCROLLBARINFO info;
|
||||||
|
info.cbSize = sizeof(SCROLLBARINFO);
|
||||||
|
|
||||||
NtUserGetScrollBarInfo (hWnd, nBar, info); recursive loop.. since called function calls this function */
|
SCROLL_GetScrollBarInfo (Window, nBar, &info);
|
||||||
|
|
||||||
*arrowSize = NtUserGetSystemMetrics (SM_CXVSCROLL);
|
arrowSize = NtUserGetSystemMetrics (SM_CXVSCROLL);
|
||||||
pixels -=
|
pixels -=
|
||||||
(2 * (NtUserGetSystemMetrics (SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP));
|
(2 * (NtUserGetSystemMetrics (SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP));
|
||||||
/* if (info->Page)
|
/* if (info->Page)
|
||||||
|
@ -150,109 +128,78 @@ DbgPrint("[ClientRect:%d,%d,%d,%d]\n", ClientRect.left, ClientRect.top, ClientRe
|
||||||
+ MulDiv(pixels, (info->CurVal-info->MinVal),(max - info->MinVal));
|
+ MulDiv(pixels, (info->CurVal-info->MinVal),(max - info->MinVal));
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
W32kReleaseWindowObject(Window);
|
|
||||||
|
|
||||||
return vertical;
|
return vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD SCROLL_CreateScrollBar(PWINDOW_OBJECT Window, LONG idObject)
|
||||||
|
{
|
||||||
|
PSCROLLBARINFO psbi;
|
||||||
|
LRESULT Result;
|
||||||
|
int thumbSize = 20, arrowSize = 20, thumbPos = 1;
|
||||||
|
|
||||||
|
Result = WinPosGetNonClientSize(Window->Self,
|
||||||
|
&Window->WindowRect,
|
||||||
|
&Window->ClientRect);
|
||||||
|
|
||||||
|
psbi = ExAllocatePool(NonPagedPool, sizeof(SCROLLBARINFO));
|
||||||
|
|
||||||
|
switch(idObject)
|
||||||
|
{
|
||||||
|
case SB_HORZ:
|
||||||
|
Window->pHScroll = psbi;
|
||||||
|
break;
|
||||||
|
case SB_VERT:
|
||||||
|
Window->pVScroll = psbi;
|
||||||
|
break;
|
||||||
|
case SB_CTL:
|
||||||
|
Window->wExtra = psbi;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SCROLL_GetScrollBarRect (Window, idObject, &(psbi->rcScrollBar) /* , &arrowSize, &thumbSize, &thumbPos */ );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD SCROLL_GetScrollBarInfo(PWINDOW_OBJECT Window, LONG idObject, PSCROLLBARINFO psbi)
|
||||||
|
{
|
||||||
|
switch(idObject)
|
||||||
|
{
|
||||||
|
case SB_HORZ:
|
||||||
|
memcpy(psbi, Window->pHScroll, psbi->cbSize);
|
||||||
|
break;
|
||||||
|
case SB_VERT:
|
||||||
|
memcpy(psbi, Window->pVScroll, psbi->cbSize);
|
||||||
|
break;
|
||||||
|
case SB_CTL:
|
||||||
|
memcpy(psbi, Window->wExtra, psbi->cbSize);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
W32kReleaseWindowObject(Window);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserGetScrollBarInfo(HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
|
NtUserGetScrollBarInfo(HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window = W32kGetWindowObject(hWnd);
|
PWINDOW_OBJECT Window = W32kGetWindowObject(hWnd);
|
||||||
int thumbSize = 20, arrowSize = 20, thumbPos = 0;
|
|
||||||
|
|
||||||
if (!Window) return FALSE;
|
if (!Window) return FALSE;
|
||||||
|
|
||||||
switch(idObject)
|
SCROLL_GetScrollBarInfo(Window, idObject, psbi);
|
||||||
{
|
|
||||||
case SB_HORZ: psbi = Window->pHScroll; break;
|
|
||||||
case SB_VERT: psbi = Window->pVScroll; break;
|
|
||||||
case SB_CTL: psbi = Window->wExtra; break;
|
|
||||||
default:
|
|
||||||
W32kReleaseWindowObject(Window);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!psbi) /* Create the info structure if needed */
|
|
||||||
{
|
|
||||||
if ((psbi = ExAllocatePool(NonPagedPool, sizeof(SCROLLBARINFO))))
|
|
||||||
{
|
|
||||||
DbgPrint("Creating PSCROLLBARINFO for %d - psbi: %08x\n", idObject, psbi);
|
|
||||||
SCROLL_GetScrollBarRect (Window, idObject, &(psbi->rcScrollBar), &arrowSize, &thumbSize, &thumbPos);
|
|
||||||
DbgPrint("NtUserGetScrollBarInfo: Creating with rect (%d,%d,%d,%d)\n",
|
|
||||||
psbi->rcScrollBar.left, psbi->rcScrollBar.top, psbi->rcScrollBar.right, psbi->rcScrollBar.bottom);
|
|
||||||
|
|
||||||
if (idObject == SB_HORZ) Window->pHScroll = psbi;
|
|
||||||
else Window->pVScroll = psbi;
|
|
||||||
}
|
|
||||||
/* if (!hUpArrow) SCROLL_LoadBitmaps(); FIXME: This must be moved somewhere in user32 code */
|
|
||||||
}
|
|
||||||
DbgPrint("z1: psbi: %08x\n", psbi);
|
|
||||||
W32kReleaseWindowObject(Window);
|
W32kReleaseWindowObject(Window);
|
||||||
DbgPrint("z2: psbi: %08x\n", psbi);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ported from WINE20020904 */
|
|
||||||
BOOL
|
|
||||||
SCROLL_ShowScrollBar (HWND hwnd, INT nBar, BOOL fShowH, BOOL fShowV)
|
|
||||||
{
|
|
||||||
PWINDOW_OBJECT Window = W32kGetWindowObject(hwnd);
|
|
||||||
|
|
||||||
switch (nBar)
|
|
||||||
{
|
|
||||||
case SB_CTL:
|
|
||||||
NtUserShowWindow (hwnd, fShowH ? SW_SHOW : SW_HIDE);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case SB_BOTH:
|
|
||||||
case SB_HORZ:
|
|
||||||
if (fShowH)
|
|
||||||
{
|
|
||||||
fShowH = !(Window->Style & WS_HSCROLL);
|
|
||||||
Window->Style |= WS_HSCROLL;
|
|
||||||
}
|
|
||||||
else /* hide it */
|
|
||||||
{
|
|
||||||
fShowH = (Window->Style & WS_HSCROLL);
|
|
||||||
Window->Style &= ~WS_HSCROLL;
|
|
||||||
}
|
|
||||||
if (nBar == SB_HORZ)
|
|
||||||
{
|
|
||||||
fShowV = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* fall through */
|
|
||||||
|
|
||||||
case SB_VERT:
|
|
||||||
if (fShowV)
|
|
||||||
{
|
|
||||||
fShowV = !(Window->Style & WS_VSCROLL);
|
|
||||||
Window->Style |= WS_VSCROLL;
|
|
||||||
}
|
|
||||||
else /* hide it */
|
|
||||||
{
|
|
||||||
fShowV = (Window->Style & WS_VSCROLL);
|
|
||||||
Window->Style &= ~WS_VSCROLL;
|
|
||||||
}
|
|
||||||
if (nBar == SB_VERT)
|
|
||||||
fShowH = FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return FALSE; /* Nothing to do! */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fShowH || fShowV) /* frame has been changed, let the window redraw itself */
|
|
||||||
{
|
|
||||||
NtUserSetWindowPos (hwnd, 0, 0, 0, 0, 0,
|
|
||||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE; /* no frame changes */
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserEnableScrollBar(
|
NtUserEnableScrollBar(
|
||||||
|
@ -293,14 +240,66 @@ NtUserSetScrollInfo(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ported from WINE20020904 (SCROLL_ShowScrollBar) */
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserShowScrollBar(HWND hWnd, int wBar, DWORD bShow)
|
NtUserShowScrollBar(HWND hWnd, int wBar, DWORD bShow)
|
||||||
{
|
{
|
||||||
DbgPrint("[NtUserShowScrollBar:%d]", bShow);
|
BOOL fShowV = (wBar == SB_VERT) ? 0 : bShow;
|
||||||
SCROLL_ShowScrollBar (hWnd, wBar, (wBar == SB_VERT) ? 0 : bShow, (wBar == SB_HORZ) ? 0 : bShow);
|
BOOL fShowH = (wBar == SB_HORZ) ? 0 : bShow;
|
||||||
|
PWINDOW_OBJECT Window = W32kGetWindowObject(hWnd);
|
||||||
|
|
||||||
return 0;
|
switch (wBar)
|
||||||
|
{
|
||||||
|
case SB_CTL:
|
||||||
|
NtUserShowWindow (hWnd, fShowH ? SW_SHOW : SW_HIDE);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case SB_BOTH:
|
||||||
|
case SB_HORZ:
|
||||||
|
if (fShowH)
|
||||||
|
{
|
||||||
|
fShowH = !(Window->Style & WS_HSCROLL);
|
||||||
|
Window->Style |= WS_HSCROLL;
|
||||||
|
}
|
||||||
|
else /* hide it */
|
||||||
|
{
|
||||||
|
fShowH = (Window->Style & WS_HSCROLL);
|
||||||
|
Window->Style &= ~WS_HSCROLL;
|
||||||
|
}
|
||||||
|
if (wBar == SB_HORZ)
|
||||||
|
{
|
||||||
|
fShowV = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
|
|
||||||
|
case SB_VERT:
|
||||||
|
if (fShowV)
|
||||||
|
{
|
||||||
|
fShowV = !(Window->Style & WS_VSCROLL);
|
||||||
|
Window->Style |= WS_VSCROLL;
|
||||||
|
}
|
||||||
|
else /* hide it */
|
||||||
|
{
|
||||||
|
fShowV = (Window->Style & WS_VSCROLL);
|
||||||
|
Window->Style &= ~WS_VSCROLL;
|
||||||
|
}
|
||||||
|
if (wBar == SB_VERT)
|
||||||
|
fShowH = FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FALSE; /* Nothing to do! */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fShowH || fShowV) /* frame has been changed, let the window redraw itself */
|
||||||
|
{
|
||||||
|
NtUserSetWindowPos (hWnd, 0, 0, 0, 0, 0,
|
||||||
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE; /* no frame changes */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: window.c,v 1.19 2002/10/31 00:03:31 dwelch Exp $
|
/* $Id: window.c,v 1.20 2002/12/21 19:24:51 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -497,6 +497,12 @@ NtUserCreateWindowEx(DWORD dwExStyle,
|
||||||
|
|
||||||
/* FIXME: Initialize the window menu. */
|
/* FIXME: Initialize the window menu. */
|
||||||
|
|
||||||
|
/* Initialize the window's scrollbars */
|
||||||
|
if (dwStyle & WS_VSCROLL)
|
||||||
|
SCROLL_CreateScrollBar(WindowObject, SB_VERT);
|
||||||
|
if (dwStyle & WS_HSCROLL)
|
||||||
|
SCROLL_CreateScrollBar(WindowObject, SB_HORZ);
|
||||||
|
|
||||||
/* Send a NCCREATE message. */
|
/* Send a NCCREATE message. */
|
||||||
Cs.lpCreateParams = lpParam;
|
Cs.lpCreateParams = lpParam;
|
||||||
Cs.hInstance = hInstance;
|
Cs.hInstance = hInstance;
|
||||||
|
|
|
@ -121,10 +121,12 @@ W32kLineTo(HDC hDC,
|
||||||
ASSERT( pen );
|
ASSERT( pen );
|
||||||
// not yet implemented ASSERT( reg );
|
// not yet implemented ASSERT( reg );
|
||||||
|
|
||||||
|
/* Draw the line according to the DC origin */
|
||||||
ret = EngLineTo(SurfObj,
|
ret = EngLineTo(SurfObj,
|
||||||
NULL, // ClipObj
|
NULL, // ClipObj
|
||||||
PenToBrushObj(dc, pen),
|
PenToBrushObj(dc, pen),
|
||||||
dc->w.CursPosX, dc->w.CursPosY, XEnd, YEnd,
|
dc->w.DCOrgX + dc->w.CursPosX, dc->w.DCOrgY + dc->w.CursPosY,
|
||||||
|
dc->w.DCOrgX + XEnd, dc->w.DCOrgY + YEnd,
|
||||||
reg, // Bounding rectangle
|
reg, // Bounding rectangle
|
||||||
dc->w.ROPmode); // MIX
|
dc->w.ROPmode); // MIX
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue