ReactOS 0.4.16-dev-1506-g117cd33
scrollbar.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS kernel
3 * LICENSE: See COPYING in the top level directory
4 * PURPOSE: Scrollbars
5 * COPYRIGHT: Thomas Weidenmueller (w3seek@users.sourceforge.net)
6 * Jason Filby (jasonfilby@yahoo.com)
7 */
8
9#include <win32k.h>
10DBG_DEFAULT_CHANNEL(UserScrollbar);
11
12/* Definitions for scrollbar hit testing [See SCROLLBARINFO in MSDN] */
13#define SCROLL_NOWHERE 0x00 /* Outside the scrollbar */
14#define SCROLL_TOP_ARROW 0x01 /* Top or left arrow */
15#define SCROLL_TOP_RECT 0x02 /* Rectangle between the top arrow and the thumb */
16#define SCROLL_THUMB 0x03 /* Thumb rectangle */
17#define SCROLL_BOTTOM_RECT 0x04 /* Rectangle between the thumb and the bottom arrow */
18#define SCROLL_BOTTOM_ARROW 0x05 /* Bottom or right arrow */
19
20#define SCROLL_FIRST_DELAY 200 /* Delay (in ms) before first repetition when holding the button down */
21#define SCROLL_REPEAT_DELAY 50 /* Delay (in ms) between scroll repetitions */
22
23#define SCROLL_TIMER 0 /* Scroll timer id */
24
25/* Minimum size of the rectangle between the arrows */
26#define SCROLL_MIN_RECT 4
27
28/* Minimum size of the thumb in pixels */
29#define SCROLL_MIN_THUMB 6
30
31/* Overlap between arrows and thumb */
32#define SCROLL_ARROW_THUMB_OVERLAP 0
33
34#define MINTRACKTHUMB 8 /* Minimum size of the rectangle between the arrows */
35
36/* What to do after SetScrollInfo() */
37#define SA_SSI_HIDE 0x0001
38#define SA_SSI_SHOW 0x0002
39#define SA_SSI_REFRESH 0x0004
40#define SA_SSI_REPAINT_ARROWS 0x0008
41
42#define SBRG_SCROLLBAR 0 /* The scrollbar itself */
43#define SBRG_TOPRIGHTBTN 1 /* The top or right button */
44#define SBRG_PAGEUPRIGHT 2 /* The page up or page right region */
45#define SBRG_SCROLLBOX 3 /* The scroll box */
46#define SBRG_PAGEDOWNLEFT 4 /* The page down or page left region */
47#define SBRG_BOTTOMLEFTBTN 5 /* The bottom or left button */
48
49#define CHANGERGSTATE(item, status) \
50 if(Info->rgstate[(item)] != (status)) \
51 Chg = TRUE; \
52 Info->rgstate[(item)] = (status);
53
54/* FUNCTIONS *****************************************************************/
55
58
59static void
61
62/* Ported from WINE20020904 */
63/* Compute the scrollbar rectangle, in drawing coordinates (i.e. client coords for SB_CTL, window coords for SB_VERT and
64 * SB_HORZ). 'arrowSize' returns the width or height of an arrow (depending on * the orientation of the scrollbar),
65 * 'thumbSize' returns the size of the thumb, and 'thumbPos' returns the position of the thumb relative to the left or to
66 * the top. Return TRUE if the scrollbar is vertical, FALSE if horizontal.
67 */
68static inline void mirror_rect(const RECT *window_rect, RECT *rect)
69{
70 int width = window_rect->right - window_rect->left;
71 int tmp = rect->left;
72 rect->left = width - rect->right;
73 rect->right = width - tmp;
74}
75
78{
79 PSBWND pSBWnd;
80 PSBINFO pSBInfo;
81
82 pSBInfo = pwnd->pSBInfo;
83 switch (Bar)
84 {
85 case SB_HORZ:
86 return &pSBInfo->Horz;
87 case SB_VERT:
88 return &pSBInfo->Vert;
89 case SB_CTL:
90 if (pwnd->cbwndExtra < (sizeof(SBWND)-sizeof(WND)))
91 {
92 ERR("IntGetSBData Wrong Extra bytes for CTL Scrollbar\n");
93 return 0;
94 }
95 pSBWnd = (PSBWND)pwnd;
96 return (PSBDATA)&pSBWnd->SBCalc;
97 default:
98 ERR("IntGetSBData Bad Bar\n");
99 }
100 return NULL;
101}
102
105{
106 BOOL vertical;
107 *lprect = Wnd->rcClient;
108
109 RECTL_vOffsetRect(lprect, -Wnd->rcWindow.left, -Wnd->rcWindow.top);
110 if (Wnd->ExStyle & WS_EX_LAYOUTRTL)
111 mirror_rect(&Wnd->rcWindow, lprect);
112
113 switch (nBar)
114 {
115 case SB_HORZ:
116 lprect->top = lprect->bottom;
118 if (Wnd->style & WS_BORDER)
119 {
120 lprect->left--;
121 lprect->right++;
122 }
123 else if (Wnd->style & WS_VSCROLL)
124 {
125 lprect->right++;
126 }
127 vertical = FALSE;
128 break;
129
130 case SB_VERT:
132 {
133 lprect->right = lprect->left;
135 }
136 else
137 {
138 lprect->left = lprect->right;
140 }
141 if (Wnd->style & WS_BORDER)
142 {
143 lprect->top--;
144 lprect->bottom++;
145 }
146 else if (Wnd->style & WS_HSCROLL)
147 {
148 lprect->bottom++;
149 }
150 vertical = TRUE;
151 break;
152
153 case SB_CTL:
154 IntGetClientRect(Wnd, lprect);
155 vertical = !!(Wnd->style & SBS_VERT);
156 break;
157
158 default:
159 return FALSE;
160 }
161
162 return vertical;
163}
164
166IntCalculateThumb(PWND Wnd, LONG idObject, PSCROLLBARINFO psbi, PSBDATA pSBData)
167{
168 INT Thumb, ThumbBox, ThumbPos, cxy, mx;
169 RECTL ClientRect;
170
171 switch(idObject)
172 {
173 case SB_HORZ:
175 cxy = psbi->rcScrollBar.right - psbi->rcScrollBar.left;
176 break;
177 case SB_VERT:
179 cxy = psbi->rcScrollBar.bottom - psbi->rcScrollBar.top;
180 break;
181 case SB_CTL:
182 IntGetClientRect(Wnd, &ClientRect);
183 if(Wnd->style & SBS_VERT)
184 {
186 cxy = ClientRect.bottom - ClientRect.top;
187 }
188 else
189 {
191 cxy = ClientRect.right - ClientRect.left;
192 }
193 break;
194 default:
195 return FALSE;
196 }
197
198 ThumbPos = Thumb;
199 // Calculate Thumb
200 if(cxy <= (2 * Thumb))
201 {
202 Thumb = cxy / 2;
203 psbi->xyThumbTop = 0;
204 psbi->xyThumbBottom = 0;
205 ThumbPos = Thumb;
206 }
209 pSBData->posMin >= (int)(pSBData->posMax - max(pSBData->page - 1, 0)))
210 {
211 // Nothing to scroll
212 psbi->xyThumbTop = 0;
213 psbi->xyThumbBottom = 0;
214 }
215 else
216 {
217 ThumbBox = pSBData->page ? MINTRACKTHUMB : UserGetSystemMetrics(SM_CXHTHUMB);
218 cxy -= (2 * Thumb);
219 if(cxy >= ThumbBox)
220 {
221 if(pSBData->page)
222 ThumbBox = max(EngMulDiv(cxy, pSBData->page, pSBData->posMax - pSBData->posMin + 1), ThumbBox);
223
224 if(cxy > ThumbBox)
225 {
226 mx = pSBData->posMax - max(pSBData->page - 1, 0);
227 if(pSBData->posMin < mx)
228 ThumbPos = Thumb + EngMulDiv(cxy - ThumbBox, pSBData->pos - pSBData->posMin, mx - pSBData->posMin);
229 else
230 ThumbPos = Thumb + ThumbBox;
231 }
232
233 psbi->xyThumbTop = ThumbPos;
234 psbi->xyThumbBottom = ThumbPos + ThumbBox;
235 }
236 else
237 {
238 psbi->xyThumbTop = 0;
239 psbi->xyThumbBottom = 0;
240 }
241 }
242 psbi->dxyLineButton = Thumb;
243
244 return TRUE;
245}
246/*
247static VOID FASTCALL
248IntUpdateSBInfo(PWND Window, int wBar)
249{
250 PSCROLLBARINFO sbi;
251 PSBDATA pSBData;
252
253 ASSERT(Window);
254 ASSERT(Window->pSBInfo);
255 ASSERT(Window->pSBInfoex);
256
257 sbi = IntGetScrollbarInfoFromWindow(Window, wBar);
258 pSBData = IntGetSBData(Window, wBar);
259 IntGetScrollBarRect(Window, wBar, &(sbi->rcScrollBar));
260 IntCalculateThumb(Window, wBar, sbi, pSBData);
261}
262*/
263static BOOL FASTCALL
265{
266 UINT Mask;
267 LPSCROLLINFO psi;
268
270
271 lpsi->fMask &= ~SIF_THEMED; // Remove Theme bit
272 if(!SBID_IS_VALID(nBar))
273 {
275 ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", nBar);
276 return FALSE;
277 }
278
279 if (!Window->pSBInfo)
280 {
281 ERR("IntGetScrollInfo No window scrollbar info\n");
282 return FALSE;
283 }
284
286
287 if (lpsi->fMask == SIF_ALL)
289 else
290 Mask = lpsi->fMask;
291
292 if (0 != (Mask & SIF_PAGE))
293 lpsi->nPage = psi->nPage;
294
295 if (0 != (Mask & SIF_POS))
296 lpsi->nPos = psi->nPos;
297
298 if (0 != (Mask & SIF_RANGE))
299 {
300 lpsi->nMin = psi->nMin;
301 lpsi->nMax = psi->nMax;
302 }
303
304 if (0 != (Mask & SIF_TRACKPOS))
305 lpsi->nTrackPos = psi->nTrackPos;
306
307 return TRUE;
308}
309
312 PWND pWnd,
313 INT nBar,
314 PSBDATA pSBData,
315 LPSCROLLINFO lpsi)
316{
317 UINT Mask;
318 PSBTRACK pSBTrack = pWnd->head.pti->pSBTrack;
319
320 lpsi->fMask &= ~SIF_THEMED; // Remove Theme bit
321 if (!SBID_IS_VALID(nBar))
322 {
324 ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", nBar);
325 return FALSE;
326 }
327
328 if (!pWnd->pSBInfo || !pSBTrack) return FALSE;
329
330 Mask = lpsi->fMask;
331
332 if (0 != (Mask & SIF_PAGE))
333 lpsi->nPage = pSBData->page;
334
335 if (0 != (Mask & SIF_POS))
336 lpsi->nPos = pSBData->pos;
337
338 if (0 != (Mask & SIF_RANGE))
339 {
340 lpsi->nMin = pSBData->posMin;
341 lpsi->nMax = pSBData->posMax;
342 }
343
344 if (0 != (Mask & SIF_TRACKPOS))
345 {
346 if (pSBTrack && pSBTrack->nBar == nBar && pSBTrack->spwndTrack == pWnd)
347 lpsi->nTrackPos = pSBTrack->posNew;
348 else
349 lpsi->nTrackPos = pSBData->pos;
350 }
351 return (Mask & SIF_ALL) !=0;
352}
353
354/*************************************************************************
355 * SCROLL_GetScrollBarInfo
356 *
357 * Internal helper for the API function
358 *
359 * PARAMS
360 * hwnd [I] Handle of window with scrollbar(s)
361 * idObject [I] One of OBJID_CLIENT, OBJID_HSCROLL, or OBJID_VSCROLL
362 * info [IO] cbSize specifies the size of the structure
363 *
364 * RETURNS
365 * FALSE if failed
366 */
367#if 0
368static BOOL SCROLL_GetScrollBarInfo(HWND hwnd, LONG idObject, LPSCROLLBARINFO info)
369{
370 LPSCROLLBAR_INFO infoPtr;
371 INT nBar;
372 INT nDummy;
374 BOOL pressed;
375 RECT rect;
376
377 switch (idObject)
378 {
379 case OBJID_CLIENT: nBar = SB_CTL; break;
380 case OBJID_HSCROLL: nBar = SB_HORZ; break;
381 case OBJID_VSCROLL: nBar = SB_VERT; break;
382 default: return FALSE;
383 }
384
385 // handle invalid data structure
386 if (info->cbSize != sizeof(*info))
387 return FALSE;
388
389 SCROLL_GetScrollBarRect(hwnd, nBar, &info->rcScrollBar, &nDummy,
390 &info->dxyLineButton, &info->xyThumbTop);
391 // rcScrollBar needs to be in screen coordinates
393 OffsetRect(&info->rcScrollBar, rect.left, rect.top);
394
395 info->xyThumbBottom = info->xyThumbTop + info->dxyLineButton;
396
397 infoPtr = SCROLL_GetInternalInfo(hwnd, nBar, TRUE);
398 if (!infoPtr)
399 return FALSE;
400
401 // Scrollbar state
402 info->rgstate[0] = 0;
403 if ((nBar == SB_HORZ && !(style & WS_HSCROLL))
404 || (nBar == SB_VERT && !(style & WS_VSCROLL)))
405 info->rgstate[0] |= STATE_SYSTEM_INVISIBLE;
406 if (infoPtr->minVal >= infoPtr->maxVal - max(infoPtr->page - 1, 0))
407 {
408 if (!(info->rgstate[0] & STATE_SYSTEM_INVISIBLE))
409 info->rgstate[0] |= STATE_SYSTEM_UNAVAILABLE;
410 else
411 info->rgstate[0] |= STATE_SYSTEM_OFFSCREEN;
412 }
413 if (nBar == SB_CTL && !IsWindowEnabled(hwnd))
414 info->rgstate[0] |= STATE_SYSTEM_UNAVAILABLE;
415
416 pressed = ((nBar == SB_VERT) == SCROLL_trackVertical && GetCapture() == hwnd);
417
418 // Top/left arrow button state. MSDN says top/right, but I don't believe it
419 info->rgstate[1] = 0;
420 if (pressed && SCROLL_trackHitTest == SCROLL_TOP_ARROW)
421 info->rgstate[1] |= STATE_SYSTEM_PRESSED;
422 if (infoPtr->flags & ESB_DISABLE_LTUP)
423 info->rgstate[1] |= STATE_SYSTEM_UNAVAILABLE;
424
425 // Page up/left region state. MSDN says up/right, but I don't believe it
426 info->rgstate[2] = 0;
427 if (infoPtr->curVal == infoPtr->minVal)
428 info->rgstate[2] |= STATE_SYSTEM_INVISIBLE;
429 if (pressed && SCROLL_trackHitTest == SCROLL_TOP_RECT)
430 info->rgstate[2] |= STATE_SYSTEM_PRESSED;
431
432 // Thumb state
433 info->rgstate[3] = 0;
434 if (pressed && SCROLL_trackHitTest == SCROLL_THUMB)
435 info->rgstate[3] |= STATE_SYSTEM_PRESSED;
436
437 // Page down/right region state. MSDN says down/left, but I don't believe it
438 info->rgstate[4] = 0;
439 if (infoPtr->curVal >= infoPtr->maxVal - 1)
440 info->rgstate[4] |= STATE_SYSTEM_INVISIBLE;
441 if (pressed && SCROLL_trackHitTest == SCROLL_BOTTOM_RECT)
442 info->rgstate[4] |= STATE_SYSTEM_PRESSED;
443
444 // Bottom/right arrow button state. MSDN says bottom/left, but I don't believe it
445 info->rgstate[5] = 0;
446 if (pressed && SCROLL_trackHitTest == SCROLL_BOTTOM_ARROW)
447 info->rgstate[5] |= STATE_SYSTEM_PRESSED;
448 if (infoPtr->flags & ESB_DISABLE_RTDN)
449 info->rgstate[5] |= STATE_SYSTEM_UNAVAILABLE;
450
451 return TRUE;
452}
453#endif
454static DWORD FASTCALL
456{
457 // Update the scrollbar state and set action flags according to
458 // what has to be done graphics wise.
459
461 PSCROLLBARINFO psbi;
462 UINT new_flags;
463 INT action = 0;
464 PSBDATA pSBData;
465 DWORD OldPos = 0;
466 BOOL bChangeParams = FALSE; // Don't show/hide scrollbar if params don't change
467 UINT MaxPage;
468 int MaxPos;
469 BOOL bVisible;
470
472
473 if(!SBID_IS_VALID(nBar))
474 {
476 ERR("Trying to set scrollinfo for unknown scrollbar type %d\n", nBar);
477 return FALSE;
478 }
479
481 return FALSE;
482
483 if (lpsi->cbSize != sizeof(SCROLLINFO) &&
484 lpsi->cbSize != (sizeof(SCROLLINFO) - sizeof(lpsi->nTrackPos)))
485 {
487 return 0;
488 }
490 {
492 return 0;
493 }
494
497 pSBData = IntGetSBData(Window, nBar);
498 if (pSBData == NULL)
499 {
500 ERR("co_IntSetScrollInfo: No SBDATA for window %p, bar %d\n", UserHMGetHandle(Window), nBar);
501 return FALSE;
502 }
503
504 if (lpsi->fMask & SIF_THEMED && !(Info->fMask & SIF_THEMED))
505 Info->fMask |= SIF_THEMED;
506
507 // Set the page size
508 if (lpsi->fMask & SIF_PAGE)
509 {
510 if (Info->nPage != lpsi->nPage)
511 {
512 Info->nPage = lpsi->nPage;
513 pSBData->page = lpsi->nPage;
514 bChangeParams = TRUE;
515 }
516 }
517
518 // Set the scroll pos
519 if (lpsi->fMask & SIF_POS)
520 {
521 OldPos = Info->nPos;
522 if (Info->nPos != lpsi->nPos)
523 {
524 Info->nPos = lpsi->nPos;
525 pSBData->pos = lpsi->nPos;
526 }
527 }
528
529 // Set the scroll range
530 if (lpsi->fMask & SIF_RANGE)
531 {
532 if (lpsi->nMin > lpsi->nMax)
533 {
534 Info->nMin = lpsi->nMin;
535 Info->nMax = lpsi->nMin;
536 pSBData->posMin = lpsi->nMin;
537 pSBData->posMax = lpsi->nMin;
538 bChangeParams = TRUE;
539 }
540 else if (Info->nMin != lpsi->nMin || Info->nMax != lpsi->nMax)
541 {
542 Info->nMin = lpsi->nMin;
543 Info->nMax = lpsi->nMax;
544 pSBData->posMin = lpsi->nMin;
545 pSBData->posMax = lpsi->nMax;
546 bChangeParams = TRUE;
547 }
548 }
549
550 // Make sure the page size is valid
551 MaxPage = abs(Info->nMax - Info->nMin) + 1;
552 if (Info->nPage > MaxPage)
553 pSBData->page = Info->nPage = MaxPage;
554
555 // Make sure the pos is inside the range
556 MaxPos = Info->nMax + 1 - (int)max(Info->nPage, 1);
557 ASSERT(MaxPos >= Info->nMin);
558 if (Info->nPos < Info->nMin)
559 pSBData->pos = Info->nPos = Info->nMin;
560 else if (Info->nPos > MaxPos)
561 pSBData->pos = Info->nPos = MaxPos;
562
563 // Don't change the scrollbar state if SetScrollInfo is just called with SIF_DISABLENOSCROLL
564 if (!(lpsi->fMask & SIF_ALL))
565 return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos;
566
567 // Check if the scrollbar should be hidden or disabled
569 {
570 new_flags = Window->pSBInfo->WSBflags;
571 if (Info->nMin + (int)max(Info->nPage, 1) > Info->nMax)
572 {
573 // Hide or disable scrollbar
574 if (lpsi->fMask & SIF_DISABLENOSCROLL)
575 {
576 new_flags = ESB_DISABLE_BOTH;
577 bChangeParams = TRUE;
578 }
579 else if ((nBar != SB_CTL) && bChangeParams)
580 {
582 }
583 }
584 else if ((lpsi->fMask & ~SIF_THEMED) != SIF_PAGE)
585 { // Show and enable scrollbar only if no page only changed
586 if ((nBar != SB_CTL) && bChangeParams)
587 {
588 new_flags = ESB_ENABLE_BOTH;
590 }
591 else if (nBar == SB_CTL)
592 {
593 new_flags = ESB_ENABLE_BOTH;
594 }
595 }
596
597 if (Window->pSBInfo->WSBflags != new_flags) // Check arrow flags
598 {
599 Window->pSBInfo->WSBflags = new_flags;
601 }
602 }
603
604 if (action & SA_SSI_HIDE)
605 {
607 }
608 else
609 {
610 if (action & SA_SSI_SHOW)
612 return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos; // SetWindowPos() already did the painting
613
614 switch (nBar)
615 {
616 case SB_HORZ:
617 bVisible = (Window->style & WS_HSCROLL);
618 break;
619 case SB_VERT:
620 bVisible = (Window->style & WS_VSCROLL);
621 break;
622 case SB_CTL:
623 bVisible = (Window->style & WS_VISIBLE);
624 break;
625 default:
626 bVisible = FALSE;
627 break;
628 }
629
630 if (bRedraw && bVisible)
631 {
632 if (!(Info->fMask & SIF_THEMED)) // Not Using Themes
633 {
635 {
636 // Redraw the entire bar
638 UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
639 UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
640 UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
641 UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
643 }
644 else
645 {
646 // Redraw only the interior part of the bar
647 IntRefeshScrollInterior(Window, nBar, psbi);
648 }
649 }
650 else // Using Themes
651 {
653 UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left;
654 UpdateRect.right -= Window->rcClient.left - Window->rcWindow.left;
655 UpdateRect.top -= Window->rcClient.top - Window->rcWindow.top;
656 UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top;
657 if (bChangeParams || (OldPos != pSBData->pos))
659 }
660 }
661 }
662
663 if (bChangeParams && (nBar == SB_HORZ || nBar == SB_VERT) && (lpsi->fMask & SIF_DISABLENOSCROLL))
664 IntEnableScrollBar(nBar == SB_HORZ, psbi, Window->pSBInfo->WSBflags);
665
666 // Return current position
667 return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos;
668}
669
672{
673 INT Bar;
674 PSCROLLBARINFO sbi;
675 PSBDATA pSBData;
677
678 Bar = SBOBJ_TO_SBID(idObject);
679
680 if(!SBID_IS_VALID(Bar))
681 {
683 ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", Bar);
684 return FALSE;
685 }
686
688 {
689 ERR("Failed to create scrollbars for window\n");
690 return FALSE;
691 }
692
694 pSBData = IntGetSBData(Window, Bar);
695 if (pSBData == NULL)
696 {
697 ERR("co_IntGetScrollBarInfo: No scrollbar info for window %p, bar %d\n", UserHMGetHandle(Window), Bar);
698 return FALSE;
699 }
700
702 IntCalculateThumb(Window, Bar, sbi, pSBData);
703
704 // Scrollbar state
705 psbi->rgstate[0] = 0;
706 if ((Bar == SB_HORZ && !(Window->style & WS_HSCROLL))
707 || (Bar == SB_VERT && !(Window->style & WS_VSCROLL)))
709 if (pSBData->posMin >= pSBData->posMax - max(pSBData->page - 1, 0))
710 {
711 if (!(psbi->rgstate[0] & STATE_SYSTEM_INVISIBLE))
713 else
715 }
716 if (Bar == SB_CTL && !(Window->style & WS_DISABLED))
718
719 RtlCopyMemory(psbi, sbi, sizeof(SCROLLBARINFO));
720
721 return TRUE;
722}
723
726{
727 INT Bar;
728 PSCROLLBARINFO sbi;
729 LPSCROLLINFO psi;
731
732 Bar = SBOBJ_TO_SBID(idObject);
733
734 if(!SBID_IS_VALID(Bar))
735 {
737 ERR("Trying to get scrollinfo for unknown scrollbar type %d\n", Bar);
738 return FALSE;
739 }
740
742 {
743 ERR("Failed to create scrollbars for window\n");
744 return FALSE;
745 }
746
749
750 psi->nTrackPos = psbi->nTrackPos;
751 sbi->reserved = psbi->reserved;
752 RtlCopyMemory(&sbi->rgstate, &psbi->rgstate, sizeof(psbi->rgstate));
753
754 return TRUE;
755}
756
759{
760 PSCROLLBARINFO psbi;
761 PSBDATA pSBData;
762 ULONG Size, s;
763 INT i;
764
766
767 if (Window->pSBInfo && Window->pSBInfoex)
768 return TRUE; // No need to create it anymore
769
770 // Allocate memory for all scrollbars (HORZ, VERT, CONTROL)
771 Size = 3 * (sizeof(SBINFOEX));
773 {
774 ERR("Unable to allocate memory for scrollbar information for window %p\n", UserHMGetHandle(Window));
775 return FALSE;
776 }
777
778 RtlZeroMemory(Window->pSBInfoex, Size);
779
780 if(!(Window->pSBInfo = DesktopHeapAlloc(Window->head.rpdesk, sizeof(SBINFO))))
781 {
782 ERR("Unable to allocate memory for scrollbar information for window %p\n", UserHMGetHandle(Window));
783 return FALSE;
784 }
785
786 RtlZeroMemory(Window->pSBInfo, sizeof(SBINFO));
787 Window->pSBInfo->Vert.posMax = 100;
788 Window->pSBInfo->Horz.posMax = 100;
789
790 co_WinPosGetNonClientSize(Window, &Window->rcWindow, &Window->rcClient);
791
792 for(s = SB_HORZ; s <= SB_VERT; s++)
793 {
795 psbi->cbSize = sizeof(SCROLLBARINFO);
796 for (i = 0; i < CCHILDREN_SCROLLBAR + 1; i++)
797 psbi->rgstate[i] = 0;
798
799 pSBData = IntGetSBData(Window, s);
800 ASSERT(pSBData != NULL);
801
803 IntCalculateThumb(Window, s, psbi, pSBData);
804 }
805
806 return TRUE;
807}
808
811{
812 if (Window->pSBInfo && Window->pSBInfoex)
813 {
814 DesktopHeapFree(Window->head.rpdesk, Window->pSBInfo);
815 Window->pSBInfo = NULL;
817 Window->pSBInfoex = NULL;
818 return TRUE;
819 }
820 return FALSE;
821}
822
825{
826 BOOL Chg = FALSE;
827 switch(wArrows)
828 {
829 case ESB_DISABLE_BOTH:
832 break;
833 case ESB_DISABLE_RTDN:
834 if(Horz)
835 {
837 }
838 else
839 {
841 }
842 break;
843 case ESB_DISABLE_LTUP:
844 if(Horz)
845 {
847 }
848 else
849 {
851 }
852 break;
853 case ESB_ENABLE_BOTH:
856 break;
857 }
858 return Chg;
859}
860
861/* Ported from WINE20020904 (SCROLL_ShowScrollBar) */
863co_UserShowScrollBar(PWND Wnd, int nBar, BOOL fShowH, BOOL fShowV)
864{
865 ULONG old_style, set_bits = 0, clear_bits = 0;
866
867 ASSERT_REFS_CO(Wnd);
868
869 switch(nBar)
870 {
871 case SB_CTL:
872 {
873 //IntUpdateSBInfo(Wnd, SB_CTL); // Is this needed? Was tested w/o!
874 co_WinPosShowWindow(Wnd, fShowH ? SW_SHOW : SW_HIDE);
875 return TRUE;
876 }
877 case SB_BOTH:
878 case SB_HORZ:
879 if (fShowH) set_bits |= WS_HSCROLL;
880 else clear_bits |= WS_HSCROLL;
881 if( nBar == SB_HORZ ) break;
882 // Fall through
883 case SB_VERT:
884 if (fShowV) set_bits |= WS_VSCROLL;
885 else clear_bits |= WS_VSCROLL;
886 break;
887 default:
889 return FALSE; // Nothing to do
890 }
891
892 old_style = IntSetStyle(Wnd, set_bits, clear_bits);
893 if ((old_style & clear_bits) != 0 || (old_style & set_bits) != set_bits)
894 {
896 //if (Wnd->style & WS_HSCROLL) IntUpdateSBInfo(Wnd, SB_HORZ);
897 //if (Wnd->style & WS_VSCROLL) IntUpdateSBInfo(Wnd, SB_VERT);
898
899 // Frame has been changed, let the window redraw itself
900 co_WinPosSetWindowPos(Wnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
902 return TRUE;
903 }
904 return FALSE; // no frame changes
905}
906
907static void
908IntDrawScrollInterior(PWND pWnd, HDC hDC, INT nBar, BOOL Vertical, PSCROLLBARINFO ScrollBarInfo)
909{
910 INT ThumbSize = ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop;
911 INT ThumbTop = ScrollBarInfo->xyThumbTop;
912 RECT Rect;
913 HBRUSH hSaveBrush, hBrush;
914 BOOL TopSelected = FALSE, BottomSelected = FALSE;
915
916 if (ScrollBarInfo->rgstate[SCROLL_TOP_RECT] & STATE_SYSTEM_PRESSED)
917 TopSelected = TRUE;
918 if (ScrollBarInfo->rgstate[SCROLL_BOTTOM_RECT] & STATE_SYSTEM_PRESSED)
919 BottomSelected = TRUE;
920
921 // Only scrollbar controls send WM_CTLCOLORSCROLLBAR.
922 // The window-owned scrollbars need to call DefWndControlColor
923 // to correctly setup default scrollbar colors
924 if (nBar == SB_CTL)
925 {
927 if (!hBrush)
929 }
930 else
931 {
933 }
934
935 hSaveBrush = NtGdiSelectBrush(hDC, hBrush);
936
937 // Calculate the scroll rectangle
938 if (Vertical)
939 {
940 Rect.top = ScrollBarInfo->rcScrollBar.top + ScrollBarInfo->dxyLineButton;
941 Rect.bottom = ScrollBarInfo->rcScrollBar.bottom - ScrollBarInfo->dxyLineButton;
942 Rect.left = ScrollBarInfo->rcScrollBar.left;
943 Rect.right = ScrollBarInfo->rcScrollBar.right;
944 }
945 else
946 {
947 Rect.top = ScrollBarInfo->rcScrollBar.top;
948 Rect.bottom = ScrollBarInfo->rcScrollBar.bottom;
949 Rect.left = ScrollBarInfo->rcScrollBar.left + ScrollBarInfo->dxyLineButton;
950 Rect.right = ScrollBarInfo->rcScrollBar.right - ScrollBarInfo->dxyLineButton;
951 }
952
953 // Draw scroll rectangles and thumb
954 if (!ScrollBarInfo->xyThumbBottom)
955 {
956 NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right - Rect.left,
957 Rect.bottom - Rect.top, PATCOPY);
958
959 // Cleanup and return
960 NtGdiSelectBrush(hDC, hSaveBrush);
961 return;
962 }
963
964 ThumbTop -= ScrollBarInfo->dxyLineButton;
965
966 if (ScrollBarInfo->dxyLineButton)
967 {
968 if (Vertical)
969 {
970 if (ThumbSize)
971 {
972 NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right - Rect.left,
973 ThumbTop, TopSelected ? BLACKNESS : PATCOPY);
974 Rect.top += ThumbTop;
975 NtGdiPatBlt(hDC, Rect.left, Rect.top + ThumbSize, Rect.right - Rect.left,
976 Rect.bottom - Rect.top - ThumbSize, BottomSelected ? BLACKNESS : PATCOPY);
977 Rect.bottom = Rect.top + ThumbSize;
978 }
979 else
980 {
981 if (ThumbTop)
982 {
983 NtGdiPatBlt(hDC, Rect.left, ScrollBarInfo->dxyLineButton,
984 Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY);
985 }
986 }
987 }
988 else
989 {
990 if (ThumbSize)
991 {
992 NtGdiPatBlt(hDC, Rect.left, Rect.top, ThumbTop,
993 Rect.bottom - Rect.top, TopSelected ? BLACKNESS : PATCOPY);
994 Rect.left += ThumbTop;
995 NtGdiPatBlt(hDC, Rect.left + ThumbSize, Rect.top,
996 Rect.right - Rect.left - ThumbSize, Rect.bottom - Rect.top,
997 BottomSelected ? BLACKNESS : PATCOPY);
998 Rect.right = Rect.left + ThumbSize;
999 }
1000 else
1001 {
1002 if (ThumbTop)
1003 {
1004 NtGdiPatBlt(hDC, ScrollBarInfo->dxyLineButton, Rect.top,
1005 Rect.right - Rect.left, Rect.bottom - Rect.top, PATCOPY);
1006 }
1007 }
1008 }
1009 }
1010
1011 // Draw thumb
1012 if (ThumbSize)
1014
1015 // Cleanup
1016 NtGdiSelectBrush(hDC, hSaveBrush);
1017}
1018
1019static VOID FASTCALL
1021{
1022 RECT RectLT, RectRB;
1023 INT ScrollDirFlagLT, ScrollDirFlagRB;
1024
1025 RectLT = RectRB = ScrollBarInfo->rcScrollBar;
1026 if (Vertical)
1027 {
1028 ScrollDirFlagLT = DFCS_SCROLLUP;
1029 ScrollDirFlagRB = DFCS_SCROLLDOWN;
1030 RectLT.bottom = RectLT.top + ScrollBarInfo->dxyLineButton;
1031 RectRB.top = RectRB.bottom - ScrollBarInfo->dxyLineButton;
1032 }
1033 else
1034 {
1035 ScrollDirFlagLT = DFCS_SCROLLLEFT;
1036 ScrollDirFlagRB = DFCS_SCROLLRIGHT;
1037 RectLT.right = RectLT.left + ScrollBarInfo->dxyLineButton;
1038 RectRB.left = RectRB.right - ScrollBarInfo->dxyLineButton;
1039 }
1040
1041 if (ScrollBarInfo->rgstate[SCROLL_TOP_ARROW] & STATE_SYSTEM_PRESSED)
1042 ScrollDirFlagLT |= DFCS_PUSHED | DFCS_FLAT;
1043
1045 ScrollDirFlagLT |= DFCS_INACTIVE;
1046
1047 if (ScrollBarInfo->rgstate[SCROLL_BOTTOM_ARROW] & STATE_SYSTEM_PRESSED)
1048 ScrollDirFlagRB |= DFCS_PUSHED | DFCS_FLAT;
1049
1051 ScrollDirFlagRB |= DFCS_INACTIVE;
1052
1053 DrawFrameControl(hDC, &RectLT, DFC_SCROLL, ScrollDirFlagLT);
1054 DrawFrameControl(hDC, &RectRB, DFC_SCROLL, ScrollDirFlagRB);
1055}
1056
1057static LONG FASTCALL
1059{
1060 if (SBType == SB_VERT)
1061 return OBJID_VSCROLL;
1062 if (SBType == SB_HORZ)
1063 return OBJID_HSCROLL;
1064 return OBJID_CLIENT;
1065}
1066
1067static void
1069{
1070 HDC hdc;
1071 BOOL Vertical = ((nBar == SB_CTL) ? ((pWnd->style & SBS_VERT) != 0) : (nBar == SB_VERT));
1072
1073 hdc = UserGetDCEx(pWnd, NULL, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
1074 if (hdc)
1075 {
1077 IntDrawScrollInterior(pWnd, hdc, nBar, Vertical, psbi);
1078 UserReleaseDC(pWnd, hdc, FALSE);
1079 }
1080}
1081
1082void
1084{
1085 PTHREADINFO pti;
1087 BOOL Vertical;
1088
1090
1091 // Get scrollbar info
1092 switch (Bar)
1093 {
1094 case SB_HORZ:
1095 Vertical = FALSE;
1096 break;
1097
1098 case SB_VERT:
1099 Vertical = TRUE;
1100 break;
1101
1102 case SB_CTL:
1103 Vertical = (Wnd->style & SBS_VERT) != 0;
1104 break;
1105
1106 default:
1107 return;
1108 }
1109
1111 return;
1112
1113 if (RECTL_bIsEmptyRect(&Info.rcScrollBar))
1114 return;
1115
1116 // Draw arrows
1117 if (Info.dxyLineButton)
1118 IntDrawScrollArrows(DC, &Info, Vertical);
1119
1120 // Draw interior
1121 IntDrawScrollInterior(Wnd, DC, Bar, Vertical, &Info);
1122
1123 // If scrollbar has focus, reposition the caret
1124 if (Wnd == pti->MessageQueue->spwndFocus && Bar == SB_CTL)
1125 {
1126 if (Vertical)
1127 co_IntSetCaretPos(Info.rcScrollBar.top + 1, Info.dxyLineButton + 1);
1128 else
1129 co_IntSetCaretPos(Info.dxyLineButton + 1, Info.rcScrollBar.top + 1);
1130 }
1131}
1132
1135{
1136 LRESULT lResult = 0;
1137 PWND pWnd;
1138 pWnd = UserGetWindowObject(hWnd);
1139 if (!pWnd) return 0;
1140
1141 switch(Msg)
1142 {
1143 case WM_ENABLE:
1144 if (pWnd->pSBInfo)
1146 break;
1147 }
1148 return lResult;
1149}
1150
1151BOOL
1154{
1156 SCROLLBARINFO sbi;
1157 PWND Window;
1158 BOOL Ret = FALSE;
1160
1161 TRACE("Enter NtUserGetScrollBarInfo\n");
1163
1164 Status = MmCopyFromCaller(&sbi, psbi, sizeof(SCROLLBARINFO));
1165 if(!NT_SUCCESS(Status) || (sbi.cbSize != sizeof(SCROLLBARINFO)))
1166 {
1168 goto Exit; // Return FALSE
1169 }
1170
1172 goto Exit; // Return FALSE
1173
1174 UserRefObjectCo(Window, &Ref);
1175 Ret = co_IntGetScrollBarInfo(Window, idObject, &sbi);
1177
1178 Status = MmCopyToCaller(psbi, &sbi, sizeof(SCROLLBARINFO));
1179 if(!NT_SUCCESS(Status))
1180 {
1182 Ret = FALSE;
1183 }
1184
1185Exit:
1186 TRACE("Leave NtUserGetScrollBarInfo, ret=%i\n", Ret);
1187 UserLeave();
1188 return Ret;
1189}
1190
1191BOOL
1194 HWND hWnd,
1195 int fnBar,
1196 PSBDATA pSBData,
1197 LPSCROLLINFO lpsi)
1198{
1199 PWND Window;
1200 SCROLLINFO psi;
1201 BOOL Ret = FALSE;
1202 SBDATA SBDataSafe;
1204
1205 TRACE("Enter NtUserGetScrollInfo\n");
1207
1208 _SEH2_TRY
1209 {
1210 RtlCopyMemory(&psi, lpsi, sizeof(SCROLLINFO));
1211 if (pSBData)
1212 RtlCopyMemory(&SBDataSafe, pSBData, sizeof(SBDATA));
1213 }
1215 {
1216 ERR("NtUserGetScrollInfo Failed size\n");
1218 _SEH2_YIELD(goto Exit); // Return FALSE
1219 }
1220 _SEH2_END
1221
1223 {
1224 ERR("NtUserGetScrollInfo Bad window\n");
1225 goto Exit; // Return FALSE
1226 }
1227
1228 UserRefObjectCo(Window, &Ref);
1229 Ret = co_IntGetScrollInfo(Window, fnBar, &SBDataSafe, &psi);
1231
1232 _SEH2_TRY
1233 {
1234 RtlCopyMemory(lpsi, &psi, sizeof(SCROLLINFO));
1235 }
1237 {
1238 ERR("NtUserGetScrollInfo Failed copy to user\n");
1240 Ret = FALSE;
1241 _SEH2_YIELD(goto Exit);
1242 }
1243 _SEH2_END
1244
1245Exit:
1246 TRACE("Leave NtUserGetScrollInfo, ret=%i\n", Ret);
1247 UserLeave();
1248 return Ret;
1249}
1250
1251BOOL
1254 HWND hWnd,
1255 UINT wSBflags,
1256 UINT wArrows)
1257{
1258 UINT OrigArrows;
1259 PWND Window = NULL;
1260 PSCROLLBARINFO InfoV = NULL, InfoH = NULL;
1261 BOOL Chg = FALSE;
1262 BOOL Ret = FALSE;
1264
1265 TRACE("Enter NtUserEnableScrollBar\n");
1267
1269 goto Cleanup; // Return FALSE
1270
1271 UserRefObjectCo(Window, &Ref);
1272
1274 goto Cleanup; // Return FALSE
1275
1276 OrigArrows = Window->pSBInfo->WSBflags;
1277 Window->pSBInfo->WSBflags = wArrows;
1278
1279 if (wSBflags == SB_CTL)
1280 {
1281 if ((wArrows == ESB_DISABLE_BOTH || wArrows == ESB_ENABLE_BOTH))
1282 IntEnableWindow(hWnd, (wArrows == ESB_ENABLE_BOTH));
1283
1284 Ret = TRUE;
1285 goto Cleanup;
1286 }
1287
1288 if(wSBflags != SB_BOTH && !SBID_IS_VALID(wSBflags))
1289 {
1291 ERR("Trying to set scrollinfo for unknown scrollbar type %u\n", wSBflags);
1292 goto Cleanup; // Return FALSE
1293 }
1294
1295 switch(wSBflags)
1296 {
1297 case SB_BOTH:
1299 // Fall through
1300 case SB_HORZ:
1302 break;
1303 case SB_VERT:
1305 break;
1306 default:
1307 goto Cleanup; // Return FALSE
1308 }
1309
1310 if(InfoV)
1311 Chg = IntEnableScrollBar(FALSE, InfoV, wArrows);
1312
1313 if(InfoH)
1314 Chg = (IntEnableScrollBar(TRUE, InfoH, wArrows) || Chg);
1315
1316 ERR("FIXME: EnableScrollBar wSBflags %u wArrows %u Chg %d\n", wSBflags, wArrows, Chg);
1317// Done in user32:
1318// SCROLL_RefreshScrollBar(hwnd, nBar, TRUE, TRUE);
1319
1320 Ret = Chg;
1321 goto Cleanup; // FIXME
1322
1323 if (OrigArrows == wArrows)
1324 {
1325 Ret = FALSE;
1326 goto Cleanup;
1327 }
1328
1329 Ret = TRUE;
1330
1331Cleanup:
1332 if (Window)
1334
1335 TRACE("Leave NtUserEnableScrollBar, ret=%i\n", Ret);
1336 UserLeave();
1337 return Ret;
1338}
1339
1340DWORD
1343 HWND hWnd,
1344 int fnBar,
1345 LPCSCROLLINFO lpsi,
1346 BOOL bRedraw)
1347{
1348 PWND Window = NULL;
1350 SCROLLINFO ScrollInfo;
1351 DWORD Ret = 0;
1353
1354 TRACE("Enter NtUserSetScrollInfo\n");
1356
1358 goto Cleanup; // Return 0
1359
1360 UserRefObjectCo(Window, &Ref);
1361
1362 Status = MmCopyFromCaller(&ScrollInfo, lpsi, sizeof(SCROLLINFO) - sizeof(ScrollInfo.nTrackPos));
1363 if(!NT_SUCCESS(Status))
1364 {
1366 goto Cleanup; // Return 0
1367 }
1368
1369 Ret = co_IntSetScrollInfo(Window, fnBar, &ScrollInfo, bRedraw);
1370
1371Cleanup:
1372 if (Window)
1374
1375 TRACE("Leave NtUserSetScrollInfo, ret=%lu\n", Ret);
1376 UserLeave();
1377 return Ret;
1378}
1379
1382{
1383 PWND Window;
1384 DWORD ret = 0;
1386
1387 TRACE("Enter NtUserShowScrollBar\n");
1389
1391 if (Window)
1392 {
1393 UserRefObjectCo(Window, &Ref);
1394 ret = co_UserShowScrollBar(Window, nBar, (nBar == SB_VERT) ? 0 : bShow,
1395 (nBar == SB_HORZ) ? 0 : bShow);
1397 }
1398
1399 TRACE("Leave NtUserShowScrollBar, ret=%lu\n", ret);
1400 UserLeave();
1401 return ret;
1402}
1403
1404// Ugly NtUser API
1405
1406BOOL
1409 HWND hWnd,
1410 LONG idObject,
1412{
1413 PWND Window = NULL;
1414 SETSCROLLBARINFO Safeinfo;
1415 PSCROLLBARINFO sbi;
1416 LPSCROLLINFO psi;
1418 LONG Obj;
1419 BOOL Ret = FALSE;
1421
1422 TRACE("Enter NtUserSetScrollBarInfo\n");
1424
1426 goto Cleanup; // Return FALSE
1427
1428 UserRefObjectCo(Window, &Ref);
1429
1430 Obj = SBOBJ_TO_SBID(idObject);
1431 if(!SBID_IS_VALID(Obj))
1432 {
1434 ERR("Trying to set scrollinfo for unknown scrollbar type %d\n", Obj);
1435 goto Cleanup; // Return FALSE
1436 }
1437
1439 goto Cleanup; // Return FALSE
1440
1441 Status = MmCopyFromCaller(&Safeinfo, info, sizeof(SETSCROLLBARINFO));
1442 if(!NT_SUCCESS(Status))
1443 {
1445 goto Cleanup; // Return FALSE
1446 }
1447
1450
1451 psi->nTrackPos = Safeinfo.nTrackPos;
1452 sbi->reserved = Safeinfo.reserved;
1453 RtlCopyMemory(&sbi->rgstate, &Safeinfo.rgstate, sizeof(Safeinfo.rgstate));
1454
1455 Ret = TRUE;
1456
1457Cleanup:
1458 if (Window)
1460
1461 TRACE("Leave NtUserSetScrollBarInfo, ret=%i\n", Ret);
1462 UserLeave();
1463 return Ret;
1464}
1465
1466/* EOF */
static HDC hDC
Definition: 3dtext.c:33
Arabic default style
Definition: afstyles.h:94
HWND hWnd
Definition: settings.c:17
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: precomp.h:57
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1766 Msg[]
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define APIENTRY
Definition: api.h:79
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
static const WCHAR Cleanup[]
Definition: register.c:80
return ret
Definition: mutex.c:146
action
Definition: namespace.c:707
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned int Mask
Definition: fpcontrol.c:82
Status
Definition: gdiplustypes.h:25
GLdouble s
Definition: gl.h:2039
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
struct _SBWND * PSBWND
struct _SBINFOEX SBINFOEX
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
void Bar(void)
Definition: terminate.cpp:70
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
unsigned int UINT
Definition: ndis.h:50
#define FASTCALL
Definition: nt_native.h:50
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiPatBlt(_In_ HDC hdcDest, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_ DWORD dwRop)
Definition: bitblt.c:990
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:32
static void mirror_rect(const RECT *window_rect, RECT *rect)
Definition: scrollbar.c:68
#define SA_SSI_SHOW
Definition: scrollbar.c:38
static DWORD FASTCALL co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
Definition: scrollbar.c:455
static void IntRefeshScrollInterior(PWND pWnd, INT nBar, PSCROLLBARINFO psbi)
Definition: scrollbar.c:1068
#define SCROLL_THUMB
Definition: scrollbar.c:16
static BOOL FASTCALL co_IntGetScrollInfo(PWND Window, INT nBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
Definition: scrollbar.c:264
BOOL APIENTRY NtUserSetScrollBarInfo(HWND hWnd, LONG idObject, SETSCROLLBARINFO *info)
Definition: scrollbar.c:1408
BOOL APIENTRY NtUserEnableScrollBar(HWND hWnd, UINT wSBflags, UINT wArrows)
Definition: scrollbar.c:1253
BOOL FASTCALL NEWco_IntGetScrollInfo(PWND pWnd, INT nBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
Definition: scrollbar.c:311
BOOL APIENTRY NtUserSBGetParms(HWND hWnd, int fnBar, PSBDATA pSBData, LPSCROLLINFO lpsi)
Definition: scrollbar.c:1193
#define SBRG_BOTTOMLEFTBTN
Definition: scrollbar.c:47
static VOID FASTCALL IntDrawScrollArrows(HDC hDC, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical)
Definition: scrollbar.c:1020
PSBDATA FASTCALL IntGetSBData(PWND pwnd, INT Bar)
Definition: scrollbar.c:77
BOOL FASTCALL IntCalculateThumb(PWND Wnd, LONG idObject, PSCROLLBARINFO psbi, PSBDATA pSBData)
Definition: scrollbar.c:166
BOOL APIENTRY NtUserGetScrollBarInfo(HWND hWnd, LONG idObject, PSCROLLBARINFO psbi)
Definition: scrollbar.c:1153
#define MINTRACKTHUMB
Definition: scrollbar.c:34
BOOL FASTCALL co_IntGetScrollBarInfo(PWND Window, LONG idObject, PSCROLLBARINFO psbi)
Definition: scrollbar.c:671
DWORD APIENTRY NtUserShowScrollBar(HWND hWnd, int nBar, DWORD bShow)
Definition: scrollbar.c:1381
#define CHANGERGSTATE(item, status)
Definition: scrollbar.c:49
BOOL FASTCALL co_IntCreateScrollBars(PWND Window)
Definition: scrollbar.c:758
BOOL FASTCALL IntDestroyScrollBars(PWND Window)
Definition: scrollbar.c:810
#define SCROLL_BOTTOM_RECT
Definition: scrollbar.c:17
#define SA_SSI_REPAINT_ARROWS
Definition: scrollbar.c:40
static void IntDrawScrollInterior(PWND pWnd, HDC hDC, INT nBar, BOOL Vertical, PSCROLLBARINFO ScrollBarInfo)
Definition: scrollbar.c:908
BOOL FASTCALL co_IntSetScrollBarInfo(PWND Window, LONG idObject, PSETSCROLLBARINFO psbi)
Definition: scrollbar.c:725
static LONG FASTCALL IntScrollGetObjectId(INT SBType)
Definition: scrollbar.c:1058
#define SCROLL_BOTTOM_ARROW
Definition: scrollbar.c:18
LRESULT APIENTRY ScrollBarWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1134
#define SBRG_TOPRIGHTBTN
Definition: scrollbar.c:43
#define SCROLL_TOP_RECT
Definition: scrollbar.c:15
BOOL APIENTRY IntEnableScrollBar(BOOL Horz, PSCROLLBARINFO Info, UINT wArrows)
Definition: scrollbar.c:824
#define SA_SSI_HIDE
Definition: scrollbar.c:37
void IntDrawScrollBar(PWND Wnd, HDC DC, INT Bar)
Definition: scrollbar.c:1083
DWORD FASTCALL co_UserShowScrollBar(PWND Wnd, int nBar, BOOL fShowH, BOOL fShowV)
Definition: scrollbar.c:863
DWORD APIENTRY NtUserSetScrollInfo(HWND hWnd, int fnBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
Definition: scrollbar.c:1342
BOOL FASTCALL IntGetScrollBarRect(PWND Wnd, INT nBar, RECTL *lprect)
Definition: scrollbar.c:104
#define SCROLL_TOP_ARROW
Definition: scrollbar.c:14
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1792
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2387
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2594
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:258
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:242
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:249
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:43
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define WS_BORDER
Definition: pedump.c:625
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
long LONG
Definition: pedump.c:60
#define WS_DISABLED
Definition: pedump.c:621
#define WS_HSCROLL
Definition: pedump.c:628
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
#define SBID_IS_VALID(id)
Definition: scroll.h:40
#define IntGetScrollInfoFromWindow(Window, i)
Definition: scroll.h:36
#define IntGetScrollbarInfoFromWindow(Window, i)
Definition: scroll.h:33
#define SBOBJ_TO_SBID(Obj)
Definition: scroll.h:39
static void Exit(void)
Definition: sock.c:1330
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
Definition: polytest.cpp:41
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: window.c:28
Definition: ntuser.h:772
SBCALC SBCalc
Definition: ntuser.h:776
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: ntuser.h:3649
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
Definition: object.h:4
Definition: ntuser.h:694
DWORD ExStyle
Definition: ntuser.h:704
THRDESKHEAD head
Definition: ntuser.h:695
DWORD style
Definition: ntuser.h:706
PSBINFO pSBInfo
Definition: ntuser.h:726
RECT rcClient
Definition: ntuser.h:717
RECT rcWindow
Definition: ntuser.h:716
ULONG cbwndExtra
Definition: ntuser.h:738
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
INT posMax
Definition: ntuser.h:506
INT posMin
Definition: ntuser.h:505
INT page
Definition: ntuser.h:507
INT pos
Definition: ntuser.h:508
SBDATA Vert
Definition: ntuser.h:515
INT WSBflags
Definition: ntuser.h:513
SBDATA Horz
Definition: ntuser.h:514
INT nBar
Definition: scroll.h:22
INT posNew
Definition: scroll.h:21
PWND spwndTrack
Definition: scroll.h:11
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3856
#define max(a, b)
Definition: svc.c:63
static int UpdateRect(TreeListData *pData, unsigned uItem, unsigned uSub)
Definition: treelist.c:1529
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define SIF_PREVIOUSPOS
Definition: undocuser.h:90
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:895
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:14
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
BOOL FASTCALL co_IntSetCaretPos(int X, int Y)
Definition: caret.c:193
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:204
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:197
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:215
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:210
HBRUSH FASTCALL GetControlBrush(PWND pwnd, HDC hdc, UINT ctlType)
Definition: misc.c:180
#define TAG_SBARINFO
Definition: tags.h:9
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:145
BOOL FASTCALL IntEnableWindow(HWND hWnd, BOOL bEnable)
Definition: window.c:222
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
#define OBJID_VSCROLL
Definition: winable.h:20
#define OBJID_HSCROLL
Definition: winable.h:21
#define OBJID_CLIENT
Definition: winable.h:19
ENGAPI INT APIENTRY EngMulDiv(_In_ INT a, _In_ INT b, _In_ INT c)
Definition: math.c:26
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define BLACKNESS
Definition: wingdi.h:323
#define PATCOPY
Definition: wingdi.h:335
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define STATE_SYSTEM_PRESSED
Definition: winuser.h:2967
#define SW_HIDE
Definition: winuser.h:779
#define CTLCOLOR_SCROLLBAR
Definition: winuser.h:967
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define DFC_SCROLL
Definition: winuser.h:475
#define WM_ENABLE
Definition: winuser.h:1643
#define SWP_FRAMECHANGED
Definition: winuser.h:1251
#define DCX_CACHE
Definition: winuser.h:2150
#define SM_CXHTHUMB
Definition: winuser.h:982
#define COLOR_SCROLLBAR
Definition: winuser.h:923
#define DCX_WINDOW
Definition: winuser.h:2149
#define SM_CYVSCROLL
Definition: winuser.h:992
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SIF_RANGE
Definition: winuser.h:1246
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define SM_CXVSCROLL
Definition: winuser.h:972
#define DFCS_FLAT
Definition: winuser.h:510
#define SB_VERT
Definition: winuser.h:553
#define SIF_THEMED
Definition: winuser.h:1249
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define ESB_DISABLE_BOTH
Definition: winuser.h:556
#define SWP_NOMOVE
Definition: winuser.h:1255
#define DFCS_INACTIVE
Definition: winuser.h:502
#define ESB_DISABLE_RTDN
Definition: winuser.h:561
#define SIF_PAGE
Definition: winuser.h:1244
#define SWP_NOSIZE
Definition: winuser.h:1256
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1799
#define BF_MIDDLE
Definition: winuser.h:468
#define SIF_TRACKPOS
Definition: winuser.h:1248
#define DFCS_SCROLLUP
Definition: winuser.h:489
#define SM_CYHSCROLL
Definition: winuser.h:973
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define CCHILDREN_SCROLLBAR
Definition: winuser.h:3847
#define SIF_DISABLENOSCROLL
Definition: winuser.h:1247
#define RDW_FRAME
Definition: winuser.h:1223
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2979
#define SIF_ALL
Definition: winuser.h:1243
#define SB_BOTH
Definition: winuser.h:555
#define SBS_VERT
Definition: winuser.h:334
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2980
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define SM_CXHSCROLL
Definition: winuser.h:993
#define STATE_SYSTEM_UNAVAILABLE
Definition: winuser.h:2964
struct tagSCROLLBARINFO SCROLLBARINFO
#define SIF_POS
Definition: winuser.h:1245
#define SB_CTL
Definition: winuser.h:554
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SW_SHOW
Definition: winuser.h:786
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define DFCS_SCROLLLEFT
Definition: winuser.h:491
#define DFCS_SCROLLRIGHT
Definition: winuser.h:492
#define DFCS_SCROLLDOWN
Definition: winuser.h:490
#define SWP_NOZORDER
Definition: winuser.h:1258
#define BF_RECT
Definition: winuser.h:462
#define GWL_STYLE
Definition: winuser.h:863
#define EDGE_RAISED
Definition: winuser.h:450
#define ESB_ENABLE_BOTH
Definition: winuser.h:563
#define DFCS_PUSHED
Definition: winuser.h:503
#define RDW_INVALIDATE
Definition: winuser.h:1225
#define SB_HORZ
Definition: winuser.h:552
#define ESB_DISABLE_LTUP
Definition: winuser.h:559