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