ReactOS 0.4.15-dev-5666-gc548b97
scrollbar.c File Reference
#include <user32.h>
Include dependency graph for scrollbar.c:

Go to the source code of this file.

Macros

#define SCROLL_NOWHERE   0x00 /* Outside the scroll bar */
 
#define SCROLL_TOP_ARROW   0x01 /* Top or left arrow */
 
#define SCROLL_TOP_RECT   0x02 /* Rectangle between the top arrow and the thumb */
 
#define SCROLL_THUMB   0x03 /* Thumb rectangle */
 
#define SCROLL_BOTTOM_RECT   0x04 /* Rectangle between the thumb and the bottom arrow */
 
#define SCROLL_BOTTOM_ARROW   0x05 /* Bottom or right arrow */
 
#define SCROLL_FIRST_DELAY
 
#define SCROLL_REPEAT_DELAY   50 /* Delay (in ms) between scroll repetitions */
 
#define SCROLL_TIMER   0 /* Scroll timer id */
 
#define SCROLL_MIN_RECT   4
 
#define SCROLL_MIN_THUMB   6
 
#define SCROLL_ARROW_THUMB_OVERLAP   0
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (scrollbar)
 
HBRUSH DefWndControlColor (HDC hDC, UINT ctlType)
 
UINT_PTR WINAPI SetSystemTimer (HWND, UINT_PTR, UINT, TIMERPROC)
 
BOOL WINAPI KillSystemTimer (HWND, UINT_PTR)
 
static PSBDATA IntGetSBData (PWND pwnd, INT Bar)
 
static void IntDrawScrollInterior (HWND hWnd, HDC hDC, INT nBar, BOOL Vertical, PSCROLLBARINFO ScrollBarInfo)
 
static VOID FASTCALL IntDrawScrollArrows (HDC hDC, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical)
 
static VOID FASTCALL IntScrollDrawMovingThumb (HDC Dc, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical)
 
static LONG FASTCALL IntScrollGetObjectId (INT SBType)
 
static BOOL FASTCALL IntGetScrollBarInfo (HWND Wnd, INT Bar, PSCROLLBARINFO ScrollBarInfo)
 
static VOID FASTCALL IntUpdateScrollArrows (HWND Wnd, HDC hDC, PSCROLLBARINFO ScrollBarInfo, SETSCROLLBARINFO *info, INT SBType, INT Arrow, BOOL Vertical, BOOL Pressed)
 
void IntDrawScrollBar (HWND Wnd, HDC DC, INT Bar)
 
static BOOL FASTCALL IntScrollPtInRectEx (LPRECT Rect, POINT Pt, BOOL Vertical)
 
static DWORD FASTCALL IntScrollHitTest (PSCROLLBARINFO ScrollBarInfo, BOOL Vertical, POINT Pt, BOOL Dragging)
 
static BOOL FASTCALL IntScrollGetScrollBarRect (HWND Wnd, INT Bar, RECT *Rect, INT *ArrowSize, INT *ThumbSize, INT *ThumbPos)
 
static UINT FASTCALL IntScrollGetThumbVal (HWND Wnd, INT SBType, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical, INT Pos)
 
static POINT IntScrollClipPos (PRECT lpRect, POINT pt)
 
static void FASTCALL IntScrollDrawSizeGrip (HWND Wnd, HDC Dc)
 
static void SCROLL_RefreshScrollBar (HWND hwnd, INT nBar, BOOL arrows, BOOL interior)
 
static void FASTCALL IntScrollHandleKbdEvent (HWND Wnd, WPARAM wParam, LPARAM lParam)
 
static VOID FASTCALL IntScrollHandleScrollEvent (HWND Wnd, INT SBType, UINT Msg, POINT Pt)
 
static void IntScrollCreateScrollBar (HWND Wnd, LPCREATESTRUCTW lpCreate)
 
VOID FASTCALL ScrollTrackScrollBar (HWND Wnd, INT SBType, POINT Pt)
 
static DWORD FASTCALL IntSetScrollInfo (HWND Wnd, LPCSCROLLINFO Info, BOOL bRedraw)
 
LRESULT WINAPI ScrollBarWndProc_common (WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
LRESULT WINAPI ScrollBarWndProcW (HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI ScrollBarWndProcA (HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI DECLSPEC_HOTPATCH EnableScrollBar (HWND hwnd, UINT nBar, UINT flags)
 
BOOL WINAPI RealGetScrollInfo (HWND Wnd, INT SBType, LPSCROLLINFO Info)
 
BOOL WINAPI GetScrollBarInfo (_In_ HWND hwnd, _In_ LONG idObject, _Inout_ LPSCROLLBARINFO info)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetScrollInfo (HWND Wnd, INT SBType, LPSCROLLINFO Info)
 
INT WINAPI DECLSPEC_HOTPATCH GetScrollPos (HWND Wnd, INT Bar)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetScrollRange (HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos)
 
INT WINAPI RealSetScrollInfo (HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw)
 
INT WINAPI DECLSPEC_HOTPATCH SetScrollInfo (HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw)
 
INT WINAPI DECLSPEC_HOTPATCH SetScrollPos (HWND hWnd, INT nBar, INT nPos, BOOL bRedraw)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetScrollRange (HWND hWnd, INT nBar, INT nMinPos, INT nMaxPos, BOOL bRedraw)
 

Variables

static HWND ScrollTrackingWin = 0
 
static INT ScrollTrackingBar = 0
 
static INT ScrollTrackingPos = 0
 
static INT ScrollTrackingVal = 0
 
static DWORD ScrollTrackHitTest = SCROLL_NOWHERE
 
static BOOL ScrollTrackVertical
 
static BOOL ScrollMovingThumb = FALSE
 
const struct builtin_class_descr SCROLL_builtin_class
 

Macro Definition Documentation

◆ SCROLL_ARROW_THUMB_OVERLAP

#define SCROLL_ARROW_THUMB_OVERLAP   0

Definition at line 53 of file scrollbar.c.

◆ SCROLL_BOTTOM_ARROW

#define SCROLL_BOTTOM_ARROW   0x05 /* Bottom or right arrow */

Definition at line 39 of file scrollbar.c.

◆ SCROLL_BOTTOM_RECT

#define SCROLL_BOTTOM_RECT   0x04 /* Rectangle between the thumb and the bottom arrow */

Definition at line 38 of file scrollbar.c.

◆ SCROLL_FIRST_DELAY

#define SCROLL_FIRST_DELAY
Value:
200 /* Delay (in ms) before first repetition when
holding the button down */

Definition at line 41 of file scrollbar.c.

◆ SCROLL_MIN_RECT

#define SCROLL_MIN_RECT   4

Definition at line 47 of file scrollbar.c.

◆ SCROLL_MIN_THUMB

#define SCROLL_MIN_THUMB   6

Definition at line 50 of file scrollbar.c.

◆ SCROLL_NOWHERE

#define SCROLL_NOWHERE   0x00 /* Outside the scroll bar */

Definition at line 34 of file scrollbar.c.

◆ SCROLL_REPEAT_DELAY

#define SCROLL_REPEAT_DELAY   50 /* Delay (in ms) between scroll repetitions */

Definition at line 42 of file scrollbar.c.

◆ SCROLL_THUMB

#define SCROLL_THUMB   0x03 /* Thumb rectangle */

Definition at line 37 of file scrollbar.c.

◆ SCROLL_TIMER

#define SCROLL_TIMER   0 /* Scroll timer id */

Definition at line 44 of file scrollbar.c.

◆ SCROLL_TOP_ARROW

#define SCROLL_TOP_ARROW   0x01 /* Top or left arrow */

Definition at line 35 of file scrollbar.c.

◆ SCROLL_TOP_RECT

#define SCROLL_TOP_RECT   0x02 /* Rectangle between the top arrow and the thumb */

Definition at line 36 of file scrollbar.c.

Function Documentation

◆ DefWndControlColor()

HBRUSH DefWndControlColor ( HDC  hDC,
UINT  ctlType 
)

Definition at line 33 of file defwnd.c.

34{
35 if (ctlType == CTLCOLOR_SCROLLBAR)
36 {
41
42 /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
43 * we better use 0x55aa bitmap brush to make scrollbar's background
44 * look different from the window background.
45 */
46 if ( bk == IntGetSysColor(COLOR_WINDOW))
47 return gpsi->hbrGray;
48
50 return hb;
51 }
52
54
55 if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
56 {
58 }
59 else
60 {
63 }
64
66}
static HDC hDC
Definition: 3dtext.c:33
COLORREF FASTCALL IntGdiSetBkColor(_In_ HDC hDC, _In_ COLORREF Color)
COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color)
Definition: dcutil.c:172
PSERVERINFO gpsi
Definition: imm.c:18
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
__kernel_entry W32KAPI BOOL APIENTRY NtGdiUnrealizeObject(_In_ HANDLE h)
DWORD COLORREF
Definition: windef.h:300
#define CTLCOLOR_SCROLLBAR
Definition: winuser.h:950
#define COLOR_WINDOW
Definition: winuser.h:912
#define COLOR_SCROLLBAR
Definition: winuser.h:906
#define COLOR_WINDOWTEXT
Definition: winuser.h:915
#define CTLCOLOR_LISTBOX
Definition: winuser.h:947
#define CTLCOLOR_EDIT
Definition: winuser.h:946
#define COLOR_3DHILIGHT
Definition: winuser.h:931
#define COLOR_3DFACE
Definition: winuser.h:923

Referenced by IntDefWindowProc(), IntDrawScrollInterior(), and User32DefWindowProc().

◆ EnableScrollBar()

BOOL WINAPI DECLSPEC_HOTPATCH EnableScrollBar ( HWND  hwnd,
UINT  nBar,
UINT  flags 
)

Definition at line 1480 of file scrollbar.c.

1482{
1483 BOOL Hook, Ret = FALSE;
1484
1486
1487 Hook = BeginIfHookedUserApiHook();
1488
1489 /* Bypass SEH and go direct. */
1490 if (!Hook)
1491 {
1492 Ret = NtUserEnableScrollBar(hwnd, nBar, flags);
1493 if (!Ret) return Ret;
1495 return Ret;
1496 }
1497 _SEH2_TRY
1498 {
1499 Ret = guah.EnableScrollBar(hwnd, nBar, flags);
1500 }
1502 {
1503 ERR("Got exception in hooked EnableScrollBar!\n");
1504 }
1505 _SEH2_END;
1506
1508
1509 return Ret;
#define ERR(fmt,...)
Definition: debug.h:110
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
GLbitfield flags
Definition: glext.h:7161
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL NTAPI NtUserEnableScrollBar(HWND hWnd, UINT wSBflags, UINT wArrows)
Definition: scrollbar.c:1388
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
ENABLESCROLLBAR EnableScrollBar
Definition: undocuser.h:344
static void SCROLL_RefreshScrollBar(HWND hwnd, INT nBar, BOOL arrows, BOOL interior)
Definition: scrollbar.c:690
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
USERAPIHOOK guah
Definition: usrapihk.c:344
static __inline void LoadUserApiHook()
Definition: user_x.h:85
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by ScrollBarWndProc_common().

◆ GetScrollBarInfo()

BOOL WINAPI GetScrollBarInfo ( _In_ HWND  hwnd,
_In_ LONG  idObject,
_Inout_ LPSCROLLBARINFO  info 
)

Definition at line 1542 of file scrollbar.c.

1544{
1545 BOOL Ret;
1546 PWND pWnd = ValidateHwnd(hwnd);
1547 TRACE("hwnd=%p idObject=%d info=%p\n", hwnd, idObject, info);
1548 if (!pWnd) return FALSE;
1549 Ret = NtUserGetScrollBarInfo(hwnd, idObject, info); // This will be fixed once SB is server side.
1550 /* rcScrollBar needs to be in screen coordinates */
1551 OffsetRect( &(info->rcScrollBar), pWnd->rcWindow.left, pWnd->rcWindow.top );
1552 return Ret;
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
BOOL NTAPI NtUserGetScrollBarInfo(HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
Definition: scrollbar.c:1278
#define TRACE(s)
Definition: solgame.cpp:4
Definition: ntuser.h:689
RECT rcWindow
Definition: ntuser.h:711
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)

◆ GetScrollInfo()

BOOL WINAPI DECLSPEC_HOTPATCH GetScrollInfo ( HWND  Wnd,
INT  SBType,
LPSCROLLINFO  Info 
)

Definition at line 1560 of file scrollbar.c.

1562{
1563 BOOL Hook, Ret = FALSE;
1564
1566
1567 Hook = BeginIfHookedUserApiHook();
1568
1569 /* Bypass SEH and go direct. */
1570 if (!Hook) return RealGetScrollInfo(Wnd, SBType, Info);
1571
1572 _SEH2_TRY
1573 {
1574 Ret = guah.GetScrollInfo(Wnd, SBType, Info);
1575 }
1577 {
1578 ERR("Got exception in hooked GetScrollInfo!\n");
1579 }
1580 _SEH2_END;
1581
1583
1584 return Ret;
GETSCROLLINFO GetScrollInfo
Definition: undocuser.h:342
BOOL WINAPI RealGetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info)
Definition: scrollbar.c:1512
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

◆ GetScrollPos()

INT WINAPI DECLSPEC_HOTPATCH GetScrollPos ( HWND  Wnd,
INT  Bar 
)

Definition at line 1592 of file scrollbar.c.

1594{
1595 PWND pwnd;
1596 PSBDATA pSBData;
1597
1598 TRACE("Wnd=%p Bar=%d\n", Wnd, Bar);
1599
1600 /* Refer SB_CTL requests to the window */
1601 if (SB_CTL == Bar)
1602 {
1603 return SendMessageW(Wnd, SBM_GETPOS, (WPARAM) 0, (LPARAM) 0);
1604 }
1605 else if (Bar == SB_HORZ || Bar == SB_VERT )
1606 {
1607 pwnd = ValidateHwnd(Wnd);
1608 if (!pwnd) return 0;
1609
1610 if (pwnd->pSBInfo)
1611 {
1612 pSBData = IntGetSBData(pwnd, Bar);
1613 return pSBData->pos;
1614 }
1615
1617 TRACE("GetScrollPos No Scroll Info\n");
1618 return 0;
1619 }
1621 return 0;
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
void Bar(void)
Definition: terminate.cpp:70
PSBDATA FASTCALL IntGetSBData(PWND pwnd, INT Bar)
Definition: scrollbar.c:82
PSBINFO pSBInfo
Definition: ntuser.h:721
INT pos
Definition: ntuser.h:503
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define ERROR_NO_SCROLLBARS
Definition: winerror.h:928
#define SB_VERT
Definition: winuser.h:553
#define SBM_GETPOS
Definition: winuser.h:2068
#define SB_CTL
Definition: winuser.h:554
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SB_HORZ
Definition: winuser.h:552

◆ GetScrollRange()

BOOL WINAPI DECLSPEC_HOTPATCH GetScrollRange ( HWND  Wnd,
int  Bar,
LPINT  MinPos,
LPINT  MaxPos 
)

Definition at line 1629 of file scrollbar.c.

1631{
1632 PWND pwnd;
1633 PSBDATA pSBData;
1634
1635 TRACE("Wnd=%x Bar=%d Min=%p Max=%p\n", Wnd, Bar, MinPos, MaxPos);
1636
1637 /* Refer SB_CTL requests to the window */
1638 if (SB_CTL == Bar)
1639 {
1640 return SendMessageW(Wnd, SBM_GETRANGE, (WPARAM) MinPos, (LPARAM) MaxPos);
1641 }
1642 else if (Bar == SB_HORZ || Bar == SB_VERT )
1643 {
1644 pwnd = ValidateHwnd(Wnd);
1645 if (!pwnd) return FALSE;
1646
1647 if (pwnd->pSBInfo)
1648 {
1649 pSBData = IntGetSBData(pwnd, Bar);
1650 *MinPos = pSBData->posMin;
1651 *MaxPos = pSBData->posMax;
1652 }
1653 else
1654 {
1656 *MinPos = 0;
1657 *MaxPos = 0;
1658 }
1659 return TRUE;
1660 }
1662 return FALSE;
INT posMax
Definition: ntuser.h:501
INT posMin
Definition: ntuser.h:500
#define SBM_GETRANGE
Definition: winuser.h:2069

◆ IntDrawScrollArrows()

static VOID FASTCALL IntDrawScrollArrows ( HDC  hDC,
PSCROLLBARINFO  ScrollBarInfo,
BOOL  Vertical 
)
static

Definition at line 231 of file scrollbar.c.

233{
234 RECT RectLT, RectRB;
235 INT ScrollDirFlagLT, ScrollDirFlagRB;
236
237 RectLT = RectRB = ScrollBarInfo->rcScrollBar;
238 if (Vertical)
239 {
240 ScrollDirFlagLT = DFCS_SCROLLUP;
241 ScrollDirFlagRB = DFCS_SCROLLDOWN;
242 RectLT.bottom = RectLT.top + ScrollBarInfo->dxyLineButton;
243 RectRB.top = RectRB.bottom - ScrollBarInfo->dxyLineButton;
244 }
245 else
246 {
247 ScrollDirFlagLT = DFCS_SCROLLLEFT;
248 ScrollDirFlagRB = DFCS_SCROLLRIGHT;
249 RectLT.right = RectLT.left + ScrollBarInfo->dxyLineButton;
250 RectRB.left = RectRB.right - ScrollBarInfo->dxyLineButton;
251 }
252
253 if (ScrollBarInfo->rgstate[SCROLL_TOP_ARROW] & STATE_SYSTEM_PRESSED)
254 {
255 ScrollDirFlagLT |= DFCS_PUSHED | DFCS_FLAT;
256 }
258 {
259 ScrollDirFlagLT |= DFCS_INACTIVE;
260 }
262 {
263 ScrollDirFlagRB |= DFCS_PUSHED | DFCS_FLAT;
264 }
266 {
267 ScrollDirFlagRB |= DFCS_INACTIVE;
268 }
269
270 DrawFrameControl(hDC, &RectLT, DFC_SCROLL, ScrollDirFlagLT);
271 DrawFrameControl(hDC, &RectRB, DFC_SCROLL, ScrollDirFlagRB);
#define SCROLL_BOTTOM_ARROW
Definition: scrollbar.c:19
#define SCROLL_TOP_ARROW
Definition: scrollbar.c:15
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3744
int32_t INT
Definition: typedefs.h:58
#define STATE_SYSTEM_PRESSED
Definition: winuser.h:2855
#define DFC_SCROLL
Definition: winuser.h:475
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_FLAT
Definition: winuser.h:510
#define DFCS_INACTIVE
Definition: winuser.h:502
#define DFCS_SCROLLUP
Definition: winuser.h:489
#define STATE_SYSTEM_UNAVAILABLE
Definition: winuser.h:2852
#define DFCS_SCROLLLEFT
Definition: winuser.h:491
#define DFCS_SCROLLRIGHT
Definition: winuser.h:492
#define DFCS_SCROLLDOWN
Definition: winuser.h:490
#define DFCS_PUSHED
Definition: winuser.h:503

◆ IntDrawScrollBar()

void IntDrawScrollBar ( HWND  Wnd,
HDC  DC,
INT  Bar 
)

Definition at line 341 of file scrollbar.c.

343{
344 //PSBWND pSBWnd;
345 //INT ThumbSize;
347 BOOL Vertical;
348
349 /*
350 * Get scroll bar info.
351 */
352 switch (Bar)
353 {
354 case SB_HORZ:
355 Vertical = FALSE;
356 break;
357
358 case SB_VERT:
359 Vertical = TRUE;
360 break;
361
362 case SB_CTL:
363 Vertical = (GetWindowLongPtrW(Wnd, GWL_STYLE) & SBS_VERT) != 0;
364 break;
365
366 default:
367 return;
368 }
369 if (!IntGetScrollBarInfo(Wnd, Bar, &Info))
370 {
371 return;
372 }
373
374 if (IsRectEmpty(&Info.rcScrollBar))
375 {
376 return;
377 }
378
379 //ThumbSize = pSBWnd->pSBCalc->pxThumbBottom - pSBWnd->pSBCalc->pxThumbTop;
380
381 /*
382 * Draw the arrows.
383 */
384 if (Info.dxyLineButton)
385 {
386 IntDrawScrollArrows(DC, &Info, Vertical);
387 }
388
389 /*
390 * Draw the interior.
391 */
392 IntDrawScrollInterior(Wnd, DC, Bar, Vertical, &Info);
393
394 /*
395 * If scroll bar has focus, reposition the caret.
396 */
397 if (Wnd == GetFocus() && SB_CTL == Bar)
398 {
399 if (Vertical)
400 {
401 SetCaretPos(Info.rcScrollBar.top + 1, Info.dxyLineButton + 1);
402 }
403 else
404 {
405 SetCaretPos(Info.dxyLineButton + 1, Info.rcScrollBar.top + 1);
406 }
407 }
static VOID FASTCALL IntDrawScrollArrows(HDC hDC, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical)
Definition: scrollbar.c:1111
static void IntDrawScrollInterior(PWND pWnd, HDC hDC, INT nBar, BOOL Vertical, PSCROLLBARINFO ScrollBarInfo)
Definition: scrollbar.c:996
Definition: polytest.cpp:41
static BOOL FASTCALL IntGetScrollBarInfo(HWND Wnd, INT Bar, PSCROLLBARINFO ScrollBarInfo)
Definition: scrollbar.c:313
HWND WINAPI GetFocus(void)
Definition: window.c:1894
#define GetWindowLongPtrW
Definition: winuser.h:4819
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define SBS_VERT
Definition: winuser.h:334
BOOL WINAPI SetCaretPos(_In_ int, _In_ int)
#define GWL_STYLE
Definition: winuser.h:846

◆ IntDrawScrollInterior()

static void IntDrawScrollInterior ( HWND  hWnd,
HDC  hDC,
INT  nBar,
BOOL  Vertical,
PSCROLLBARINFO  ScrollBarInfo 
)
static

Definition at line 116 of file scrollbar.c.

119{
120 INT ThumbSize = ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop;
121 INT ThumbTop = ScrollBarInfo->xyThumbTop;
122 RECT Rect;
123 HBRUSH hSaveBrush, hBrush;
124 BOOL TopSelected = FALSE, BottomSelected = FALSE;
125
126 if (ScrollBarInfo->rgstate[SCROLL_TOP_RECT] & STATE_SYSTEM_PRESSED)
127 TopSelected = TRUE;
128 if (ScrollBarInfo->rgstate[SCROLL_BOTTOM_RECT] & STATE_SYSTEM_PRESSED)
129 BottomSelected = TRUE;
130
131 /*
132 * Only scrollbar controls send WM_CTLCOLORSCROLLBAR.
133 * The window-owned scrollbars need to call DefWndControlColor
134 * to correctly setup default scrollbar colors
135 */
136 if (nBar == SB_CTL)
137 {
139 if (!hBrush)
141 }
142 else
143 {
145 }
146
147 hSaveBrush = SelectObject(hDC, hBrush);
148
149 /* Calculate the scroll rectangle */
150 if (Vertical)
151 {
152 Rect.top = ScrollBarInfo->rcScrollBar.top + ScrollBarInfo->dxyLineButton;
153 Rect.bottom = ScrollBarInfo->rcScrollBar.bottom - ScrollBarInfo->dxyLineButton;
154 Rect.left = ScrollBarInfo->rcScrollBar.left;
155 Rect.right = ScrollBarInfo->rcScrollBar.right;
156 }
157 else
158 {
159 Rect.top = ScrollBarInfo->rcScrollBar.top;
160 Rect.bottom = ScrollBarInfo->rcScrollBar.bottom;
161 Rect.left = ScrollBarInfo->rcScrollBar.left + ScrollBarInfo->dxyLineButton;
162 Rect.right = ScrollBarInfo->rcScrollBar.right - ScrollBarInfo->dxyLineButton;
163 }
164
165 /* Draw the scroll rectangles and thumb */
166 if (!ScrollBarInfo->xyThumbBottom)
167 {
168 PatBlt(hDC, Rect.left, Rect.top, Rect.right - Rect.left,
169 Rect.bottom - Rect.top, PATCOPY);
170
171 /* Cleanup and return */
172 SelectObject(hDC, hSaveBrush);
173 return;
174 }
175
176 ThumbTop -= ScrollBarInfo->dxyLineButton;
177
178 if (ScrollBarInfo->dxyLineButton)
179 {
180 if (Vertical)
181 {
182 if (ThumbSize)
183 {
184 PatBlt(hDC, Rect.left, Rect.top, Rect.right - Rect.left,
185 ThumbTop, TopSelected ? BLACKNESS : PATCOPY);
186 Rect.top += ThumbTop;
187 PatBlt(hDC, Rect.left, Rect.top + ThumbSize, Rect.right - Rect.left,
188 Rect.bottom - Rect.top - ThumbSize, BottomSelected ? BLACKNESS : PATCOPY);
189 Rect.bottom = Rect.top + ThumbSize;
190 }
191 else
192 {
193 if (ThumbTop)
194 {
195 PatBlt(hDC, Rect.left, ScrollBarInfo->dxyLineButton,
196 Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY);
197 }
198 }
199 }
200 else
201 {
202 if (ThumbSize)
203 {
204 PatBlt(hDC, Rect.left, Rect.top, ThumbTop,
205 Rect.bottom - Rect.top, TopSelected ? BLACKNESS : PATCOPY);
206 Rect.left += ThumbTop;
207 PatBlt(hDC, Rect.left + ThumbSize, Rect.top,
208 Rect.right - Rect.left - ThumbSize, Rect.bottom - Rect.top,
209 BottomSelected ? BLACKNESS : PATCOPY);
210 Rect.right = Rect.left + ThumbSize;
211 }
212 else
213 {
214 if (ThumbTop)
215 {
216 PatBlt(hDC, ScrollBarInfo->dxyLineButton, Rect.top,
217 Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY);
218 }
219 }
220 }
221 }
222
223 /* Draw the thumb */
224 if (ThumbSize)
226
227 /* Cleanup */
228 SelectObject(hDC, hSaveBrush);
HWND hWnd
Definition: settings.c:17
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:33
#define SCROLL_BOTTOM_RECT
Definition: scrollbar.c:18
#define SCROLL_TOP_RECT
Definition: scrollbar.c:16
HBRUSH FASTCALL GetControlBrush(PWND pwnd, HDC hdc, UINT ctlType)
Definition: misc.c:172
#define BLACKNESS
Definition: wingdi.h:323
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define PATCOPY
Definition: wingdi.h:335
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1761
#define BF_MIDDLE
Definition: winuser.h:468
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450

◆ IntGetSBData()

static PSBDATA IntGetSBData ( PWND  pwnd,
INT  Bar 
)
static

Definition at line 89 of file scrollbar.c.

91{
92 PSBWND pSBWnd;
93 PSBINFO pSBInfo;
94
95 pSBInfo = DesktopPtrToUser(pwnd->pSBInfo);
96 switch (Bar)
97 {
98 case SB_HORZ:
99 return &pSBInfo->Horz;
100 case SB_VERT:
101 return &pSBInfo->Vert;
102 case SB_CTL:
103 if ( pwnd->cbwndExtra < (sizeof(SBWND)-sizeof(WND)) )
104 {
105 ERR("IntGetSBData Wrong Extra bytes for CTL Scrollbar!\n");
106 return 0;
107 }
108 pSBWnd = (PSBWND)pwnd;
109 return (PSBDATA)&pSBWnd->SBCalc;
110 default:
111 ERR("IntGetSBData Bad Bar!\n");
112 }
113 return NULL;
#define NULL
Definition: types.h:112
static PVOID FASTCALL DesktopPtrToUser(PVOID ptr)
Definition: utils.c:324
struct _SBWND * PSBWND
Definition: ntuser.h:767
SBCALC SBCalc
Definition: ntuser.h:771
ULONG cbwndExtra
Definition: ntuser.h:733
SBDATA Vert
Definition: ntuser.h:510
SBDATA Horz
Definition: ntuser.h:509

◆ IntGetScrollBarInfo()

static BOOL FASTCALL IntGetScrollBarInfo ( HWND  Wnd,
INT  Bar,
PSCROLLBARINFO  ScrollBarInfo 
)
static

Definition at line 313 of file scrollbar.c.

315{
316 ScrollBarInfo->cbSize = sizeof(SCROLLBARINFO);
317
318 return NtUserGetScrollBarInfo(Wnd, IntScrollGetObjectId(Bar), ScrollBarInfo);
static LONG FASTCALL IntScrollGetObjectId(INT SBType)
Definition: scrollbar.c:1154
struct tagSCROLLBARINFO SCROLLBARINFO

Referenced by IntDrawScrollBar(), and IntScrollHandleScrollEvent().

◆ IntScrollClipPos()

static POINT IntScrollClipPos ( PRECT  lpRect,
POINT  pt 
)
static

Definition at line 650 of file scrollbar.c.

652{
653 if( pt.x < lpRect->left )
654 pt.x = lpRect->left;
655 else
656 if( pt.x > lpRect->right )
657 pt.x = lpRect->right;
658
659 if( pt.y < lpRect->top )
660 pt.y = lpRect->top;
661 else
662 if( pt.y > lpRect->bottom )
663 pt.y = lpRect->bottom;
664
665 return pt;
#define pt(x, y)
Definition: drawing.c:79

Referenced by IntScrollHandleScrollEvent().

◆ IntScrollCreateScrollBar()

static void IntScrollCreateScrollBar ( HWND  Wnd,
LPCREATESTRUCTW  lpCreate 
)
static

Definition at line 1073 of file scrollbar.c.

1077{
1079
1080 Info.cbSize = sizeof(SCROLLINFO);
1081 Info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
1082 Info.nMin = 0;
1083 Info.nMax = 0;
1084 Info.nPage = 0;
1085 Info.nPos = 0;
1086 Info.nTrackPos = 0;
1088
1089 TRACE("hwnd=%p lpCreate=%p\n", Wnd, lpCreate);
1090
1091#if 0 /* FIXME */
1092 if (lpCreate->style & WS_DISABLED)
1093 {
1094 // info->flags = ESB_DISABLE_BOTH;
1095 //NtUserEnableScrollBar(Wnd,SB_CTL,(wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH));
1097 ERR("Created WS_DISABLED scrollbar\n");
1098 }
1099#endif
1100 if (0 != (lpCreate->style & (SBS_SIZEGRIP | SBS_SIZEBOX)))
1101 {
1102 if (0 != (lpCreate->style & SBS_SIZEBOXTOPLEFTALIGN))
1103 {
1104 MoveWindow(Wnd, lpCreate->x, lpCreate->y, GetSystemMetrics(SM_CXVSCROLL) + 1,
1106 }
1107 else if (0 != (lpCreate->style & SBS_SIZEBOXBOTTOMRIGHTALIGN))
1108 {
1109 MoveWindow(Wnd, lpCreate->x + lpCreate->cx - GetSystemMetrics(SM_CXVSCROLL) - 1,
1110 lpCreate->y + lpCreate->cy - GetSystemMetrics(SM_CYHSCROLL) - 1,
1113 }
1114 }
1115 else if (0 != (lpCreate->style & SBS_VERT))
1116 {
1117 if (0 != (lpCreate->style & SBS_LEFTALIGN))
1118 {
1119 MoveWindow(Wnd, lpCreate->x, lpCreate->y,
1120 GetSystemMetrics(SM_CXVSCROLL) + 1, lpCreate->cy, FALSE);
1121 }
1122 else if (0 != (lpCreate->style & SBS_RIGHTALIGN))
1123 {
1124 MoveWindow(Wnd,
1125 lpCreate->x + lpCreate->cx - GetSystemMetrics(SM_CXVSCROLL) - 1,
1126 lpCreate->y,
1127 GetSystemMetrics(SM_CXVSCROLL) + 1, lpCreate->cy, FALSE);
1128 }
1129 }
1130 else /* SBS_HORZ */
1131 {
1132 if (0 != (lpCreate->style & SBS_TOPALIGN))
1133 {
1134 MoveWindow(Wnd, lpCreate->x, lpCreate->y,
1135 lpCreate->cx, GetSystemMetrics(SM_CYHSCROLL) + 1, FALSE);
1136 }
1137 else if (0 != (lpCreate->style & SBS_BOTTOMALIGN))
1138 {
1139 MoveWindow(Wnd,
1140 lpCreate->x,
1141 lpCreate->y + lpCreate->cy - GetSystemMetrics(SM_CYHSCROLL) - 1,
1142 lpCreate->cx, GetSystemMetrics(SM_CYHSCROLL) + 1, FALSE);
1143 }
1144 }
BOOL NTAPI NtUserMessageCall(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ResultInfo, DWORD dwType, BOOL Ansi)
Definition: message.c:2486
#define FNID_SCROLLBAR
Definition: ntuser.h:854
DWORD NTAPI NtUserSetScrollInfo(HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
Definition: scrollbar.c:1473
#define WS_DISABLED
Definition: pedump.c:621
#define SBS_TOPALIGN
Definition: winuser.h:333
#define WM_ENABLE
Definition: winuser.h:1605
#define SBS_SIZEGRIP
Definition: winuser.h:332
struct tagSCROLLINFO SCROLLINFO
#define SIF_RANGE
Definition: winuser.h:1225
#define SM_CXVSCROLL
Definition: winuser.h:955
#define SBS_SIZEBOX
Definition: winuser.h:329
#define SIF_PAGE
Definition: winuser.h:1223
#define SM_CYHSCROLL
Definition: winuser.h:956
#define SBS_SIZEBOXTOPLEFTALIGN
Definition: winuser.h:331
#define SBS_LEFTALIGN
Definition: winuser.h:327
#define SBS_BOTTOMALIGN
Definition: winuser.h:325
#define SBS_RIGHTALIGN
Definition: winuser.h:328
#define SBS_SIZEBOXBOTTOMRIGHTALIGN
Definition: winuser.h:330
#define SIF_POS
Definition: winuser.h:1224
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by ScrollBarWndProc_common().

◆ IntScrollDrawMovingThumb()

static VOID FASTCALL IntScrollDrawMovingThumb ( HDC  Dc,
PSCROLLBARINFO  ScrollBarInfo,
BOOL  Vertical 
)
static

Definition at line 274 of file scrollbar.c.

276{
278 INT MaxSize;
279 INT OldTop;
280
281 if (Vertical)
282 MaxSize = ScrollBarInfo->rcScrollBar.bottom - ScrollBarInfo->rcScrollBar.top;
283 else
284 MaxSize = ScrollBarInfo->rcScrollBar.right - ScrollBarInfo->rcScrollBar.left;
285
286 MaxSize -= ScrollBarInfo->dxyLineButton + ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop;
287
288 if (Pos < ScrollBarInfo->dxyLineButton)
289 Pos = ScrollBarInfo->dxyLineButton;
290 else if (MaxSize < Pos)
291 Pos = MaxSize;
292
293 OldTop = ScrollBarInfo->xyThumbTop;
294 ScrollBarInfo->xyThumbBottom = Pos + ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop;
295 ScrollBarInfo->xyThumbTop = Pos;
296 IntDrawScrollInterior(ScrollTrackingWin, Dc, ScrollTrackingBar, Vertical, ScrollBarInfo);
297 ScrollBarInfo->xyThumbBottom = OldTop + ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop;
298 ScrollBarInfo->xyThumbTop = OldTop;
299
ush Pos
Definition: deflate.h:92
static BOOL ScrollMovingThumb
Definition: scrollbar.c:65
static INT ScrollTrackingBar
Definition: scrollbar.c:57
static INT ScrollTrackingPos
Definition: scrollbar.c:58
static HWND ScrollTrackingWin
Definition: scrollbar.c:56

Referenced by IntScrollHandleScrollEvent().

◆ IntScrollDrawSizeGrip()

static void FASTCALL IntScrollDrawSizeGrip ( HWND  Wnd,
HDC  Dc 
)
static

Definition at line 673 of file scrollbar.c.

675{
676 RECT Rect;
677
678 GetClientRect(Wnd, &Rect);
680 Rect.left = max(Rect.left, Rect.right - GetSystemMetrics(SM_CXVSCROLL) - 1);
681 Rect.top = max(Rect.top, Rect.bottom - GetSystemMetrics(SM_CYHSCROLL) - 1);
#define max(a, b)
Definition: svc.c:63
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define DFCS_SCROLLSIZEGRIP
Definition: winuser.h:494
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by ScrollBarWndProc_common().

◆ IntScrollGetObjectId()

static LONG FASTCALL IntScrollGetObjectId ( INT  SBType)
static

Definition at line 303 of file scrollbar.c.

305{
306 if (SBType == SB_VERT)
307 return OBJID_VSCROLL;
308 if (SBType == SB_HORZ)
309 return OBJID_HSCROLL;
310 return OBJID_CLIENT;
#define OBJID_VSCROLL
Definition: winable.h:20
#define OBJID_HSCROLL
Definition: winable.h:21
#define OBJID_CLIENT
Definition: winable.h:19

◆ IntScrollGetScrollBarRect()

static BOOL FASTCALL IntScrollGetScrollBarRect ( HWND  Wnd,
INT  Bar,
RECT Rect,
INT ArrowSize,
INT ThumbSize,
INT ThumbPos 
)
static

Definition at line 484 of file scrollbar.c.

488{
489 INT Pixels;
490 BOOL Vertical;
491 PWND pWnd;
492 PSBINFO pSBInfo;
493 PSBDATA pSBData;
494 PSBWND pSBWnd;
495
496 pWnd = ValidateHwnd( Wnd );
497 if (!pWnd) return FALSE;
498 pSBInfo = DesktopPtrToUser(pWnd->pSBInfo);
499
500 *Rect = pWnd->rcClient;
501 OffsetRect( Rect, -pWnd->rcWindow.left, -pWnd->rcWindow.top );
502 if (pWnd->ExStyle & WS_EX_LAYOUTRTL)
503 mirror_rect( &pWnd->rcWindow, Rect );
504
505 switch (Bar)
506 {
507 case SB_HORZ:
508// WIN_GetRectangles( Wnd, COORDS_WINDOW, NULL, Rect );
509 Rect->top = Rect->bottom;
511 if (pWnd->style & WS_BORDER)
512 {
513 Rect->left--;
514 Rect->right++;
515 }
516 else if (pWnd->style & WS_VSCROLL)
517 {
518 Rect->right++;
519 }
520 Vertical = FALSE;
521 pSBData = &pSBInfo->Horz;
522 break;
523
524 case SB_VERT:
525// WIN_GetRectangles( Wnd, COORDS_WINDOW, NULL, Rect );
526 if (pWnd->ExStyle & WS_EX_LEFTSCROLLBAR)
527 {
528 Rect->right = Rect->left;
530 }
531 else
532 {
533 Rect->left = Rect->right;
535 }
536 if (pWnd->style & WS_BORDER)
537 {
538 Rect->top--;
539 Rect->bottom++;
540 }
541 else if (pWnd->style & WS_HSCROLL)
542 {
543 Rect->bottom++;
544 }
545 Vertical = TRUE;
546 pSBData = &pSBInfo->Vert;
547 break;
548
549 case SB_CTL:
550 GetClientRect( Wnd, Rect );
551 Vertical = (pWnd->style & SBS_VERT);
552 pSBWnd = (PSBWND)pWnd;
553 pSBData = (PSBDATA)&pSBWnd->SBCalc;
554 break;
555
556 default:
557 return FALSE;
558 }
559
560 if (Vertical) Pixels = Rect->bottom - Rect->top;
561 else Pixels = Rect->right - Rect->left;
562
563 if (Pixels <= 2 * GetSystemMetrics(SM_CXVSCROLL) + SCROLL_MIN_RECT)
564 {
565 if (SCROLL_MIN_RECT < Pixels)
566 *ArrowSize = (Pixels - SCROLL_MIN_RECT) / 2;
567 else
568 *ArrowSize = 0;
569 *ThumbPos = *ThumbSize = 0;
570 }
571 else
572 {
573 *ArrowSize = GetSystemMetrics(SM_CXVSCROLL);
575 if (pSBData->page)
576 {
577 *ThumbSize = MulDiv(Pixels, pSBData->page, (pSBData->posMax - pSBData->posMin + 1));
578 if (*ThumbSize < SCROLL_MIN_THUMB) *ThumbSize = SCROLL_MIN_THUMB;
579 }
580 else *ThumbSize = GetSystemMetrics(SM_CXVSCROLL);
581
582 if (((Pixels -= *ThumbSize ) < 0) ||
583 (( pSBInfo->WSBflags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH))
584 {
585 /* Rectangle too small or scrollbar disabled -> no thumb */
586 *ThumbPos = *ThumbSize = 0;
587 }
588 else
589 {
590 INT Max = pSBData->posMax - max(pSBData->page - 1, 0);
591 if (pSBData->posMin >= Max)
592 *ThumbPos = *ArrowSize - SCROLL_ARROW_THUMB_OVERLAP;
593 else
594 *ThumbPos = *ArrowSize - SCROLL_ARROW_THUMB_OVERLAP
595 + MulDiv(Pixels, (pSBData->pos - pSBData->posMin),(Max - pSBData->posMin));
596 }
597 }
598 return Vertical;
#define Max(a, b)
Definition: cdprocs.h:78
struct tagSBDATA * PSBDATA
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
static void mirror_rect(const RECT *window_rect, RECT *rect)
Definition: scrollbar.c:73
#define WS_BORDER
Definition: pedump.c:625
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
DWORD ExStyle
Definition: ntuser.h:699
DWORD style
Definition: ntuser.h:701
RECT rcClient
Definition: ntuser.h:712
INT page
Definition: ntuser.h:502
INT WSBflags
Definition: ntuser.h:508
#define SCROLL_MIN_RECT
Definition: scrollbar.c:47
#define SCROLL_MIN_THUMB
Definition: scrollbar.c:50
#define SCROLL_ARROW_THUMB_OVERLAP
Definition: scrollbar.c:53
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define ESB_DISABLE_BOTH
Definition: winuser.h:556
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392

Referenced by ScrollBarWndProc_common().

◆ IntScrollGetThumbVal()

static UINT FASTCALL IntScrollGetThumbVal ( HWND  Wnd,
INT  SBType,
PSCROLLBARINFO  ScrollBarInfo,
BOOL  Vertical,
INT  Pos 
)
static

Definition at line 607 of file scrollbar.c.

610{
611 PWND pWnd;
612 PSBDATA pSBData;
613 INT Pixels = Vertical ? ScrollBarInfo->rcScrollBar.bottom
614 - ScrollBarInfo->rcScrollBar.top
615 : ScrollBarInfo->rcScrollBar.right
616 - ScrollBarInfo->rcScrollBar.left;
617
618 pWnd = ValidateHwnd( Wnd );
619 if (!pWnd) return FALSE;
620
621 pSBData = IntGetSBData(pWnd, SBType);
622
623 if ((Pixels -= 2 * ScrollBarInfo->dxyLineButton) <= 0)
624 {
625 return pSBData->posMin;
626 }
627
628 if ((Pixels -= (ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop)) <= 0)
629 {
630 return pSBData->posMin;
631 }
632
633 Pos = Pos - ScrollBarInfo->dxyLineButton;
634 if (Pos < 0)
635 {
636 Pos = 0;
637 }
638 if (Pos > Pixels) Pos = Pixels;
639
640 if (!pSBData->page)
641 Pos *= pSBData->posMax - pSBData->posMin;
642 else
643 Pos *= pSBData->posMax - pSBData->posMin - pSBData->page + 1;
644
645 return pSBData->posMin + ((Pos + Pixels / 2) / Pixels);

Referenced by IntScrollHandleScrollEvent().

◆ IntScrollHandleKbdEvent()

static void FASTCALL IntScrollHandleKbdEvent ( HWND  Wnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 708 of file scrollbar.c.

713{
714 TRACE("Wnd=%p wParam=%ld lParam=%ld\n", Wnd, wParam, lParam);
715
716 /* hide caret on first KEYDOWN to prevent flicker */
718 {
719 HideCaret(Wnd);
720 }
721
722 switch(wParam)
723 {
724 case VK_PRIOR:
726 break;
727
728 case VK_NEXT:
730 break;
731
732 case VK_HOME:
733 wParam = SB_TOP;
734 break;
735
736 case VK_END:
738 break;
739
740 case VK_UP:
742 break;
743
744 case VK_DOWN:
746 break;
747
748 default:
749 return;
750 }
751
753 (0 != (GetWindowLongPtrW(Wnd, GWL_STYLE ) & SBS_VERT) ?
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define PFD_DOUBLEBUFFER_DONTCARE
Definition: wingdi.h:316
#define SB_LINEUP
Definition: winuser.h:564
#define WM_HSCROLL
Definition: winuser.h:1733
#define WM_VSCROLL
Definition: winuser.h:1734
#define SB_BOTTOM
Definition: winuser.h:577
#define VK_UP
Definition: winuser.h:2215
#define VK_NEXT
Definition: winuser.h:2211
#define VK_END
Definition: winuser.h:2212
#define VK_HOME
Definition: winuser.h:2213
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_LINEDOWN
Definition: winuser.h:565
HWND WINAPI GetParent(_In_ HWND)
#define SB_TOP
Definition: winuser.h:578
#define VK_DOWN
Definition: winuser.h:2217
#define VK_PRIOR
Definition: winuser.h:2210
BOOL WINAPI HideCaret(_In_opt_ HWND)
#define SB_PAGEUP
Definition: winuser.h:568

Referenced by ScrollBarWndProc_common().

◆ IntScrollHandleScrollEvent()

static VOID FASTCALL IntScrollHandleScrollEvent ( HWND  Wnd,
INT  SBType,
UINT  Msg,
POINT  Pt 
)
static

Definition at line 763 of file scrollbar.c.

765{
766 static POINT PrevPt; /* Previous mouse position for timer events */
767 static UINT TrackThumbPos; /* Thumb position when tracking started. */
768 static INT LastClickPos; /* Position in the scroll-bar of the last
769 button-down event. */
770 static INT LastMousePos; /* Position in the scroll-bar of the last
771 mouse event. */
772
773 DWORD HitTest;
774 HWND WndOwner, WndCtl;
775 BOOL Vertical;
776 HDC Dc;
777 SCROLLBARINFO ScrollBarInfo;
778 SETSCROLLBARINFO NewInfo;
779
780 if (! IntGetScrollBarInfo(Wnd, SBType, &ScrollBarInfo))
781 {
782 return;
783 }
785 {
787 if (Wnd == GetCapture())
788 {
790 }
792 return;
793 }
794
796 NewInfo.reserved = ScrollBarInfo.reserved;
797 memcpy(NewInfo.rgstate, ScrollBarInfo.rgstate, (CCHILDREN_SCROLLBAR + 1) * sizeof(DWORD));
798
799 if (SBType == SB_CTL && (GetWindowLongPtrW(Wnd, GWL_STYLE) & (SBS_SIZEGRIP | SBS_SIZEBOX)))
800 {
801 switch(Msg)
802 {
803 case WM_LBUTTONDOWN: /* Initialise mouse tracking */
804 HideCaret(Wnd); /* hide caret while holding down LBUTTON */
805 SetCapture(Wnd);
806 PrevPt = Pt;
808 break;
809 case WM_MOUSEMOVE:
810 GetClientRect(GetParent(GetParent(Wnd)), &ScrollBarInfo.rcScrollBar);
811 PrevPt = Pt;
812 break;
813 case WM_LBUTTONUP:
816 if (Wnd == GetFocus()) ShowCaret(Wnd);
817 break;
818 case WM_SYSTIMER:
819 Pt = PrevPt;
820 break;
821 }
822 return;
823 }
824
825 Dc = GetDCEx(Wnd, 0, DCX_CACHE | ((SB_CTL == SBType) ? 0 : DCX_WINDOW));
826 if (SB_VERT == SBType)
827 {
828 Vertical = TRUE;
829 }
830 else if (SB_HORZ == SBType)
831 {
832 Vertical = FALSE;
833 }
834 else
835 {
836 Vertical = (0 != (GetWindowLongPtrW(Wnd, GWL_STYLE) & SBS_VERT));
837 }
838 WndOwner = (SB_CTL == SBType) ? GetParent(Wnd) : Wnd;
839 WndCtl = (SB_CTL == SBType) ? Wnd : NULL;
840
841 switch (Msg)
842 {
843 case WM_LBUTTONDOWN: /* Initialise mouse tracking */
844 HideCaret(Wnd); /* hide caret while holding down LBUTTON */
845 ScrollTrackVertical = Vertical;
846 ScrollTrackHitTest = HitTest = IntScrollHitTest(&ScrollBarInfo, Vertical, Pt, FALSE );
847 LastClickPos = Vertical ? (Pt.y - ScrollBarInfo.rcScrollBar.top)
848 : (Pt.x - ScrollBarInfo.rcScrollBar.left);
849 LastMousePos = LastClickPos;
850 TrackThumbPos = ScrollBarInfo.xyThumbTop;
851 PrevPt = Pt;
852 if (SBType == SB_CTL && (GetWindowLongPtrW(Wnd, GWL_STYLE) & WS_TABSTOP)) SetFocus(Wnd);
853 SetCapture(Wnd);
854 /* Don't update scrollbar if disabled. */
856 {
857 IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, TRUE);
858 }
859 break;
860
861 case WM_MOUSEMOVE:
862 HitTest = IntScrollHitTest(&ScrollBarInfo, Vertical, Pt, TRUE);
863 PrevPt = Pt;
864 break;
865
866 case WM_LBUTTONUP:
867 HitTest = SCROLL_NOWHERE;
869 /* if scrollbar has focus, show back caret */
870 if (Wnd == GetFocus()) ShowCaret(Wnd);
871 /* Don't update scrollbar if disabled. */
873 {
874 IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, FALSE);
875 IntDrawScrollInterior(Wnd,Dc,SBType,Vertical,&ScrollBarInfo);
876 }
877 break;
878
879 case WM_SYSTIMER:
880 Pt = PrevPt;
881 HitTest = IntScrollHitTest(&ScrollBarInfo, Vertical, Pt, FALSE);
882 break;
883
884 default:
885 return; /* Should never happen */
886 }
887
888 TRACE("Event: hwnd=%p bar=%d msg=%s pt=%d,%d hit=%d\n",
889 Wnd, SBType, SPY_GetMsgName(Msg,Wnd), Pt.x, Pt.y, HitTest );
890
891 switch (ScrollTrackHitTest)
892 {
893 case SCROLL_NOWHERE: /* No tracking in progress */
894 break;
895
896 case SCROLL_TOP_ARROW:
897 if (HitTest == ScrollTrackHitTest)
898 {
899 if ((WM_LBUTTONDOWN == Msg) || (WM_SYSTIMER == Msg))
900 {
901 SendMessageW(WndOwner, Vertical ? WM_VSCROLL : WM_HSCROLL,
902 SB_LINEUP, (LPARAM) WndCtl);
903 }
906 (TIMERPROC) NULL);
908 {
909 if (!(ScrollBarInfo.rgstate[ScrollTrackHitTest] &= STATE_SYSTEM_PRESSED))
910 {
911 IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, TRUE);
912 }
913 }
914 }
915 else
916 {
917 IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, FALSE);
919 }
920 break;
921
922 case SCROLL_TOP_RECT:
923 if (HitTest == ScrollTrackHitTest)
924 {
925 if ((WM_LBUTTONDOWN == Msg) || (WM_SYSTIMER == Msg))
926 {
927 SendMessageW(WndOwner, Vertical ? WM_VSCROLL : WM_HSCROLL,
928 SB_PAGEUP, (LPARAM) WndCtl);
929 }
932 (TIMERPROC) NULL);
933 }
934 else
935 {
937 }
938 break;
939
940 case SCROLL_THUMB:
941 if (Msg == WM_LBUTTONDOWN)
942 {
943 ScrollTrackingWin = Wnd;
944 ScrollTrackingBar = SBType;
945 ScrollTrackingPos = TrackThumbPos + LastMousePos - LastClickPos;
946 ScrollTrackingVal = IntScrollGetThumbVal(Wnd, SBType, &ScrollBarInfo,
947 Vertical, ScrollTrackingPos);
949 NtUserSetScrollBarInfo(Wnd, IntScrollGetObjectId(SBType), &NewInfo);
950 IntScrollDrawMovingThumb(Dc, &ScrollBarInfo, Vertical);
951 }
952 else if (Msg == WM_LBUTTONUP)
953 {
956 IntDrawScrollInterior(Wnd, Dc, SBType, Vertical, &ScrollBarInfo);
957 }
958 else /* WM_MOUSEMOVE */
959 {
960 UINT Pos;
961
962 if (! IntScrollPtInRectEx(&ScrollBarInfo.rcScrollBar, Pt, Vertical))
963 {
964 Pos = LastClickPos;
965 }
966 else
967 {
968 Pt = IntScrollClipPos(&ScrollBarInfo.rcScrollBar, Pt);
969 Pos = Vertical ? (Pt.y - ScrollBarInfo.rcScrollBar.top)
970 : (Pt.x - ScrollBarInfo.rcScrollBar.left);
971 }
972 if (Pos != LastMousePos || ! ScrollMovingThumb)
973 {
974 LastMousePos = Pos;
975 ScrollTrackingPos = TrackThumbPos + Pos - LastClickPos;
976 ScrollTrackingVal = IntScrollGetThumbVal(Wnd, SBType, &ScrollBarInfo,
977 Vertical, ScrollTrackingPos);
979 NtUserSetScrollBarInfo(Wnd, IntScrollGetObjectId(SBType), &NewInfo);
980 IntScrollDrawMovingThumb(Dc, &ScrollBarInfo, Vertical);
981 SendMessageW(WndOwner, Vertical ? WM_VSCROLL : WM_HSCROLL,
983 (LPARAM) WndCtl);
984 }
985 }
986 break;
987
989 if (HitTest == ScrollTrackHitTest)
990 {
991 if ((Msg == WM_LBUTTONDOWN) || (Msg == WM_SYSTIMER))
992 {
993 SendMessageW(WndOwner, Vertical ? WM_VSCROLL : WM_HSCROLL,
994 SB_PAGEDOWN, (LPARAM) WndCtl);
995 }
998 (TIMERPROC) NULL);
999 }
1000 else
1001 {
1003 }
1004 break;
1005
1007 if (HitTest == ScrollTrackHitTest)
1008 {
1009 if ((Msg == WM_LBUTTONDOWN) || (Msg == WM_SYSTIMER))
1010 {
1011 SendMessageW(WndOwner, Vertical ? WM_VSCROLL : WM_HSCROLL,
1012 SB_LINEDOWN, (LPARAM) WndCtl);
1013 }
1016 (TIMERPROC) NULL);
1018 {
1019 if (!(ScrollBarInfo.rgstate[ScrollTrackHitTest] &= STATE_SYSTEM_PRESSED))
1020 {
1021 TRACE("Set Arrow\n");
1022 IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, TRUE);
1023 }
1024 }
1025 }
1026 else
1027 {
1028 IntUpdateScrollArrows (Wnd, Dc, &ScrollBarInfo, &NewInfo, SBType, ScrollTrackHitTest, Vertical, FALSE);
1030 }
1031 break;
1032 }
1033
1034 if (Msg == WM_LBUTTONDOWN)
1035 {
1036 if (SCROLL_THUMB == HitTest)
1037 {
1038 UINT Val = IntScrollGetThumbVal(Wnd, SBType, &ScrollBarInfo, Vertical,
1039 TrackThumbPos + LastMousePos - LastClickPos);
1040 SendMessageW(WndOwner, Vertical ? WM_VSCROLL : WM_HSCROLL,
1041 MAKEWPARAM(SB_THUMBTRACK, Val), (LPARAM) WndCtl);
1042 }
1043 }
1044
1045 if (Msg == WM_LBUTTONUP)
1046 {
1047 HitTest = ScrollTrackHitTest;
1048 ScrollTrackHitTest = SCROLL_NOWHERE; /* Terminate tracking */
1049
1050 if (SCROLL_THUMB == HitTest)
1051 {
1052 UINT Val = IntScrollGetThumbVal(Wnd, SBType, &ScrollBarInfo, Vertical,
1053 TrackThumbPos + LastMousePos - LastClickPos);
1054 SendMessageW(WndOwner, Vertical ? WM_VSCROLL : WM_HSCROLL,
1055 MAKEWPARAM(SB_THUMBPOSITION, Val), (LPARAM) WndCtl);
1056 }
1057 /* SB_ENDSCROLL doesn't report thumb position */
1058 SendMessageW(WndOwner, Vertical ? WM_VSCROLL : WM_HSCROLL,
1059 SB_ENDSCROLL, (LPARAM) WndCtl);
1060
1061 /* Terminate tracking */
1063 }
1064
1065 ReleaseDC(Wnd, Dc);
struct @1616 Msg[]
#define WM_SYSTIMER
Definition: comctl32.h:119
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL NTAPI NtUserSetScrollBarInfo(HWND hwnd, LONG idObject, SETSCROLLBARINFO *info)
Definition: scrollbar.c:1549
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HDC
Definition: imagelist.c:92
unsigned int UINT
Definition: ndis.h:50
#define WS_TABSTOP
Definition: pedump.c:634
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: ntuser.h:3739
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static DWORD ScrollTrackHitTest
Definition: scrollbar.c:61
static VOID FASTCALL IntScrollDrawMovingThumb(HDC Dc, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical)
Definition: scrollbar.c:274
static POINT IntScrollClipPos(PRECT lpRect, POINT pt)
Definition: scrollbar.c:650
#define SCROLL_THUMB
Definition: scrollbar.c:37
#define SCROLL_REPEAT_DELAY
Definition: scrollbar.c:42
#define SCROLL_NOWHERE
Definition: scrollbar.c:34
static BOOL ScrollTrackVertical
Definition: scrollbar.c:62
static UINT FASTCALL IntScrollGetThumbVal(HWND Wnd, INT SBType, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical, INT Pos)
Definition: scrollbar.c:607
UINT_PTR WINAPI SetSystemTimer(HWND, UINT_PTR, UINT, TIMERPROC)
Definition: ntwrapper.h:106
static DWORD FASTCALL IntScrollHitTest(PSCROLLBARINFO ScrollBarInfo, BOOL Vertical, POINT Pt, BOOL Dragging)
Definition: scrollbar.c:438
BOOL WINAPI KillSystemTimer(HWND, UINT_PTR)
Definition: timer.c:35
static BOOL FASTCALL IntScrollPtInRectEx(LPRECT Rect, POINT Pt, BOOL Vertical)
Definition: scrollbar.c:410
static VOID FASTCALL IntUpdateScrollArrows(HWND Wnd, HDC hDC, PSCROLLBARINFO ScrollBarInfo, SETSCROLLBARINFO *info, INT SBType, INT Arrow, BOOL Vertical, BOOL Pressed)
Definition: scrollbar.c:321
static INT ScrollTrackingVal
Definition: scrollbar.c:59
#define SCROLL_TIMER
Definition: scrollbar.c:44
#define SCROLL_FIRST_DELAY
Definition: scrollbar.c:41
const char * SPY_GetMsgName(UINT msg, HWND hWnd)
Definition: spy.c:2218
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define MAKEWPARAM(l, h)
Definition: winuser.h:3999
#define SB_THUMBTRACK
Definition: winuser.h:573
BOOL WINAPI ShowCaret(_In_opt_ HWND)
#define DCX_CACHE
Definition: winuser.h:2104
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define DCX_WINDOW
Definition: winuser.h:2103
#define WM_MOUSEMOVE
Definition: winuser.h:1765
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
HWND WINAPI SetFocus(_In_opt_ HWND)
#define CCHILDREN_SCROLLBAR
Definition: winuser.h:3735
#define WM_LBUTTONUP
Definition: winuser.h:1767
#define SB_ENDSCROLL
Definition: winuser.h:574
VOID(CALLBACK * TIMERPROC)(HWND, UINT, UINT_PTR, DWORD)
Definition: winuser.h:2887
#define SB_THUMBPOSITION
Definition: winuser.h:572

Referenced by ScrollBarWndProc_common(), and ScrollTrackScrollBar().

◆ IntScrollHitTest()

static DWORD FASTCALL IntScrollHitTest ( PSCROLLBARINFO  ScrollBarInfo,
BOOL  Vertical,
POINT  Pt,
BOOL  Dragging 
)
static

Definition at line 438 of file scrollbar.c.

440{
441 INT ArrowSize, ThumbSize, ThumbPos;
442
443 if ((Dragging && ! IntScrollPtInRectEx(&ScrollBarInfo->rcScrollBar, Pt, Vertical)) ||
444 ! PtInRect(&ScrollBarInfo->rcScrollBar, Pt)) return SCROLL_NOWHERE;
445
446 ThumbPos = ScrollBarInfo->xyThumbTop;
447 ThumbSize = ScrollBarInfo->xyThumbBottom - ThumbPos;
448 ArrowSize = ScrollBarInfo->dxyLineButton;
449
450 if (Vertical)
451 {
452 if (Pt.y < ScrollBarInfo->rcScrollBar.top + ArrowSize) return SCROLL_TOP_ARROW;
453 if (Pt.y >= ScrollBarInfo->rcScrollBar.bottom - ArrowSize) return SCROLL_BOTTOM_ARROW;
454 if (!ThumbPos) return SCROLL_TOP_RECT;
455 Pt.y -= ScrollBarInfo->rcScrollBar.top;
456 if (Pt.y < ThumbPos) return SCROLL_TOP_RECT;
457 if (Pt.y >= ThumbPos + ThumbSize) return SCROLL_BOTTOM_RECT;
458 }
459 else
460 {
461 if (Pt.x < ScrollBarInfo->rcScrollBar.left + ArrowSize) return SCROLL_TOP_ARROW;
462 if (Pt.x >= ScrollBarInfo->rcScrollBar.right - ArrowSize) return SCROLL_BOTTOM_ARROW;
463 if (!ThumbPos) return SCROLL_TOP_RECT;
464 Pt.x -= ScrollBarInfo->rcScrollBar.left;
465 if (Pt.x < ThumbPos) return SCROLL_TOP_RECT;
466 if (Pt.x >= ThumbPos + ThumbSize) return SCROLL_BOTTOM_RECT;
467 }
468
469 return SCROLL_THUMB;
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by IntScrollHandleScrollEvent().

◆ IntScrollPtInRectEx()

static BOOL FASTCALL IntScrollPtInRectEx ( LPRECT  Rect,
POINT  Pt,
BOOL  Vertical 
)
static

Definition at line 410 of file scrollbar.c.

412{
413 RECT TempRect = *Rect;
414 int scrollbarWidth;
415
416 /* Pad hit rect to allow mouse to be dragged outside of scrollbar and
417 * still be considered in the scrollbar. */
418 if (Vertical)
419 {
420 scrollbarWidth = Rect->right - Rect->left;
421 TempRect.left -= scrollbarWidth*8;
422 TempRect.right += scrollbarWidth*8;
423 TempRect.top -= scrollbarWidth*2;
424 TempRect.bottom += scrollbarWidth*2;
425 }
426 else
427 {
428 scrollbarWidth = Rect->bottom - Rect->top;
429 TempRect.left -= scrollbarWidth*2;
430 TempRect.right += scrollbarWidth*2;
431 TempRect.top -= scrollbarWidth*8;
432 TempRect.bottom += scrollbarWidth*8;
433 }
434
435 return PtInRect(&TempRect, Pt);

Referenced by IntScrollHandleScrollEvent(), and IntScrollHitTest().

◆ IntSetScrollInfo()

static DWORD FASTCALL IntSetScrollInfo ( HWND  Wnd,
LPCSCROLLINFO  Info,
BOOL  bRedraw 
)
static

Definition at line 1204 of file scrollbar.c.

1206{
1207 DWORD Ret = NtUserSetScrollInfo(Wnd, SB_CTL, Info, bRedraw);
1208 if (Ret) IntNotifyWinEvent(EVENT_OBJECT_VALUECHANGE, Wnd, OBJID_CLIENT, CHILDID_SELF, WEF_SETBYWNDPTI);
1209 return Ret;
#define WEF_SETBYWNDPTI
Definition: ntuser.h:235
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
#define CHILDID_SELF
Definition: winable.h:14

Referenced by ScrollBarWndProc_common().

◆ IntUpdateScrollArrows()

static VOID FASTCALL IntUpdateScrollArrows ( HWND  Wnd,
HDC  hDC,
PSCROLLBARINFO  ScrollBarInfo,
SETSCROLLBARINFO info,
INT  SBType,
INT  Arrow,
BOOL  Vertical,
BOOL  Pressed 
)
static

Definition at line 321 of file scrollbar.c.

325{
326 if (Pressed)
327 {
328 ScrollBarInfo->rgstate[Arrow] |= STATE_SYSTEM_PRESSED;
329 }
330 else
331 {
332 ScrollBarInfo->rgstate[Arrow] &= ~STATE_SYSTEM_PRESSED;
333 }
334 /* Update arrow state */
335 info->rgstate[Arrow] = ScrollBarInfo->rgstate[Arrow];
337
338 IntDrawScrollArrows(hDC, ScrollBarInfo, Vertical);

Referenced by IntScrollHandleScrollEvent().

◆ KillSystemTimer()

BOOL WINAPI KillSystemTimer ( HWND  hWnd,
UINT_PTR  IDEvent 
)

Definition at line 35 of file timer.c.

36{
37 return NtUserxKillSystemTimer(hWnd, IDEvent);
38}
EXTINLINE BOOL NtUserxKillSystemTimer(HWND hWnd, UINT_PTR IDEvent)
Definition: ntwrapper.h:711

Referenced by IntScrollHandleScrollEvent().

◆ RealGetScrollInfo()

BOOL WINAPI RealGetScrollInfo ( HWND  Wnd,
INT  SBType,
LPSCROLLINFO  Info 
)

Definition at line 1512 of file scrollbar.c.

1514{
1515 PWND pWnd;
1516 PSBDATA pSBData;
1517
1518 if (SB_CTL == SBType)
1519 {
1520 return SendMessageW(Wnd, SBM_GETSCROLLINFO, 0, (LPARAM) Info);
1521 }
1522
1523 pWnd = ValidateHwnd(Wnd);
1524 if (!pWnd) return FALSE;
1525
1526 if (SBType < SB_HORZ || SBType > SB_VERT)
1527 {
1529 return FALSE;
1530 }
1531 if (!pWnd->pSBInfo)
1532 {
1534 return FALSE;
1535 }
1536 pSBData = IntGetSBData(pWnd, SBType);
1537 return NtUserSBGetParms(Wnd, SBType, pSBData, Info);
BOOL NTAPI NtUserSBGetParms(HWND hwnd, int fnBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
Definition: scrollbar.c:1324

Referenced by GetScrollInfo(), and ResetUserApiHook().

◆ RealSetScrollInfo()

INT WINAPI RealSetScrollInfo ( HWND  Wnd,
int  SBType,
LPCSCROLLINFO  Info,
BOOL  bRedraw 
)

Definition at line 1665 of file scrollbar.c.

1667{
1668 if (SB_CTL == SBType)
1669 {
1670 return SendMessageW(Wnd, SBM_SETSCROLLINFO, (WPARAM) bRedraw, (LPARAM) Info);
1671 }
1672 else
1673 {
1674 return NtUserSetScrollInfo(Wnd, SBType, Info, bRedraw);
1675 }

Referenced by ResetUserApiHook(), and SetScrollInfo().

◆ SCROLL_RefreshScrollBar()

static void SCROLL_RefreshScrollBar ( HWND  hwnd,
INT  nBar,
BOOL  arrows,
BOOL  interior 
)
static

Definition at line 690 of file scrollbar.c.

693{
694 HDC hdc = GetDCEx( hwnd, 0,
695 DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
696 if (!hdc) return;
697
698 IntDrawScrollBar( hwnd, hdc, nBar);//, arrows, interior );
699 ReleaseDC( hwnd, hdc );
HDC hdc
Definition: main.c:9
void IntDrawScrollBar(HWND Wnd, HDC DC, INT Bar)
Definition: scrollbar.c:341

Referenced by EnableScrollBar().

◆ ScrollBarWndProc_common()

LRESULT WINAPI ScrollBarWndProc_common ( WNDPROC  DefWindowProc,
HWND  Wnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)

Definition at line 1216 of file scrollbar.c.

1218{
1219#ifdef __REACTOS__ // Do this now, remove after Server side is fixed.
1220 PWND pWnd;
1221 PSBWND pSBWnd;
1222 SCROLLINFO ScrollInfo;
1223
1224 pWnd = ValidateHwnd(Wnd);
1225 if (pWnd)
1226 {
1227 if (!pWnd->fnid)
1228 {
1229 TRACE("ScrollBar CTL size %d\n", (sizeof(SBWND)-sizeof(WND)));
1230 if ( pWnd->cbwndExtra < (sizeof(SBWND)-sizeof(WND)) )
1231 {
1232 ERR("Wrong Extra bytes for Scrollbar!\n");
1233 return 0;
1234 }
1235
1236 if (Msg != WM_CREATE)
1237 {
1238 return DefWindowProc(Wnd, Msg, wParam, lParam);
1239 }
1241 }
1242 else
1243 {
1244 if (pWnd->fnid != FNID_SCROLLBAR)
1245 {
1246 ERR("Wrong window class for Scrollbar!\n");
1247 return 0;
1248 }
1249 }
1250 }
1251#endif
1252
1253 if (! IsWindow(Wnd))
1254 {
1255 return 0;
1256 }
1257
1258 // Must be a scroll bar control!
1259 pSBWnd = (PSBWND)pWnd;
1260
1261 switch (Msg)
1262 {
1263 case WM_CREATE:
1265 break;
1266
1267 case WM_ENABLE:
1268 {
1270 }
1271
1272 case WM_LBUTTONDBLCLK:
1273 case WM_LBUTTONDOWN:
1275 {
1279 }
1280 else
1281 {
1282 POINT Pt;
1283 Pt.x = (short)LOWORD(lParam);
1284 Pt.y = (short)HIWORD(lParam);
1285 ScrollTrackScrollBar(Wnd, SB_CTL, Pt);
1286 }
1287 break;
1288
1289 case WM_LBUTTONUP:
1290 case WM_MOUSEMOVE:
1291 case WM_SYSTIMER:
1292 {
1293 POINT Pt;
1294 Pt.x = (short)LOWORD(lParam);
1295 Pt.y = (short)HIWORD(lParam);
1297 }
1298 break;
1299
1300 case WM_KEYDOWN:
1302 break;
1303
1304 case WM_KEYUP:
1305 ShowCaret(Wnd);
1306 break;
1307
1308 case WM_SETFOCUS:
1309 {
1310 /* Create a caret when a ScrollBar get focus */
1311 RECT Rect;
1312 int ArrowSize, ThumbSize, ThumbPos, Vertical;
1313
1314 Vertical = IntScrollGetScrollBarRect(Wnd, SB_CTL, &Rect,
1315 &ArrowSize, &ThumbSize, &ThumbPos);
1316 if (! Vertical)
1317 {
1318 CreateCaret(Wnd, (HBITMAP) 1, ThumbSize - 2, Rect.bottom - Rect.top - 2);
1319 SetCaretPos(ThumbPos + 1, Rect.top + 1);
1320 }
1321 else
1322 {
1323 CreateCaret(Wnd, (HBITMAP) 1, Rect.right - Rect.left - 2, ThumbSize - 2);
1324 SetCaretPos(Rect.top + 1, ThumbPos + 1);
1325 }
1326 ShowCaret(Wnd);
1327 }
1328 break;
1329
1330 case WM_KILLFOCUS:
1331 {
1332 RECT Rect;
1333 int ArrowSize, ThumbSize, ThumbPos, Vertical;
1334
1335 Vertical = IntScrollGetScrollBarRect(Wnd, SB_CTL, &Rect,
1336 &ArrowSize, &ThumbSize, &ThumbPos);
1337 if (! Vertical)
1338 {
1339 Rect.left = ThumbPos + 1;
1340 Rect.right = Rect.left + ThumbSize;
1341 }
1342 else
1343 {
1344 Rect.top = ThumbPos + 1;
1345 Rect.bottom = Rect.top + ThumbSize;
1346 }
1347 HideCaret(Wnd);
1348 InvalidateRect(Wnd, &Rect, FALSE);
1349 DestroyCaret();
1350 }
1351 break;
1352
1353 case WM_ERASEBKGND:
1354 return 1;
1355
1356 case WM_GETDLGCODE:
1357 return DLGC_WANTARROWS; /* Windows returns this value */
1358
1359 case WM_PAINT:
1360 {
1361 PAINTSTRUCT Ps;
1362 HDC Dc;
1363
1364 Dc = (0 != wParam ? (HDC) wParam : BeginPaint(Wnd, &Ps));
1365
1367 {
1368 IntScrollDrawSizeGrip(Wnd, Dc);
1369 }
1370 else if (0 != (GetWindowLongPtrW(Wnd, GWL_STYLE) & SBS_SIZEBOX))
1371 {
1372 RECT Rect;
1373 GetClientRect(Wnd, &Rect);
1375 }
1376 else
1377 {
1378 IntDrawScrollBar(Wnd, Dc, SB_CTL/*, TRUE, TRUE*/);
1379 }
1380
1381 if (0 == wParam)
1382 {
1383 EndPaint(Wnd, &Ps);
1384 }
1385 }
1386 break;
1387
1388 case SBM_GETPOS:
1389 return pSBWnd->SBCalc.pos;
1390
1391 case SBM_GETRANGE:
1392 *(LPINT)wParam = pSBWnd->SBCalc.posMin;
1393 *(LPINT)lParam = pSBWnd->SBCalc.posMax;
1394 // This message does not return a value.
1395 return 0;
1396
1397 case SBM_ENABLE_ARROWS:
1398 return EnableScrollBar( Wnd, SB_CTL, wParam );
1399
1400 case SBM_SETPOS:
1401 {
1402 ScrollInfo.cbSize = sizeof(SCROLLINFO);
1403 ScrollInfo.fMask = SIF_POS|SIF_PREVIOUSPOS;
1404 ScrollInfo.nPos = wParam;
1405 return IntSetScrollInfo(Wnd, &ScrollInfo, lParam);
1406 }
1407
1408 case SBM_SETRANGEREDRAW:
1409 case SBM_SETRANGE:
1410 {
1411 ScrollInfo.cbSize = sizeof(SCROLLINFO);
1412 ScrollInfo.fMask = SIF_RANGE|SIF_PREVIOUSPOS;
1413 ScrollInfo.nMin = wParam;
1414 ScrollInfo.nMax = lParam;
1415 return IntSetScrollInfo(Wnd, &ScrollInfo, Msg == SBM_SETRANGEREDRAW ? TRUE : FALSE);
1416 }
1417
1418 case SBM_SETSCROLLINFO:
1420
1421 case SBM_GETSCROLLINFO:
1422 {
1423 PSBDATA pSBData = (PSBDATA)&pSBWnd->SBCalc;
1424 DWORD ret = NtUserSBGetParms(Wnd, SB_CTL, pSBData, (SCROLLINFO *) lParam);
1425 if (!ret)
1426 {
1427 ERR("SBM_GETSCROLLINFO No ScrollInfo\n");
1428 }
1429 return ret;
1430 }
1431 case SBM_GETSCROLLBARINFO:
1432 ((PSCROLLBARINFO)lParam)->cbSize = sizeof(SCROLLBARINFO);
1434
1435 case 0x00e5:
1436 case 0x00e7:
1437 case 0x00e8:
1438 case 0x00ec:
1439 case 0x00ed:
1440 case 0x00ee:
1441 case 0x00ef:
1442 WARN("unknown Win32 msg %04x wp=%08lx lp=%08lx\n",
1443 Msg, wParam, lParam );
1444 break;
1445
1446 default:
1447 if (WM_USER <= Msg)
1448 {
1449 WARN("unknown msg %04x wp=%04lx lp=%08lx\n", Msg, wParam, lParam);
1450 }
1451 if (unicode)
1452 return DefWindowProcW( Wnd, Msg, wParam, lParam );
1453 else
1454 return DefWindowProcA( Wnd, Msg, wParam, lParam );
1455 }
1456
1457 return 0;
#define WARN(fmt,...)
Definition: debug.h:112
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4340
static HBITMAP
Definition: button.c:44
#define LOWORD(l)
Definition: pedump.c:82
#define DefWindowProc
Definition: ros2win.h:31
DWORD fnid
Definition: ntuser.h:704
INT posMin
Definition: ntuser.h:515
INT posMax
Definition: ntuser.h:516
INT pos
Definition: ntuser.h:518
#define HIWORD(l)
Definition: typedefs.h:247
#define SIF_PREVIOUSPOS
Definition: undocuser.h:89
static void FASTCALL IntScrollHandleKbdEvent(HWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:708
static VOID FASTCALL IntScrollHandleScrollEvent(HWND Wnd, INT SBType, UINT Msg, POINT Pt)
Definition: scrollbar.c:763
static void IntScrollCreateScrollBar(HWND Wnd, LPCREATESTRUCTW lpCreate)
Definition: scrollbar.c:1073
static DWORD FASTCALL IntSetScrollInfo(HWND Wnd, LPCSCROLLINFO Info, BOOL bRedraw)
Definition: scrollbar.c:1204
VOID FASTCALL ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt)
Definition: scrollbar.c:1155
static BOOL FASTCALL IntScrollGetScrollBarRect(HWND Wnd, INT Bar, RECT *Rect, INT *ArrowSize, INT *ThumbSize, INT *ThumbPos)
Definition: scrollbar.c:484
static void FASTCALL IntScrollDrawSizeGrip(HWND Wnd, HDC Dc)
Definition: scrollbar.c:673
BOOL WINAPI DECLSPEC_HOTPATCH EnableScrollBar(HWND hwnd, UINT nBar, UINT flags)
Definition: scrollbar.c:1480
int ret
int * LPINT
Definition: windef.h:178
#define WM_PAINT
Definition: winuser.h:1610
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define SBM_SETRANGE
Definition: winuser.h:2071
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define WM_KEYUP
Definition: winuser.h:1706
#define WMSZ_BOTTOMRIGHT
Definition: winuser.h:2461
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WMSZ_BOTTOMLEFT
Definition: winuser.h:2460
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1598
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1768
#define SBM_ENABLE_ARROWS
Definition: winuser.h:2067
#define WM_SETFOCUS
Definition: winuser.h:1603
#define SC_SIZE
Definition: winuser.h:2574
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DLGC_WANTARROWS
Definition: winuser.h:2600
#define SBM_SETRANGEREDRAW
Definition: winuser.h:2072
#define WM_USER
Definition: winuser.h:1885
#define WM_KEYDOWN
Definition: winuser.h:1705
BOOL WINAPI CreateCaret(_In_ HWND, _In_opt_ HBITMAP, _In_ int, _In_ int)
BOOL WINAPI DestroyCaret(void)
Definition: caret.c:35
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define ESB_ENABLE_BOTH
Definition: winuser.h:563
#define WM_KILLFOCUS
Definition: winuser.h:1604
#define SBM_SETPOS
Definition: winuser.h:2070
struct tagSCROLLBARINFO * PSCROLLBARINFO
#define WM_GETDLGCODE
Definition: winuser.h:1679
#define GWL_EXSTYLE
Definition: winuser.h:845

Referenced by ScrollBarWndProcA(), and ScrollBarWndProcW().

◆ ScrollBarWndProcA()

LRESULT WINAPI ScrollBarWndProcA ( HWND  Wnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1466 of file scrollbar.c.

1468{
LRESULT WINAPI ScrollBarWndProc_common(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: scrollbar.c:1216

Referenced by RegisterClientPFN().

◆ ScrollBarWndProcW()

LRESULT WINAPI ScrollBarWndProcW ( HWND  Wnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1460 of file scrollbar.c.

Referenced by RegisterClientPFN().

◆ ScrollTrackScrollBar()

VOID FASTCALL ScrollTrackScrollBar ( HWND  Wnd,
INT  SBType,
POINT  Pt 
)

Definition at line 1155 of file scrollbar.c.

1157{
1158 MSG Msg;
1159 UINT XOffset = 0, YOffset = 0;
1160
1161 if (SBType != SB_CTL)
1162 { // Used with CMD mouse tracking.
1163 PWND pwnd = ValidateHwnd(Wnd);
1164 if (!pwnd) return;
1165 XOffset = pwnd->rcClient.left - pwnd->rcWindow.left;
1166 YOffset = pwnd->rcClient.top - pwnd->rcWindow.top;
1167// RECT rect;
1168// WIN_GetRectangles( Wnd, COORDS_CLIENT, &rect, NULL );
1169 ScreenToClient(Wnd, &Pt);
1170// Pt.x -= rect.left;
1171// Pt.y -= rect.top;
1172 Pt.x += XOffset;
1173 Pt.y += YOffset;
1174 }
1175
1177
1178 do
1179 {
1180 if (!GetMessageW(&Msg, 0, 0, 0)) break;
1181 if (CallMsgFilterW(&Msg, MSGF_SCROLLBAR)) continue;
1182 if ( Msg.message == WM_LBUTTONUP ||
1183 Msg.message == WM_MOUSEMOVE ||
1184 (Msg.message == WM_SYSTIMER && Msg.wParam == SCROLL_TIMER))
1185 {
1186 Pt.x = LOWORD(Msg.lParam) + XOffset;
1187 Pt.y = HIWORD(Msg.lParam) + YOffset;
1188 IntScrollHandleScrollEvent(Wnd, SBType, Msg.message, Pt);
1189 }
1190 else
1191 {
1194 }
1195 if (!IsWindow(Wnd))
1196 {
1198 break;
1199 }
1200 } while (Msg.message != WM_LBUTTONUP && GetCapture() == Wnd);
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define MSGF_SCROLLBAR
Definition: winuser.h:1168
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI CallMsgFilterW(_In_ LPMSG, _In_ INT)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by DefWndTrackScrollBar(), and ScrollBarWndProc_common().

◆ SetScrollInfo()

INT WINAPI DECLSPEC_HOTPATCH SetScrollInfo ( HWND  Wnd,
int  SBType,
LPCSCROLLINFO  Info,
BOOL  bRedraw 
)

Definition at line 1683 of file scrollbar.c.

1685{
1686 BOOL Hook;
1687 INT Ret = 0;
1688
1690
1691 Hook = BeginIfHookedUserApiHook();
1692
1693 /* Bypass SEH and go direct. */
1694 if (!Hook) return RealSetScrollInfo(Wnd, SBType, Info, bRedraw);
1695
1696 _SEH2_TRY
1697 {
1698 Ret = guah.SetScrollInfo(Wnd, SBType, Info, bRedraw);
1699 }
1701 {
1702 ERR("Got exception in hooked SetScrollInfo!\n");
1703 }
1704 _SEH2_END;
1705
1707
1708 return Ret;
1709
SETSCROLLINFO SetScrollInfo
Definition: undocuser.h:343
INT WINAPI RealSetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw)
Definition: scrollbar.c:1665

Referenced by SetScrollPos(), and SetScrollRange().

◆ SetScrollPos()

INT WINAPI DECLSPEC_HOTPATCH SetScrollPos ( HWND  hWnd,
INT  nBar,
INT  nPos,
BOOL  bRedraw 
)

Definition at line 1717 of file scrollbar.c.

1719{
1720 SCROLLINFO ScrollInfo;
1721
1722 ScrollInfo.cbSize = sizeof(SCROLLINFO);
1723 ScrollInfo.fMask = SIF_POS|SIF_PREVIOUSPOS;
1724 ScrollInfo.nPos = nPos;
1725
1726 return SetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw);
INT WINAPI DECLSPEC_HOTPATCH SetScrollInfo(HWND Wnd, int SBType, LPCSCROLLINFO Info, BOOL bRedraw)
Definition: scrollbar.c:1683

◆ SetScrollRange()

BOOL WINAPI DECLSPEC_HOTPATCH SetScrollRange ( HWND  hWnd,
INT  nBar,
INT  nMinPos,
INT  nMaxPos,
BOOL  bRedraw 
)

Definition at line 1734 of file scrollbar.c.

1736{
1737 PWND pWnd;
1738 SCROLLINFO ScrollInfo;
1739
1740 pWnd = ValidateHwnd(hWnd);
1741 if ( !pWnd ) return FALSE;
1742
1743 if (((LONGLONG)nMaxPos - nMinPos) > MAXLONG)
1744 {
1746 return FALSE;
1747 }
1748
1749 ScrollInfo.cbSize = sizeof(SCROLLINFO);
1750 ScrollInfo.fMask = SIF_RANGE;
1751 ScrollInfo.nMin = nMinPos;
1752 ScrollInfo.nMax = nMaxPos;
1753 SetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); // do not bypass themes.
1754 return TRUE;
int64_t LONGLONG
Definition: typedefs.h:68
#define MAXLONG
Definition: umtypes.h:116
#define ERROR_INVALID_SCROLLBAR_RANGE
Definition: winerror.h:929

◆ SetSystemTimer()

UINT_PTR WINAPI SetSystemTimer ( HWND  hWnd,
UINT_PTR  IDEvent,
UINT  Period,
TIMERPROC  TimerFunc 
)

Definition at line 106 of file ntwrapper.h.

107{
108 return NtUserSetSystemTimer(hWnd, IDEvent, Period, TimerFunc);
109}
UINT_PTR NTAPI NtUserSetSystemTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc)
Definition: timer.c:679
_In_ LARGE_INTEGER _In_ ULONG Period
Definition: kefuncs.h:1327

Referenced by IntScrollHandleScrollEvent().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( scrollbar  )

Variable Documentation

◆ SCROLL_builtin_class

const struct builtin_class_descr SCROLL_builtin_class
Initial value:
=
{
L"ScrollBar",
sizeof(SBWND)-sizeof(WND),
0
}
struct _SBWND SBWND
#define L(x)
Definition: ntvdm.h:50
LRESULT WINAPI ScrollBarWndProcW(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1460
LRESULT WINAPI ScrollBarWndProcA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1466
#define CS_VREDRAW
Definition: winuser.h:653
#define CS_HREDRAW
Definition: winuser.h:648
#define IDC_ARROW
Definition: winuser.h:682
#define CS_DBLCLKS
Definition: winuser.h:646
#define CS_PARENTDC
Definition: winuser.h:651

Definition at line 75 of file scrollbar.c.

◆ ScrollMovingThumb

BOOL ScrollMovingThumb = FALSE
static

Definition at line 65 of file scrollbar.c.

Referenced by IntScrollDrawMovingThumb(), and IntScrollHandleScrollEvent().

◆ ScrollTrackHitTest

DWORD ScrollTrackHitTest = SCROLL_NOWHERE
static

Definition at line 61 of file scrollbar.c.

Referenced by IntScrollHandleScrollEvent().

◆ ScrollTrackingBar

INT ScrollTrackingBar = 0
static

Definition at line 57 of file scrollbar.c.

Referenced by IntScrollDrawMovingThumb(), and IntScrollHandleScrollEvent().

◆ ScrollTrackingPos

INT ScrollTrackingPos = 0
static

Definition at line 58 of file scrollbar.c.

Referenced by IntScrollDrawMovingThumb(), and IntScrollHandleScrollEvent().

◆ ScrollTrackingVal

INT ScrollTrackingVal = 0
static

Definition at line 59 of file scrollbar.c.

Referenced by IntScrollHandleScrollEvent().

◆ ScrollTrackingWin

HWND ScrollTrackingWin = 0
static

Definition at line 56 of file scrollbar.c.

Referenced by IntScrollDrawMovingThumb(), and IntScrollHandleScrollEvent().

◆ ScrollTrackVertical

BOOL ScrollTrackVertical
static

Definition at line 62 of file scrollbar.c.

Referenced by IntScrollHandleScrollEvent().