* Copyright 1994, 1996 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library 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
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* INCLUDES *******************************************************************/
HBRUSH DefWndControlColor(HDC hDC, UINT ctlType);
-//static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
-//static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
-
-UINT WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
+UINT_PTR WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
BOOL WINAPI KillSystemTimer(HWND,UINT_PTR);
/*********************************************************************
{
SCROLLINFO Info;
- NtUserGetScrollInfo(Wnd, Bar, &Info);
+ NtUserSBGetParms(Wnd, Bar, NULL, &Info);
*ArrowSize = GetSystemMetrics(SM_CXVSCROLL);
Pixels -= (2 * GetSystemMetrics(SM_CXVSCROLL));
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_RANGE | SIF_PAGE;
- NtUserGetScrollInfo(Wnd, SBType, &si);
+ NtUserSBGetParms(Wnd, SBType, NULL, &si);
if ((Pixels -= 2 * ScrollBarInfo->dxyLineButton) <= 0)
{
return si.nMin;
DrawFrameControl(Dc, &Rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
}
+/***********************************************************************
+ * SCROLL_RefreshScrollBar
+ *
+ * Repaint the scroll bar interior after a SetScrollRange() or
+ * SetScrollPos() call.
+ */
+static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar,
+ BOOL arrows, BOOL interior )
+{
+ HDC hdc = GetDCEx( hwnd, 0,
+ DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
+ if (!hdc) return;
+
+ IntDrawScrollBar( hwnd, hdc, nBar);//, arrows, interior );
+ ReleaseDC( hwnd, hdc );
+}
/***********************************************************************
ScrollInfo.cbSize = sizeof(SCROLLINFO);
ScrollInfo.fMask = SIF_POS;
- if (! NtUserGetScrollInfo(Wnd, Bar, &ScrollInfo))
+ if (! NtUserSBGetParms(Wnd, Bar, NULL, &ScrollInfo))
{
return 0;
}
ScrollInfo.cbSize = sizeof(SCROLLINFO);
ScrollInfo.fMask = SIF_RANGE;
- Result = NtUserGetScrollInfo(Wnd, Bar, &ScrollInfo);
+ Result = NtUserSBGetParms(Wnd, Bar, NULL, &ScrollInfo);
if (Result)
{
*MinPos = ScrollInfo.nMin;
ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt)
{
MSG Msg;
- RECT WindowRect;
- UINT XOffset, YOffset;
- POINT TopLeft;
-
- if (SB_CTL != SBType)
- {
- GetWindowRect(Wnd, &WindowRect);
-
- Pt.x -= WindowRect.left;
- Pt.y -= WindowRect.top;
-
- TopLeft.x = WindowRect.left;
- TopLeft.y = WindowRect.top;
- ScreenToClient(Wnd, &TopLeft);
- XOffset = - TopLeft.x;
- YOffset = - TopLeft.y;
- }
- else
- {
- XOffset = 0;
- YOffset = 0;
- }
+ UINT XOffset = 0, YOffset = 0;
+
+ if (SBType != SB_CTL)
+ {
+ PWND pwnd = ValidateHwnd(Wnd);
+ if (!pwnd) return;
+ XOffset = pwnd->rcClient.left - pwnd->rcWindow.left;
+ YOffset = pwnd->rcClient.top - pwnd->rcWindow.top;
+ ScreenToClient(Wnd, &Pt);
+ Pt.x += XOffset;
+ Pt.y += YOffset;
+ }
IntScrollHandleScrollEvent(Wnd, SBType, WM_LBUTTONDOWN, Pt);
do
- {
- if (! GetMessageW(&Msg, 0, 0, 0))
- {
- break;
- }
- if (CallMsgFilterW(&Msg, MSGF_SCROLLBAR))
- {
- continue;
- }
-
- switch(Msg.message)
- {
- case WM_SYSTIMER:
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- Pt.x = LOWORD(Msg.lParam) + XOffset;
- Pt.y = HIWORD(Msg.lParam) + YOffset;
- IntScrollHandleScrollEvent(Wnd, SBType, Msg.message, Pt);
- break;
- default:
- TranslateMessage(&Msg);
- DispatchMessageW(&Msg);
- break;
- }
-
- if (! IsWindow(Wnd))
- {
+ {
+ if (!GetMessageW(&Msg, 0, 0, 0)) break;
+ if (CallMsgFilterW(&Msg, MSGF_SCROLLBAR)) continue;
+ if ( Msg.message == WM_LBUTTONUP ||
+ Msg.message == WM_MOUSEMOVE ||
+ (Msg.message == WM_SYSTIMER && Msg.wParam == SCROLL_TIMER))
+ {
+ Pt.x = LOWORD(Msg.lParam) + XOffset;
+ Pt.y = HIWORD(Msg.lParam) + YOffset;
+ IntScrollHandleScrollEvent(Wnd, SBType, Msg.message, Pt);
+ }
+ else
+ {
+ TranslateMessage(&Msg);
+ DispatchMessageW(&Msg);
+ }
+ if (!IsWindow(Wnd))
+ {
ReleaseCapture();
break;
- }
- }
- while (WM_LBUTTONUP != Msg.message);
+ }
+ } while (Msg.message != WM_LBUTTONUP && GetCapture() == Wnd);
}
return 0;
}
+#ifdef __REACTOS__ // Do this now, remove after Server side is fixed.
+ PWND pWnd;
+
+ pWnd = ValidateHwnd(Wnd);
+ if (pWnd)
+ {
+ if (!pWnd->fnid)
+ {
+ NtUserSetWindowFNID(Wnd, FNID_SCROLLBAR);
+ }
+ }
+#endif
+
switch (Msg)
{
case WM_CREATE:
IntScrollCreateScrollBar(Wnd, (LPCREATESTRUCTW) lParam);
break;
+#ifdef __REACTOS__
+ case WM_DESTROY:
+ NtUserSetWindowFNID(Wnd, FNID_DESTROY);
+ return DefWindowProc(Wnd, Msg, wParam, lParam );
+#endif
+
//#if 0 /* FIXME */
case WM_ENABLE:
{
case SBM_GETPOS:
return IntScrollGetScrollPos(Wnd, SB_CTL);
+ case SBM_SETRANGEREDRAW:
case SBM_SETRANGE:
{
INT OldPos = IntScrollGetScrollPos(Wnd, SB_CTL);
SetScrollRange(Wnd, SB_CTL, wParam, lParam, FALSE);
- if (OldPos != IntScrollGetScrollPos(Wnd, SB_CTL))
- {
- return OldPos;
- }
+ if (Msg == SBM_SETRANGEREDRAW)
+ SCROLL_RefreshScrollBar( Wnd, SB_CTL, TRUE, TRUE );
+ if (OldPos != IntScrollGetScrollPos(Wnd, SB_CTL)) return OldPos;
}
return 0;
case SBM_ENABLE_ARROWS:
return EnableScrollBar(Wnd, SB_CTL, wParam);
- case SBM_SETRANGEREDRAW:
- {
- INT OldPos = IntScrollGetScrollPos(Wnd, SB_CTL);
- SetScrollRange(Wnd, SB_CTL, wParam, lParam, TRUE);
- if (OldPos != IntScrollGetScrollPos(Wnd, SB_CTL))
- {
- return OldPos;
- }
- }
- return 0;
-
case SBM_SETSCROLLINFO:
return NtUserSetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam, wParam);
case SBM_GETSCROLLINFO:
- return NtUserGetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam);
+ return NtUserSBGetParms(Wnd, SB_CTL, NULL, (SCROLLINFO *) lParam);
+
+ case SBM_GETSCROLLBARINFO:
+ ((PSCROLLBARINFO)lParam)->cbSize = sizeof(SCROLLBARINFO);
+ return NtUserGetScrollBarInfo(Wnd, OBJID_CLIENT, (PSCROLLBARINFO)lParam);
case 0x00e5:
case 0x00e7:
case 0x00e8:
- case 0x00eb:
case 0x00ec:
case 0x00ed:
case 0x00ee:
/*
* @implemented
*/
+BOOL WINAPI EnableScrollBar( HWND hwnd, UINT nBar, UINT flags )
+{
+ BOOL Hook, Ret = FALSE;
+
+ LOADUSERAPIHOOK
+
+ Hook = BeginIfHookedUserApiHook();
+
+ /* Bypass SEH and go direct. */
+ if (!Hook) return NtUserEnableScrollBar(hwnd, nBar, flags);
+
+ _SEH2_TRY
+ {
+ Ret = guah.EnableScrollBar(hwnd, nBar, flags);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ }
+ _SEH2_END;
+
+ EndUserApiHook();
+
+ return Ret;
+}
+
BOOL WINAPI
-GetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info)
+RealGetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info)
{
+ PWND pWnd;
+ PSBDATA pSBData = NULL;
+
if (SB_CTL == SBType)
- {
- return SendMessageW(Wnd, SBM_GETSCROLLINFO, 0, (LPARAM) Info);
- }
- else
- {
- return NtUserGetScrollInfo(Wnd, SBType, Info);
- }
+ {
+ return SendMessageW(Wnd, SBM_GETSCROLLINFO, 0, (LPARAM) Info);
+ }
+
+ pWnd = ValidateHwnd(Wnd);
+ if (!pWnd) return FALSE;
+
+ if (SBType < SB_HORZ || SBType > SB_VERT)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ // FIXME add support to set pSBData from pWnd->pSBInfo
+ return NtUserSBGetParms(Wnd, SBType, pSBData, Info);
+}
+
+/*
+ * @implemented
+ */
+BOOL WINAPI
+GetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info)
+{
+ BOOL Hook, Ret = FALSE;
+
+ LOADUSERAPIHOOK
+
+ Hook = BeginIfHookedUserApiHook();
+
+ /* Bypass SEH and go direct. */
+ if (!Hook) return RealGetScrollInfo(Wnd, SBType, Info);
+
+ _SEH2_TRY
+ {
+ Ret = guah.GetScrollInfo(Wnd, SBType, Info);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ }
+ _SEH2_END;
+
+ EndUserApiHook();
+
+ return Ret;
}
/*
}
}
-/*
- * @implemented
- */
INT WINAPI
-SetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw)
+RealSetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw)
{
if (SB_CTL == SBType)
{
}
}
+/*
+ * @implemented
+ */
+INT WINAPI
+SetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw)
+{
+ BOOL Hook;
+ INT Ret = 0;
+
+ LOADUSERAPIHOOK
+
+ Hook = BeginIfHookedUserApiHook();
+
+ /* Bypass SEH and go direct. */
+ if (!Hook) return RealSetScrollInfo(Wnd, SBType, Info, bRedraw);
+
+ _SEH2_TRY
+ {
+ Ret = guah.SetScrollInfo(Wnd, SBType, Info, bRedraw);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ }
+ _SEH2_END;
+
+ EndUserApiHook();
+
+ return Ret;
+
+}
+
/*
* @implemented
*/
ScrollInfo.fMask = SIF_POS;
/*
- * Call NtUserGetScrollInfo() to get the previous position that
+ * Call NtUserSBGetParms() to get the previous position that
* we will later return.
*/
- if (NtUserGetScrollInfo(hWnd, nBar, &ScrollInfo))
+ if (NtUserSBGetParms(hWnd, nBar, NULL, &ScrollInfo))
{
Result = ScrollInfo.nPos;
if (Result != nPos)