-/*
- * ReactOS kernel
- * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+/* $Id: scrollbar.c,v 1.4 2002/11/24 20:13:43 jfilby Exp $
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-/* $Id: scrollbar.c,v 1.3 2002/09/08 10:23:09 chorns Exp $
- *
- * PROJECT: ReactOS user32.dll
- * FILE: lib/user32/controls/scrollbar.c
- * PURPOSE: Scroll bar
- * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * UPDATE HISTORY:
- * 09-05-2001 CSH Created
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * PURPOSE: Windows
+ * FILE: subsys/win32k/ntuser/window.c
+ * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
+ * REVISION HISTORY:
+ * 06-06-2001 CSH Created
*/
+/* INCLUDES ******************************************************************/
/* INCLUDES ******************************************************************/
#include <user32.h>
#include <debug.h>
+/* GLOBAL VARIABLES **********************************************************/
+/*
+static HBITMAP hUpArrow;
+static HBITMAP hDnArrow;
+static HBITMAP hLfArrow;
+static HBITMAP hRgArrow;
+static HBITMAP hUpArrowD;
+static HBITMAP hDnArrowD;
+static HBITMAP hLfArrowD;
+static HBITMAP hRgArrowD;
+static HBITMAP hUpArrowI;
+static HBITMAP hDnArrowI;
+static HBITMAP hLfArrowI;
+static HBITMAP hRgArrowI;
+*/
+#define TOP_ARROW(flags,pressed) \
+ (((flags)&ESB_DISABLE_UP) ? hUpArrowI : ((pressed) ? hUpArrowD:hUpArrow))
+#define BOTTOM_ARROW(flags,pressed) \
+ (((flags)&ESB_DISABLE_DOWN) ? hDnArrowI : ((pressed) ? hDnArrowD:hDnArrow))
+#define LEFT_ARROW(flags,pressed) \
+ (((flags)&ESB_DISABLE_LEFT) ? hLfArrowI : ((pressed) ? hLfArrowD:hLfArrow))
+#define RIGHT_ARROW(flags,pressed) \
+ (((flags)&ESB_DISABLE_RIGHT) ? hRgArrowI : ((pressed) ? hRgArrowD:hRgArrow))
+
+#define SCROLL_ARROW_THUMB_OVERLAP 0 /* Overlap between arrows and thumb */
+#define SCROLL_MIN_THUMB 6 /* Minimum size of the thumb in pixels */
+#define SCROLL_FIRST_DELAY 200 /* Delay (in ms) before first repetition when holding the button down */
+#define SCROLL_REPEAT_DELAY 50 /* Delay (in ms) between scroll repetitions */
+#define SCROLL_TIMER 0 /* Scroll timer id */
+
+ /* What to do after SCROLL_SetScrollInfo() */
+#define SA_SSI_HIDE 0x0001
+#define SA_SSI_SHOW 0x0002
+#define SA_SSI_REFRESH 0x0004
+#define SA_SSI_REPAINT_ARROWS 0x0008
+
+ /* Scroll-bar hit testing */
+enum SCROLL_HITTEST
+{
+ SCROLL_NOWHERE, /* Outside the scroll bar */
+ SCROLL_TOP_ARROW, /* Top or left arrow */
+ SCROLL_TOP_RECT, /* Rectangle between the top arrow and the thumb */
+ SCROLL_THUMB, /* Thumb rectangle */
+ SCROLL_BOTTOM_RECT, /* Rectangle between the thumb and the bottom arrow */
+ SCROLL_BOTTOM_ARROW /* Bottom or right arrow */
+};
+
+static BOOL SCROLL_MovingThumb = FALSE; /* Is the moving thumb being displayed? */
+
+/* Thumb-tracking info */
+static HWND SCROLL_TrackingWin = 0;
+static INT SCROLL_TrackingBar = 0;
+static INT SCROLL_TrackingPos = 0;
+/* static INT SCROLL_TrackingVal = 0; */
+static enum SCROLL_HITTEST SCROLL_trackHitTest; /* Hit test code of the last button-down event */
+static BOOL SCROLL_trackVertical;
+
/* FUNCTIONS *****************************************************************/
+HBRUSH DefWndControlColor (HDC hDC, UINT ctlType);
+HPEN STDCALL GetSysColorPen (int nIndex);
+
+
+
WINBOOL STDCALL
-GetScrollBarInfo(HWND hwnd,
- LONG idObject,
- PSCROLLBARINFO psbi)
+GetScrollBarInfo (HWND hwnd, LONG idObject, PSCROLLBARINFO psbi)
{
- return FALSE;
+ int ret = NtUserGetScrollBarInfo (hwnd, idObject, psbi);
+DbgPrint("GetScrollBarInfo: psbi: %08x\n", psbi);
+ return ret;
+}
+
+/* Ported from WINE20020904 */
+/* Draw the scroll bar interior (everything except the arrows). */
+static void
+SCROLL_DrawInterior (HWND hwnd, HDC hdc, INT nBar,
+ RECT * rect, INT arrowSize,
+ INT thumbSize, INT thumbPos,
+ UINT flags, BOOL top_selected, BOOL bottom_selected)
+{
+ RECT r;
+ HPEN hSavePen;
+ HBRUSH hSaveBrush, hBrush;
+
+ /* Only scrollbar controls send WM_CTLCOLORSCROLLBAR.
+ * The window-owned scrollbars need to call DefWndControlColor
+ * to correctly setup default scrollbar colors
+ */
+ if (nBar == SB_CTL)
+ {
+ hBrush = (HBRUSH) NtUserSendMessage (GetParent (hwnd), WM_CTLCOLORSCROLLBAR,
+ (WPARAM) hdc, (LPARAM) hwnd);
+ }
+ else
+ {
+/* hBrush = DefWndControlColor (hdc, CTLCOLOR_SCROLLBAR); */
+ }
+
+ hSavePen = SelectObject (hdc, GetSysColorPen (COLOR_WINDOWFRAME));
+ hSaveBrush = SelectObject (hdc, hBrush);
+
+ /* Calculate the scroll rectangle */
+ r = *rect;
+ DbgPrint ("[DrawInterior:r1:%d,%d,%d,%d]", r.left, r.top, r.right, r.bottom);
+ if (nBar == SB_VERT)
+ {
+ r.top += arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
+ r.bottom -= (arrowSize - SCROLL_ARROW_THUMB_OVERLAP);
+ }
+ else if (nBar == SB_HORZ)
+ {
+ r.left += arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
+ r.right -= (arrowSize - SCROLL_ARROW_THUMB_OVERLAP);
+ }
+
+ /* Draw the scroll rectangles and thumb */
+ if (!thumbPos) /* No thumb to draw */
+ {
+ PatBlt (hdc, r.left, r.top, r.right - r.left, r.bottom - r.top, PATCOPY);
+
+ /* cleanup and return */
+ SelectObject (hdc, hSavePen);
+ SelectObject (hdc, hSaveBrush);
+ return;
+ }
+ if (nBar == SB_VERT)
+ {
+ PatBlt (hdc, r.left, r.top, r.right - r.left, thumbPos - (arrowSize - SCROLL_ARROW_THUMB_OVERLAP),
+ top_selected ? 0x0f0000 : PATCOPY);
+ r.top += thumbPos - (arrowSize - SCROLL_ARROW_THUMB_OVERLAP);
+ PatBlt (hdc, r.left, r.top + thumbSize, r.right - r.left,
+ r.bottom - r.top - thumbSize,
+ bottom_selected ? 0x0f0000 : PATCOPY);
+ r.bottom = r.top + thumbSize;
+ }
+ else if (nBar == SB_HORZ)
+ {
+ PatBlt (hdc, r.left, r.top, thumbPos - (arrowSize - SCROLL_ARROW_THUMB_OVERLAP),
+ r.bottom - r.top, top_selected ? 0x0f0000 : PATCOPY);
+ r.left += thumbPos - (arrowSize - SCROLL_ARROW_THUMB_OVERLAP);
+ PatBlt (hdc, r.left + thumbSize, r.top,
+ r.right - r.left - thumbSize,
+ r.bottom - r.top, bottom_selected ? 0x0f0000 : PATCOPY);
+ r.right = r.left + thumbSize;
+ }
+
+ DbgPrint ("[DrawInterior:r2:%d,%d,%d,%d]", r.left, r.top, r.right, r.bottom);
+ /* Draw the thumb */
+ DrawEdge (hdc, &r, EDGE_RAISED, BF_RECT | BF_MIDDLE);
+
+ /* cleanup */
+ SelectObject (hdc, hSavePen);
+ SelectObject (hdc, hSaveBrush);
+}
+
+/* Ported from WINE20020904 */
+static void
+SCROLL_DrawMovingThumb (HDC hdc, RECT * rect, int nBar,
+ INT arrowSize, INT thumbSize)
+{
+ INT pos = SCROLL_TrackingPos;
+ INT max_size;
+ DbgPrint ("[SCROLL_DrawMovingThumb:0 - no PAUSE!]");
+/* for (;;); */
+ if (nBar == SB_VERT)
+ max_size = rect->bottom - rect->top;
+ else if (nBar == SB_HORZ)
+ max_size = rect->right - rect->left;
+
+ max_size -= (arrowSize - SCROLL_ARROW_THUMB_OVERLAP) + thumbSize;
+ DbgPrint ("[SCROLL_DrawMovingThumb:1]");
+ if (pos < (arrowSize - SCROLL_ARROW_THUMB_OVERLAP))
+ pos = (arrowSize - SCROLL_ARROW_THUMB_OVERLAP);
+ else if (pos > max_size)
+ pos = max_size;
+ DbgPrint ("[SCROLL_DrawMovingThumb:2]");
+ SCROLL_DrawInterior (SCROLL_TrackingWin, hdc, SCROLL_TrackingBar,
+ rect, arrowSize, thumbSize, pos,
+ 0, FALSE, FALSE);
+ DbgPrint ("[SCROLL_DrawMovingThumb:3]");
+ SCROLL_MovingThumb = !SCROLL_MovingThumb;
+ DbgPrint ("[SCROLL_DrawMovingThumb:e]");
+}
+
+/* Ported from WINE20020904 */
+/* Draw the scroll bar arrows. */
+static void
+SCROLL_DrawArrows (HDC hdc, PSCROLLBARINFO info,
+ RECT * rect, INT arrowSize, int nBar,
+ BOOL top_pressed, BOOL bottom_pressed)
+{
+ RECT r;
+ int scrollDirFlag1, scrollDirFlag2;
+
+ if (nBar == SB_VERT)
+ {
+ scrollDirFlag1 = DFCS_SCROLLUP;
+ scrollDirFlag2 = DFCS_SCROLLDOWN;
+ }
+ else if (nBar == SB_HORZ)
+ {
+ scrollDirFlag1 = DFCS_SCROLLLEFT;
+ scrollDirFlag2 = DFCS_SCROLLRIGHT;
+ }
+
+ r = *rect;
+ if (nBar == SB_VERT)
+ r.bottom = r.top + arrowSize;
+ else if (nBar == SB_HORZ)
+ r.right = r.left + arrowSize;
+
+ DrawFrameControl (hdc, &r, DFC_SCROLL,
+ scrollDirFlag1 | (top_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0)
+ /* | (info->flags&ESB_DISABLE_LTUP ? DFCS_INACTIVE : 0) */
+ );
+ r = *rect;
+ if (nBar == SB_VERT)
+ r.top = r.bottom - arrowSize;
+ else if (nBar == SB_HORZ)
+ r.left = r.right - arrowSize;
+ DrawFrameControl (hdc, &r, DFC_SCROLL,
+ scrollDirFlag2 | (bottom_pressed ? (DFCS_PUSHED | DFCS_FLAT) : 0)
+ /* | (info->flags&ESB_DISABLE_RTDN ? DFCS_INACTIVE : 0) */
+ );
+}
+
+/* Ported from WINE20020904 */
+/* Redraw the whole scrollbar. */
+void
+SCROLL_DrawScrollBar (HWND hwnd, HDC hdc, INT nBar,
+ BOOL arrows, BOOL interior)
+{
+ INT arrowSize, thumbSize, thumbPos;
+/* WND *wndPtr = WIN_FindWndPtr( hwnd ); */
+ PSCROLLBARINFO info;
+ BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
+DbgPrint("[SCROLL_DrawScrollBar:0]");
+ GetScrollBarInfo (hwnd, nBar, info);
+DbgPrint("[SCROLL_DrawScrollBar:1]");
+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 ||
+ ((nBar == SB_VERT) && !(wndPtr->dwStyle & WS_VSCROLL)) ||
+ ((nBar == SB_HORZ) && !(wndPtr->dwStyle & WS_HSCROLL))) goto END;
+ if (!WIN_IsWindowDrawable( hwnd, FALSE )) goto END;
+ hwnd = wndPtr->hwndSelf; */ /* make it a full handle */
+
+ if (IsRectEmpty (&(info->rcScrollBar))) goto END;
+DbgPrint("[SCROLL_DrawScrollBar:2]");
+ if (Save_SCROLL_MovingThumb && (SCROLL_TrackingWin == hwnd) && (SCROLL_TrackingBar == nBar))
+ {
+DbgPrint("[SCROLL_DrawScrollBar:2a]");
+ SCROLL_DrawMovingThumb (hdc, &info->rcScrollBar, nBar, arrowSize, thumbSize);
+ }
+DbgPrint("[SCROLL_DrawScrollBar:3]");
+ /* Draw the arrows */
+ if (arrows && arrowSize)
+ {
+ if (SCROLL_trackVertical == TRUE /* && GetCapture () == hwnd */)
+ {
+ SCROLL_DrawArrows (hdc, info, &info->rcScrollBar, arrowSize, nBar,
+ (SCROLL_trackHitTest == SCROLL_TOP_ARROW),
+ (SCROLL_trackHitTest == SCROLL_BOTTOM_ARROW));
+ }
+ else
+ {
+ SCROLL_DrawArrows (hdc, info, &info->rcScrollBar, arrowSize, nBar, FALSE, FALSE);
+ }
+ }
+
+ if (interior)
+ {
+ SCROLL_DrawInterior (hwnd, hdc, nBar, &info->rcScrollBar, arrowSize, thumbSize,
+ thumbPos, /* info->flags FIXME */ 0, FALSE, FALSE);
+ }
+
+ if (Save_SCROLL_MovingThumb &&
+ (SCROLL_TrackingWin == hwnd) && (SCROLL_TrackingBar == nBar))
+ SCROLL_DrawMovingThumb (hdc, &info->rcScrollBar, nBar, arrowSize, thumbSize);
+ /* if scroll bar has focus, reposition the caret */
+
+/* if (hwnd == GetFocus () && (nBar == SB_CTL))
+ {
+ if (nBar == SB_HORZ)
+ {
+ SetCaretPos (thumbPos + 1, info->rcScrollBar.top + 1);
+ }
+ else if (nBAR == SB_VERT)
+ {
+ SetCaretPos (info->rcScrollBar.top + 1, thumbPos + 1);
+ }
+ } */
+END:
+/* WIN_ReleaseWndPtr(wndPtr); */
}
WINBOOL STDCALL
-GetScrollInfo(HWND hwnd,
- int fnBar,
- LPSCROLLINFO lpsi)
+GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi)
{
+ UNIMPLEMENTED;
return FALSE;
}
int STDCALL
-GetScrollPos(HWND hWnd,
- int nBar)
+GetScrollPos (HWND hWnd, int nBar)
{
+ UNIMPLEMENTED;
return 0;
}
WINBOOL STDCALL
-GetScrollRange(HWND hWnd,
- int nBar,
- LPINT lpMinPos,
- LPINT lpMaxPos)
+GetScrollRange (HWND hWnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos)
{
+ UNIMPLEMENTED;
return FALSE;
}
int STDCALL
-SetScrollInfo(HWND hwnd,
- int fnBar,
- LPCSCROLLINFO lpsi,
- WINBOOL fRedraw)
+SetScrollInfo (HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, WINBOOL fRedraw)
{
+ UNIMPLEMENTED;
return 0;
}
int STDCALL
-SetScrollPos(HWND hWnd,
- int nBar,
- int nPos,
- WINBOOL bRedraw)
+SetScrollPos (HWND hWnd, int nBar, int nPos, WINBOOL bRedraw)
{
+ UNIMPLEMENTED;
return 0;
}
WINBOOL STDCALL
-SetScrollRange(HWND hWnd,
- int nBar,
- int nMinPos,
- int nMaxPos,
- WINBOOL bRedraw)
+SetScrollRange (HWND hWnd,
+ int nBar, int nMinPos, int nMaxPos, WINBOOL bRedraw)
{
+ UNIMPLEMENTED;
return FALSE;
}
+/* Ported from WINE20020904 */
WINBOOL STDCALL
-ShowScrollBar(HWND hWnd,
- int wBar,
- WINBOOL bShow)
+ShowScrollBar (HWND hWnd, int wBar, WINBOOL bShow)
{
- return FALSE;
+DbgPrint("[ShowScrollBar]");
+ NtUserShowScrollBar (hWnd, wBar, bShow);
+ return TRUE;
}
--- /dev/null
+/* $Id: scrollbar.c,v 1.1 2002/11/24 20:15:37 jfilby Exp $
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * PURPOSE: Scrollbars
+ * FILE: subsys/win32k/ntuser/scrollbar.c
+ * PROGRAMER: Jason Filby (jasonfilby@yahoo.com)
+ * REVISION HISTORY:
+ * 16-11-2002 Jason Filby Created
+ */
+/* INCLUDES ******************************************************************/
+
+#include <ddk/ntddk.h>
+#include <win32k/win32k.h>
+#include <include/object.h>
+#include <include/window.h>
+#include <include/class.h>
+#include <include/error.h>
+#include <include/winsta.h>
+#include <include/winpos.h>
+#include <include/rect.h>
+
+//#define NDEBUG
+#include <debug.h>
+
+#define SCROLL_MIN_RECT 4 /* Minimum size of the rectangle between the arrows */
+#define SCROLL_ARROW_THUMB_OVERLAP 0 /* Overlap between arrows and thumb */
+
+/* FUNCTIONS *****************************************************************/
+
+/* Ported from WINE20020904 */
+/* Compute the scroll bar rectangle, in drawing coordinates (i.e. client coords for SB_CTL, window coords for SB_VERT and
+ * SB_HORZ). 'arrowSize' returns the width or height of an arrow (depending on * the orientation of the scrollbar),
+ * 'thumbSize' returns the size of the thumb, and 'thumbPos' returns the position of the thumb relative to the left or to
+ * the top. Return TRUE if the scrollbar is vertical, FALSE if horizontal.
+ */
+static BOOL
+SCROLL_GetScrollBarRect (PWINDOW_OBJECT Window, INT nBar, PRECT lprect,
+ PINT arrowSize, PINT thumbSize, PINT thumbPos)
+{
+ INT pixels;
+ BOOL vertical;
+ RECT ClientRect;
+ 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)
+ {
+ case SB_HORZ:
+ DbgPrint ("[SCROLL_GetScrollBarRect:SB_HORZ]");
+ lprect->left = ClientRect.left - Window->WindowRect.left;
+ lprect->top = ClientRect.bottom - Window->WindowRect.top;
+ lprect->right = ClientRect.right - Window->WindowRect.left;
+ lprect->bottom = lprect->top + NtUserGetSystemMetrics (SM_CYHSCROLL);
+ if (Window->Style & WS_BORDER)
+ {
+ lprect->left--;
+ lprect->right++;
+ }
+ else if (Window->Style & WS_VSCROLL)
+ lprect->right++;
+ vertical = FALSE;
+ break;
+
+ case SB_VERT:
+ DbgPrint ("[SCROLL_GetScrollBarRect:SB_VERT]\n");
+/* lprect->left = ClientRect.right - Window->WindowRect.left;
+ lprect->top = ClientRect.top - Window->WindowRect.top;
+ lprect->right = lprect->left + NtUserGetSystemMetrics (SM_CXVSCROLL);
+ 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)
+ {
+ lprect->top--;
+ lprect->bottom++;
+ }
+ else if (Window->Style & WS_HSCROLL)
+ 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;
+ break;
+
+ case SB_CTL:
+ DbgPrint ("[SCROLL_GetScrollBarRect:SB_CTL]");
+ W32kGetClientRect (Window, lprect);
+ vertical = ((Window->Style & SBS_VERT) != 0);
+ break;
+
+ default:
+ DbgPrint ("[SCROLL_GetScrollBarRect:FAIL]");
+ W32kReleaseWindowObject(Window);
+ return FALSE;
+ }
+
+ if (vertical)
+ pixels = lprect->bottom - lprect->top;
+ else
+ pixels = lprect->right - lprect->left;
+
+ if (pixels <= 2 * NtUserGetSystemMetrics (SM_CXVSCROLL) + SCROLL_MIN_RECT)
+ {
+ if (pixels > SCROLL_MIN_RECT)
+ *arrowSize = (pixels - SCROLL_MIN_RECT) / 2;
+ else
+ *arrowSize = 0;
+ *thumbPos = *thumbSize = 0;
+ }
+ else
+ {
+/* PSCROLLBARINFO info;
+
+ NtUserGetScrollBarInfo (hWnd, nBar, info); recursive loop.. since called function calls this function */
+
+ *arrowSize = NtUserGetSystemMetrics (SM_CXVSCROLL);
+ pixels -=
+ (2 * (NtUserGetSystemMetrics (SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP));
+/* if (info->Page)
+ {
+ thumbSize = MulDiv(pixels,info->Page,(info->MaxVal-info->MinVal+1));
+ if (*thumbSize < SCROLL_MIN_THUMB) *thumbSize = SCROLL_MIN_THUMB;
+ }
+ else *thumbSize = NtUserGetSystemMetrics(SM_CXVSCROLL); */
+/*
+ if (((pixels -= *thumbSize ) < 0) ||
+ ((info->flags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH))
+ { */
+ /* Rectangle too small or scrollbar disabled -> no thumb */
+/* *thumbPos = *thumbSize = 0;
+ }
+ else
+ { */
+/* INT max = info->MaxVal - max( info->Page-1, 0 );
+ if (info->MinVal >= max)
+ *thumbPos = *arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
+ else
+ *thumbPos = *arrowSize - SCROLL_ARROW_THUMB_OVERLAP
+ + MulDiv(pixels, (info->CurVal-info->MinVal),(max - info->MinVal));
+ } */
+ }
+ W32kReleaseWindowObject(Window);
+
+ return vertical;
+}
+
+DWORD
+STDCALL
+NtUserGetScrollBarInfo(HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
+{
+ PWINDOW_OBJECT Window = W32kGetWindowObject(hWnd);
+ int thumbSize = 20, arrowSize = 20, thumbPos = 0;
+
+ if (!Window) return FALSE;
+
+ switch(idObject)
+ {
+ 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);
+DbgPrint("z2: psbi: %08x\n", psbi);
+ 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
+STDCALL
+NtUserEnableScrollBar(
+ DWORD Unknown0,
+ DWORD Unknown1,
+ DWORD Unknown2)
+{
+ return 0;
+}
+
+DWORD
+STDCALL
+NtUserScrollDC(
+ DWORD Unknown0,
+ DWORD Unknown1,
+ DWORD Unknown2,
+ DWORD Unknown3,
+ DWORD Unknown4,
+ DWORD Unknown5,
+ DWORD Unknown6)
+
+{
+ UNIMPLEMENTED
+
+ return 0;
+}
+
+DWORD
+STDCALL
+NtUserSetScrollInfo(
+ DWORD Unknown0,
+ DWORD Unknown1,
+ DWORD Unknown2,
+ DWORD Unknown3)
+{
+ UNIMPLEMENTED
+
+ return 0;
+}
+
+DWORD
+STDCALL
+NtUserShowScrollBar(HWND hWnd, int wBar, DWORD bShow)
+{
+DbgPrint("[NtUserShowScrollBar:%d]", bShow);
+ SCROLL_ShowScrollBar (hWnd, wBar, (wBar == SB_VERT) ? 0 : bShow, (wBar == SB_HORZ) ? 0 : bShow);
+
+ return 0;
+}
+
+/* EOF */