4 * Copyright 1993 Martin Ayotte
5 * Copyright 1994, 1996 Alexandre Julliard
8 #define NO_TRANSITION_TYPES /* This file is Win32-clean */
11 #include <sys/types.h>
15 #include "sysmetrics.h"
24 static HBITMAP32 hUpArrow
= 0;
25 static HBITMAP32 hDnArrow
= 0;
26 static HBITMAP32 hLfArrow
= 0;
27 static HBITMAP32 hRgArrow
= 0;
28 static HBITMAP32 hUpArrowD
= 0;
29 static HBITMAP32 hDnArrowD
= 0;
30 static HBITMAP32 hLfArrowD
= 0;
31 static HBITMAP32 hRgArrowD
= 0;
32 static HBITMAP32 hUpArrowI
= 0;
33 static HBITMAP32 hDnArrowI
= 0;
34 static HBITMAP32 hLfArrowI
= 0;
35 static HBITMAP32 hRgArrowI
= 0;
37 #define TOP_ARROW(flags,pressed) \
38 (((flags)&ESB_DISABLE_UP) ? hUpArrowI : ((pressed) ? hUpArrowD:hUpArrow))
39 #define BOTTOM_ARROW(flags,pressed) \
40 (((flags)&ESB_DISABLE_DOWN) ? hDnArrowI : ((pressed) ? hDnArrowD:hDnArrow))
41 #define LEFT_ARROW(flags,pressed) \
42 (((flags)&ESB_DISABLE_LEFT) ? hLfArrowI : ((pressed) ? hLfArrowD:hLfArrow))
43 #define RIGHT_ARROW(flags,pressed) \
44 (((flags)&ESB_DISABLE_RIGHT) ? hRgArrowI : ((pressed) ? hRgArrowD:hRgArrow))
47 /* Minimum size of the rectangle between the arrows */
48 #define SCROLL_MIN_RECT 4
50 /* Minimum size of the thumb in pixels */
51 #define SCROLL_MIN_THUMB 6
53 /* Delay (in ms) before first repetition when holding the button down */
54 #define SCROLL_FIRST_DELAY 200
56 /* Delay (in ms) between scroll repetitions */
57 #define SCROLL_REPEAT_DELAY 50
60 #define SCROLL_TIMER 0
62 /* Scroll-bar hit testing */
65 SCROLL_NOWHERE
, /* Outside the scroll bar */
66 SCROLL_TOP_ARROW
, /* Top or left arrow */
67 SCROLL_TOP_RECT
, /* Rectangle between the top arrow and the thumb */
68 SCROLL_THUMB
, /* Thumb rectangle */
69 SCROLL_BOTTOM_RECT
, /* Rectangle between the thumb and the bottom arrow */
70 SCROLL_BOTTOM_ARROW
/* Bottom or right arrow */
73 /* Thumb-tracking info */
74 static HWND32 SCROLL_TrackingWin
= 0;
75 static INT32 SCROLL_TrackingBar
= 0;
76 static INT32 SCROLL_TrackingPos
= 0;
77 static INT32 SCROLL_TrackingVal
= 0;
79 /* Is the moving thumb being displayed? */
80 static BOOL32 SCROLL_MovingThumb
= FALSE
;
82 /***********************************************************************
85 static void SCROLL_LoadBitmaps(void)
87 hUpArrow
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_UPARROW
) );
88 hDnArrow
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_DNARROW
) );
89 hLfArrow
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_LFARROW
) );
90 hRgArrow
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RGARROW
) );
91 hUpArrowD
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_UPARROWD
) );
92 hDnArrowD
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_DNARROWD
) );
93 hLfArrowD
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_LFARROWD
) );
94 hRgArrowD
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RGARROWD
) );
95 hUpArrowI
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_UPARROWI
) );
96 hDnArrowI
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_DNARROWI
) );
97 hLfArrowI
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_LFARROWI
) );
98 hRgArrowI
= LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RGARROWI
) );
102 /***********************************************************************
103 * SCROLL_GetPtrScrollInfo
105 static SCROLLBAR_INFO
*SCROLL_GetPtrScrollInfo( WND
* wndPtr
, INT32 nBar
)
107 SCROLLBAR_INFO
*infoPtr
;
109 if (!wndPtr
) return NULL
;
112 case SB_HORZ
: infoPtr
= (SCROLLBAR_INFO
*)wndPtr
->pHScroll
; break;
113 case SB_VERT
: infoPtr
= (SCROLLBAR_INFO
*)wndPtr
->pVScroll
; break;
114 case SB_CTL
: infoPtr
= (SCROLLBAR_INFO
*)wndPtr
->wExtra
; break;
115 default: return NULL
;
118 if (!infoPtr
) /* Create the info structure if needed */
120 if ((infoPtr
= HeapAlloc( SystemHeap
, 0, sizeof(SCROLLBAR_INFO
) )))
122 infoPtr
->MinVal
= infoPtr
->CurVal
= infoPtr
->Page
= 0;
123 infoPtr
->MaxVal
= 100;
124 infoPtr
->flags
= ESB_ENABLE_BOTH
;
125 if (nBar
== SB_HORZ
) wndPtr
->pHScroll
= infoPtr
;
126 else wndPtr
->pVScroll
= infoPtr
;
128 if (!hUpArrow
) SCROLL_LoadBitmaps();
134 /***********************************************************************
135 * SCROLL_GetScrollInfo
137 static SCROLLBAR_INFO
*SCROLL_GetScrollInfo( HWND32 hwnd
, INT32 nBar
)
139 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
140 return SCROLL_GetPtrScrollInfo( wndPtr
, nBar
);
144 /***********************************************************************
145 * SCROLL_GetScrollBarRect
147 * Compute the scroll bar rectangle, in drawing coordinates (i.e. client
148 * coords for SB_CTL, window coords for SB_VERT and SB_HORZ).
149 * 'arrowSize' returns the width or height of an arrow (depending on
150 * the orientation of the scrollbar), 'thumbSize' returns the size of
151 * the thumb, and 'thumbPos' returns the position of the thumb
152 * relative to the left or to the top.
153 * Return TRUE if the scrollbar is vertical, FALSE if horizontal.
155 static BOOL32
SCROLL_GetScrollBarRect( HWND32 hwnd
, INT32 nBar
, RECT32
*lprect
,
156 INT32
*arrowSize
, INT32
*thumbSize
,
161 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
166 lprect
->left
= wndPtr
->rectClient
.left
- wndPtr
->rectWindow
.left
- 1;
167 lprect
->top
= wndPtr
->rectClient
.bottom
- wndPtr
->rectWindow
.top
;
168 lprect
->right
= wndPtr
->rectClient
.right
- wndPtr
->rectWindow
.left
+1;
169 lprect
->bottom
= lprect
->top
+ SYSMETRICS_CYHSCROLL
+ 1;
174 lprect
->left
= wndPtr
->rectClient
.right
- wndPtr
->rectWindow
.left
;
175 lprect
->top
= wndPtr
->rectClient
.top
- wndPtr
->rectWindow
.top
- 1;
176 lprect
->right
= lprect
->left
+ SYSMETRICS_CXVSCROLL
+ 1;
177 lprect
->bottom
= wndPtr
->rectClient
.bottom
- wndPtr
->rectWindow
.top
+1;
182 GetClientRect32( hwnd
, lprect
);
183 vertical
= ((wndPtr
->dwStyle
& SBS_VERT
) != 0);
190 if (vertical
) pixels
= lprect
->bottom
- lprect
->top
;
191 else pixels
= lprect
->right
- lprect
->left
;
193 if (pixels
<= 2*SYSMETRICS_CXVSCROLL
+ SCROLL_MIN_RECT
)
195 if (pixels
> SCROLL_MIN_RECT
)
196 *arrowSize
= (pixels
- SCROLL_MIN_RECT
) / 2;
199 *thumbPos
= *thumbSize
= 0;
203 SCROLLBAR_INFO
*info
= SCROLL_GetPtrScrollInfo( wndPtr
, nBar
);
205 *arrowSize
= SYSMETRICS_CXVSCROLL
;
206 pixels
-= 2 * SYSMETRICS_CXVSCROLL
;
210 *thumbSize
= pixels
* info
->Page
/ (info
->MaxVal
-info
->MinVal
+1);
211 if (*thumbSize
< SCROLL_MIN_THUMB
) *thumbSize
= SCROLL_MIN_THUMB
;
213 else *thumbSize
= SYSMETRICS_CXVSCROLL
;
215 if (((pixels
-= *thumbSize
+ 1) < 0) ||
216 ((info
->flags
& ESB_DISABLE_BOTH
) == ESB_DISABLE_BOTH
))
218 /* Rectangle too small or scrollbar disabled -> no thumb */
219 *thumbPos
= *thumbSize
= 0;
223 INT32 max
= info
->MaxVal
- MAX( info
->Page
-1, 0 );
224 if (info
->MinVal
>= max
)
225 *thumbPos
= *arrowSize
;
227 *thumbPos
= *arrowSize
+ pixels
* (info
->CurVal
-info
->MinVal
) /
228 (max
- info
->MinVal
);
235 /***********************************************************************
238 * Compute the current scroll position based on the thumb position in pixels
239 * from the top of the scroll-bar.
241 static UINT32
SCROLL_GetThumbVal( SCROLLBAR_INFO
*infoPtr
, RECT32
*rect
,
242 BOOL32 vertical
, INT32 pos
)
245 INT32 pixels
= vertical
? rect
->bottom
-rect
->top
: rect
->right
-rect
->left
;
247 if ((pixels
-= 2*SYSMETRICS_CXVSCROLL
) <= 0) return infoPtr
->MinVal
;
251 thumbSize
= pixels
* infoPtr
->Page
/(infoPtr
->MaxVal
-infoPtr
->MinVal
+1);
252 if (thumbSize
< SCROLL_MIN_THUMB
) thumbSize
= SCROLL_MIN_THUMB
;
254 else thumbSize
= SYSMETRICS_CXVSCROLL
;
256 if ((pixels
-= thumbSize
+ 1) <= 0) return infoPtr
->MinVal
;
258 pos
= MAX( 0, pos
- SYSMETRICS_CXVSCROLL
);
259 if (pos
> pixels
) pos
= pixels
;
261 if (!infoPtr
->Page
) pos
*= infoPtr
->MaxVal
- infoPtr
->MinVal
;
262 else pos
*= infoPtr
->MaxVal
- infoPtr
->MinVal
- infoPtr
->Page
+ 1;
263 return infoPtr
->MinVal
+ ((pos
+ pixels
/ 2) / pixels
);
267 /***********************************************************************
270 * Scroll-bar hit testing (don't confuse this with WM_NCHITTEST!).
272 static enum SCROLL_HITTEST
SCROLL_HitTest( HWND32 hwnd
, INT32 nBar
,
275 INT32 arrowSize
, thumbSize
, thumbPos
;
278 BOOL32 vertical
= SCROLL_GetScrollBarRect( hwnd
, nBar
, &rect
,
279 &arrowSize
, &thumbSize
, &thumbPos
);
280 if (!PtInRect32( &rect
, pt
)) return SCROLL_NOWHERE
;
284 if (pt
.y
<= rect
.top
+ arrowSize
+ 1) return SCROLL_TOP_ARROW
;
285 if (pt
.y
>= rect
.bottom
- arrowSize
) return SCROLL_BOTTOM_ARROW
;
286 if (!thumbPos
) return SCROLL_TOP_RECT
;
288 if (pt
.y
< thumbPos
) return SCROLL_TOP_RECT
;
289 if (pt
.y
> thumbPos
+ thumbSize
) return SCROLL_BOTTOM_RECT
;
292 else /* horizontal */
294 if (pt
.x
<= rect
.left
+ arrowSize
) return SCROLL_TOP_ARROW
;
295 if (pt
.x
>= rect
.right
- arrowSize
) return SCROLL_BOTTOM_ARROW
;
296 if (!thumbPos
) return SCROLL_TOP_RECT
;
298 if (pt
.x
< thumbPos
) return SCROLL_TOP_RECT
;
299 if (pt
.x
> thumbPos
+ thumbSize
) return SCROLL_BOTTOM_RECT
;
305 /***********************************************************************
308 * Draw the scroll bar arrows.
310 static void SCROLL_DrawArrows( HDC32 hdc
, SCROLLBAR_INFO
*infoPtr
,
311 RECT32
*rect
, INT32 arrowSize
, BOOL32 vertical
,
312 BOOL32 top_pressed
, BOOL32 bottom_pressed
)
314 HDC32 hdcMem
= CreateCompatibleDC32( hdc
);
315 HBITMAP32 hbmpPrev
= SelectObject32( hdcMem
, vertical
?
316 TOP_ARROW(infoPtr
->flags
, top_pressed
)
317 : LEFT_ARROW(infoPtr
->flags
, top_pressed
));
318 SetStretchBltMode32( hdc
, STRETCH_DELETESCANS
);
319 StretchBlt32( hdc
, rect
->left
, rect
->top
,
320 vertical
? rect
->right
-rect
->left
: arrowSize
+1,
321 vertical
? arrowSize
+1 : rect
->bottom
-rect
->top
,
323 SYSMETRICS_CXVSCROLL
+ 1, SYSMETRICS_CYHSCROLL
+ 1,
326 SelectObject32( hdcMem
, vertical
?
327 BOTTOM_ARROW( infoPtr
->flags
, bottom_pressed
)
328 : RIGHT_ARROW( infoPtr
->flags
, bottom_pressed
) );
330 StretchBlt32( hdc
, rect
->left
, rect
->bottom
- arrowSize
- 1,
331 rect
->right
- rect
->left
, arrowSize
+ 1,
333 SYSMETRICS_CXVSCROLL
+ 1, SYSMETRICS_CYHSCROLL
+ 1,
336 StretchBlt32( hdc
, rect
->right
- arrowSize
- 1, rect
->top
,
337 arrowSize
+ 1, rect
->bottom
- rect
->top
,
339 SYSMETRICS_CXVSCROLL
+ 1, SYSMETRICS_CYHSCROLL
+ 1,
341 SelectObject32( hdcMem
, hbmpPrev
);
342 DeleteDC32( hdcMem
);
346 /***********************************************************************
347 * SCROLL_DrawMovingThumb
349 * Draw the moving thumb rectangle.
351 static void SCROLL_DrawMovingThumb( HDC32 hdc
, RECT32
*rect
, BOOL32 vertical
,
352 INT32 arrowSize
, INT32 thumbSize
)
357 r
.top
+= SCROLL_TrackingPos
;
358 if (r
.top
< rect
->top
+ arrowSize
) r
.top
= rect
->top
+ arrowSize
;
359 if (r
.top
+ thumbSize
>= rect
->bottom
- arrowSize
)
360 r
.top
= rect
->bottom
- arrowSize
- thumbSize
- 1;
361 r
.bottom
= r
.top
+ thumbSize
+ 1;
365 r
.left
+= SCROLL_TrackingPos
;
366 if (r
.left
< rect
->left
+ arrowSize
) r
.left
= rect
->left
+ arrowSize
;
367 if (r
.left
+ thumbSize
>= rect
->right
- arrowSize
)
368 r
.left
= rect
->right
- arrowSize
- thumbSize
- 1;
369 r
.right
= r
.left
+ thumbSize
+ 1;
371 InflateRect32( &r
, -1, -1 );
372 DrawFocusRect32( hdc
, &r
);
373 SCROLL_MovingThumb
= !SCROLL_MovingThumb
;
377 /***********************************************************************
378 * SCROLL_DrawInterior
380 * Draw the scroll bar interior (everything except the arrows).
382 static void SCROLL_DrawInterior( HWND32 hwnd
, HDC32 hdc
, INT32 nBar
,
383 RECT32
*rect
, INT32 arrowSize
,
384 INT32 thumbSize
, INT32 thumbPos
,
385 UINT32 flags
, BOOL32 vertical
,
386 BOOL32 top_selected
, BOOL32 bottom_selected
)
390 /* Select the correct brush and pen */
392 SelectObject32( hdc
, sysColorObjects
.hpenWindowFrame
);
393 if ((flags
& ESB_DISABLE_BOTH
) == ESB_DISABLE_BOTH
)
395 /* This ought to be the color of the parent window */
396 SelectObject32( hdc
, sysColorObjects
.hbrushWindow
);
400 if (nBar
== SB_CTL
) /* Only scrollbar controls send WM_CTLCOLOR */
402 HBRUSH32 hbrush
= SendMessage32A(GetParent32(hwnd
),
403 WM_CTLCOLORSCROLLBAR
, hdc
, hwnd
);
404 SelectObject32( hdc
, hbrush
);
406 else SelectObject32( hdc
, sysColorObjects
.hbrushScrollbar
);
409 /* Calculate the scroll rectangle */
415 r
.bottom
-= arrowSize
;
420 r
.right
-= arrowSize
;
423 /* Draw the scroll bar frame */
425 MoveTo( hdc
, r
.left
, r
.top
);
426 LineTo32( hdc
, r
.right
-1, r
.top
);
427 LineTo32( hdc
, r
.right
-1, r
.bottom
-1 );
428 LineTo32( hdc
, r
.left
, r
.bottom
-1 );
429 LineTo32( hdc
, r
.left
, r
.top
);
431 /* Draw the scroll rectangles and thumb */
433 if (!thumbPos
) /* No thumb to draw */
435 PatBlt32( hdc
, r
.left
+1, r
.top
+1, r
.right
- r
.left
- 2,
436 r
.bottom
- r
.top
- 2, PATCOPY
);
442 PatBlt32( hdc
, r
.left
+ 1, r
.top
+ 1,
443 r
.right
- r
.left
- 2,
444 thumbPos
- arrowSize
,
445 top_selected
? 0x0f0000 : PATCOPY
);
446 r
.top
+= thumbPos
- arrowSize
;
447 PatBlt32( hdc
, r
.left
+ 1, r
.top
+ thumbSize
+ 1,
448 r
.right
- r
.left
- 2,
449 r
.bottom
- r
.top
- thumbSize
- 2,
450 bottom_selected
? 0x0f0000 : PATCOPY
);
451 r
.bottom
= r
.top
+ thumbSize
+ 1;
453 else /* horizontal */
455 PatBlt32( hdc
, r
.left
+ 1, r
.top
+ 1,
456 thumbPos
- arrowSize
,
457 r
.bottom
- r
.top
- 2,
458 top_selected
? 0x0f0000 : PATCOPY
);
459 r
.left
+= thumbPos
- arrowSize
;
460 PatBlt32( hdc
, r
.left
+ thumbSize
+ 1, r
.top
+ 1,
461 r
.right
- r
.left
- thumbSize
- 2,
462 r
.bottom
- r
.top
- 2,
463 bottom_selected
? 0x0f0000 : PATCOPY
);
464 r
.right
= r
.left
+ thumbSize
+ 1;
469 SelectObject32( hdc
, sysColorObjects
.hbrushBtnFace
);
470 Rectangle32( hdc
, r
.left
, r
.top
, r
.right
, r
.bottom
);
471 InflateRect32( &r
, -1, -1 );
472 GRAPH_DrawReliefRect( hdc
, &r
, 1, 2, FALSE
);
473 if (SCROLL_MovingThumb
&&
474 (SCROLL_TrackingWin
== hwnd
) &&
475 (SCROLL_TrackingBar
== nBar
))
477 SCROLL_DrawMovingThumb( hdc
, rect
, vertical
, arrowSize
, thumbSize
);
478 SCROLL_MovingThumb
= TRUE
;
483 /***********************************************************************
484 * SCROLL_DrawScrollBar
486 * Redraw the whole scrollbar.
488 void SCROLL_DrawScrollBar( HWND32 hwnd
, HDC32 hdc
, INT32 nBar
, BOOL32 arrows
)
490 INT32 arrowSize
, thumbSize
, thumbPos
;
493 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
494 SCROLLBAR_INFO
*infoPtr
= SCROLL_GetPtrScrollInfo( wndPtr
, nBar
);
496 if (!wndPtr
|| !infoPtr
||
497 ((nBar
== SB_VERT
) && !(wndPtr
->dwStyle
& WS_VSCROLL
)) ||
498 ((nBar
== SB_HORZ
) && !(wndPtr
->dwStyle
& WS_HSCROLL
))) return;
500 vertical
= SCROLL_GetScrollBarRect( hwnd
, nBar
, &rect
,
501 &arrowSize
, &thumbSize
, &thumbPos
);
502 /* Draw the arrows */
504 if (arrows
&& arrowSize
) SCROLL_DrawArrows( hdc
, infoPtr
, &rect
, arrowSize
,
505 vertical
, FALSE
, FALSE
);
507 SCROLL_DrawInterior( hwnd
, hdc
, nBar
, &rect
, arrowSize
, thumbSize
,
508 thumbPos
, infoPtr
->flags
, vertical
, FALSE
, FALSE
);
512 /***********************************************************************
513 * SCROLL_RefreshScrollBar
515 * Repaint the scroll bar interior after a SetScrollRange() or
516 * SetScrollPos() call.
518 static void SCROLL_RefreshScrollBar( HWND32 hwnd
, INT32 nBar
, BOOL32 arrows
)
520 HDC32 hdc
= GetDCEx32( hwnd
, 0,
521 DCX_CACHE
| ((nBar
== SB_CTL
) ? 0 : DCX_WINDOW
) );
523 SCROLL_DrawScrollBar( hwnd
, hdc
, nBar
, arrows
);
524 ReleaseDC32( hwnd
, hdc
);
528 /***********************************************************************
529 * SCROLL_HandleKbdEvent
531 * Handle a keyboard event (only for SB_CTL scrollbars).
533 static void SCROLL_HandleKbdEvent( HWND32 hwnd
, WPARAM32 wParam
)
535 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
540 case VK_PRIOR
: msg
= SB_PAGEUP
; break;
541 case VK_NEXT
: msg
= SB_PAGEDOWN
; break;
542 case VK_HOME
: msg
= SB_TOP
; break;
543 case VK_END
: msg
= SB_BOTTOM
; break;
544 case VK_UP
: msg
= SB_LINEUP
; break;
545 case VK_DOWN
: msg
= SB_LINEDOWN
; break;
549 SendMessage32A( GetParent32(hwnd
),
550 (wndPtr
->dwStyle
& SBS_VERT
) ? WM_VSCROLL
: WM_HSCROLL
,
555 /***********************************************************************
556 * SCROLL_HandleScrollEvent
558 * Handle a mouse or timer event for the scrollbar.
559 * 'pt' is the location of the mouse event in client (for SB_CTL) or
560 * windows coordinates.
562 void SCROLL_HandleScrollEvent( HWND32 hwnd
, INT32 nBar
, UINT32 msg
, POINT32 pt
)
564 /* Previous mouse position for timer events */
565 static POINT32 prevPt
;
566 /* Hit test code of the last button-down event */
567 static enum SCROLL_HITTEST trackHitTest
;
568 /* Thumb position when tracking started. */
569 static UINT32 trackThumbPos
;
570 /* Position in the scroll-bar of the last button-down event. */
571 static INT32 lastClickPos
;
572 /* Position in the scroll-bar of the last mouse event. */
573 static INT32 lastMousePos
;
575 enum SCROLL_HITTEST hittest
;
576 HWND32 hwndOwner
, hwndCtl
;
578 INT32 arrowSize
, thumbSize
, thumbPos
;
582 SCROLLBAR_INFO
*infoPtr
= SCROLL_GetScrollInfo( hwnd
, nBar
);
583 if (!infoPtr
) return;
584 if ((trackHitTest
== SCROLL_NOWHERE
) && (msg
!= WM_LBUTTONDOWN
)) return;
586 hdc
= GetDCEx32( hwnd
, 0, DCX_CACHE
| ((nBar
== SB_CTL
) ? 0 : DCX_WINDOW
));
587 vertical
= SCROLL_GetScrollBarRect( hwnd
, nBar
, &rect
,
588 &arrowSize
, &thumbSize
, &thumbPos
);
589 hwndOwner
= (nBar
== SB_CTL
) ? GetParent32(hwnd
) : hwnd
;
590 hwndCtl
= (nBar
== SB_CTL
) ? hwnd
: 0;
594 case WM_LBUTTONDOWN
: /* Initialise mouse tracking */
595 trackHitTest
= hittest
= SCROLL_HitTest( hwnd
, nBar
, pt
);
596 lastClickPos
= vertical
? (pt
.y
- rect
.top
) : (pt
.x
- rect
.left
);
597 lastMousePos
= lastClickPos
;
598 trackThumbPos
= thumbPos
;
600 SetCapture32( hwnd
);
601 if (nBar
== SB_CTL
) SetFocus32( hwnd
);
605 hittest
= SCROLL_HitTest( hwnd
, nBar
, pt
);
610 hittest
= SCROLL_NOWHERE
;
616 hittest
= SCROLL_HitTest( hwnd
, nBar
, pt
);
620 return; /* Should never happen */
623 dprintf_scroll( stddeb
, "ScrollBar Event: hwnd=%04x bar=%d msg=%x pt=%d,%d hit=%d\n",
624 hwnd
, nBar
, msg
, pt
.x
, pt
.y
, hittest
);
628 case SCROLL_NOWHERE
: /* No tracking in progress */
631 case SCROLL_TOP_ARROW
:
632 SCROLL_DrawArrows( hdc
, infoPtr
, &rect
, arrowSize
, vertical
,
633 (hittest
== trackHitTest
), FALSE
);
634 if (hittest
== trackHitTest
)
636 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_SYSTIMER
))
638 SendMessage32A( hwndOwner
, vertical
? WM_VSCROLL
: WM_HSCROLL
,
639 SB_LINEUP
, hwndCtl
);
640 SetSystemTimer32( hwnd
, SCROLL_TIMER
, (msg
== WM_LBUTTONDOWN
) ?
641 SCROLL_FIRST_DELAY
: SCROLL_REPEAT_DELAY
,
645 else KillSystemTimer32( hwnd
, SCROLL_TIMER
);
648 case SCROLL_TOP_RECT
:
649 SCROLL_DrawInterior( hwnd
, hdc
, nBar
, &rect
, arrowSize
, thumbSize
,
650 thumbPos
, infoPtr
->flags
, vertical
,
651 (hittest
== trackHitTest
), FALSE
);
652 if (hittest
== trackHitTest
)
654 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_SYSTIMER
))
656 SendMessage32A( hwndOwner
, vertical
? WM_VSCROLL
: WM_HSCROLL
,
657 SB_PAGEUP
, hwndCtl
);
658 SetSystemTimer32( hwnd
, SCROLL_TIMER
, (msg
== WM_LBUTTONDOWN
) ?
659 SCROLL_FIRST_DELAY
: SCROLL_REPEAT_DELAY
,
663 else KillSystemTimer32( hwnd
, SCROLL_TIMER
);
667 if (msg
== WM_LBUTTONDOWN
)
669 SCROLL_TrackingWin
= hwnd
;
670 SCROLL_TrackingBar
= nBar
;
671 SCROLL_TrackingPos
= trackThumbPos
+ lastMousePos
- lastClickPos
;
672 SCROLL_DrawMovingThumb(hdc
, &rect
, vertical
, arrowSize
, thumbSize
);
674 else if (msg
== WM_LBUTTONUP
)
676 SCROLL_TrackingWin
= 0;
677 SCROLL_MovingThumb
= FALSE
;
678 SCROLL_DrawInterior( hwnd
, hdc
, nBar
, &rect
, arrowSize
, thumbSize
,
679 thumbPos
, infoPtr
->flags
, vertical
,
682 else /* WM_MOUSEMOVE */
686 if (!PtInRect32( &rect
, pt
)) pos
= lastClickPos
;
687 else pos
= vertical
? (pt
.y
- rect
.top
) : (pt
.x
- rect
.left
);
688 if (pos
!= lastMousePos
)
690 SCROLL_DrawMovingThumb( hdc
, &rect
, vertical
,
691 arrowSize
, thumbSize
);
693 SCROLL_TrackingPos
= trackThumbPos
+ pos
- lastClickPos
;
694 SCROLL_TrackingVal
= SCROLL_GetThumbVal( infoPtr
, &rect
,
696 SCROLL_TrackingPos
);
697 SendMessage32A( hwndOwner
, vertical
? WM_VSCROLL
: WM_HSCROLL
,
698 MAKEWPARAM( SB_THUMBTRACK
, SCROLL_TrackingVal
),
700 SCROLL_DrawMovingThumb( hdc
, &rect
, vertical
,
701 arrowSize
, thumbSize
);
706 case SCROLL_BOTTOM_RECT
:
707 SCROLL_DrawInterior( hwnd
, hdc
, nBar
, &rect
, arrowSize
, thumbSize
,
708 thumbPos
, infoPtr
->flags
, vertical
,
709 FALSE
, (hittest
== trackHitTest
) );
710 if (hittest
== trackHitTest
)
712 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_SYSTIMER
))
714 SendMessage32A( hwndOwner
, vertical
? WM_VSCROLL
: WM_HSCROLL
,
715 SB_PAGEDOWN
, hwndCtl
);
716 SetSystemTimer32( hwnd
, SCROLL_TIMER
, (msg
== WM_LBUTTONDOWN
) ?
717 SCROLL_FIRST_DELAY
: SCROLL_REPEAT_DELAY
,
721 else KillSystemTimer32( hwnd
, SCROLL_TIMER
);
724 case SCROLL_BOTTOM_ARROW
:
725 SCROLL_DrawArrows( hdc
, infoPtr
, &rect
, arrowSize
, vertical
,
726 FALSE
, (hittest
== trackHitTest
) );
727 if (hittest
== trackHitTest
)
729 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_SYSTIMER
))
731 SendMessage32A( hwndOwner
, vertical
? WM_VSCROLL
: WM_HSCROLL
,
732 SB_LINEDOWN
, hwndCtl
);
733 SetSystemTimer32( hwnd
, SCROLL_TIMER
, (msg
== WM_LBUTTONDOWN
) ?
734 SCROLL_FIRST_DELAY
: SCROLL_REPEAT_DELAY
,
738 else KillSystemTimer32( hwnd
, SCROLL_TIMER
);
742 if (msg
== WM_LBUTTONUP
)
744 if (trackHitTest
== SCROLL_THUMB
)
746 UINT32 val
= SCROLL_GetThumbVal( infoPtr
, &rect
, vertical
,
747 trackThumbPos
+ lastMousePos
- lastClickPos
);
748 SendMessage32A( hwndOwner
, vertical
? WM_VSCROLL
: WM_HSCROLL
,
749 MAKEWPARAM( SB_THUMBPOSITION
, val
), hwndCtl
);
752 SendMessage32A( hwndOwner
, vertical
? WM_VSCROLL
: WM_HSCROLL
,
753 SB_ENDSCROLL
, hwndCtl
);
754 trackHitTest
= SCROLL_NOWHERE
; /* Terminate tracking */
757 ReleaseDC32( hwnd
, hdc
);
761 /***********************************************************************
764 LRESULT
ScrollBarWndProc( HWND32 hwnd
, UINT32 message
, WPARAM32 wParam
,
771 CREATESTRUCT32A
*lpCreat
= (CREATESTRUCT32A
*)lParam
;
772 if (lpCreat
->style
& SBS_SIZEBOX
)
774 fprintf( stdnimp
, "Unimplemented style SBS_SIZEBOX.\n" );
775 return 0; /* FIXME */
778 if (lpCreat
->style
& SBS_VERT
)
780 if (lpCreat
->style
& SBS_LEFTALIGN
)
781 MoveWindow( hwnd
, lpCreat
->x
, lpCreat
->y
,
782 SYSMETRICS_CXVSCROLL
+1, lpCreat
->cy
, FALSE
);
783 else if (lpCreat
->style
& SBS_RIGHTALIGN
)
785 lpCreat
->x
+lpCreat
->cx
-SYSMETRICS_CXVSCROLL
-1,
787 SYSMETRICS_CXVSCROLL
+ 1, lpCreat
->cy
, FALSE
);
791 if (lpCreat
->style
& SBS_TOPALIGN
)
792 MoveWindow( hwnd
, lpCreat
->x
, lpCreat
->y
,
793 lpCreat
->cx
, SYSMETRICS_CYHSCROLL
+1, FALSE
);
794 else if (lpCreat
->style
& SBS_BOTTOMALIGN
)
797 lpCreat
->y
+lpCreat
->cy
-SYSMETRICS_CYHSCROLL
-1,
798 lpCreat
->cx
, SYSMETRICS_CYHSCROLL
+1, FALSE
);
801 if (!hUpArrow
) SCROLL_LoadBitmaps();
802 dprintf_scroll( stddeb
, "ScrollBar creation, hwnd=%04x\n", hwnd
);
811 CONV_POINT16TO32( (POINT16
*)&lParam
, &pt
);
812 SCROLL_HandleScrollEvent( hwnd
, SB_CTL
, message
, pt
);
817 SCROLL_HandleKbdEvent( hwnd
, wParam
);
824 return DLGC_WANTARROWS
; /* Windows returns this value */
829 HDC32 hdc
= BeginPaint32( hwnd
, &ps
);
830 SCROLL_DrawScrollBar( hwnd
, hdc
, SB_CTL
, TRUE
);
831 EndPaint32( hwnd
, &ps
);
837 return SetScrollPos32( hwnd
, SB_CTL
, wParam
, (BOOL32
)lParam
);
841 return GetScrollPos32( hwnd
, SB_CTL
);
844 SetScrollRange32( hwnd
, SB_CTL
, LOWORD(lParam
), HIWORD(lParam
),
845 wParam
/* FIXME: Is this correct? */ );
849 SetScrollRange32( hwnd
, SB_CTL
, wParam
, lParam
, FALSE
);
850 return 0; /* FIXME: return previous position */
854 fprintf( stderr
, "ScrollBar: don't know how to handle SBM_GETRANGE16 (wp=%04x,lp=%08lx)\n",
859 GetScrollRange32( hwnd
, SB_CTL
, (LPINT32
)wParam
, (LPINT32
)lParam
);
862 case SBM_ENABLE_ARROWS16
:
863 case SBM_ENABLE_ARROWS32
:
864 return EnableScrollBar32( hwnd
, SB_CTL
, wParam
);
866 case SBM_SETRANGEREDRAW32
:
867 SetScrollRange32( hwnd
, SB_CTL
, wParam
, lParam
, TRUE
);
868 return 0; /* FIXME: return previous position */
870 case SBM_SETSCROLLINFO32
:
871 return SetScrollInfo32( hwnd
, SB_CTL
, (SCROLLINFO
*)lParam
, wParam
);
873 case SBM_GETSCROLLINFO32
:
874 return GetScrollInfo32( hwnd
, SB_CTL
, (SCROLLINFO
*)lParam
);
884 fprintf(stderr
, "ScrollBar: unknown Win32 msg %04x wp=%08x lp=%08lx\n",
885 message
, wParam
, lParam
);
889 if (message
>= WM_USER
)
890 fprintf( stderr
, "ScrollBar: unknown msg %04x wp=%04x lp=%08lx\n",
891 message
, wParam
, lParam
);
892 return DefWindowProc32A( hwnd
, message
, wParam
, lParam
);
898 /*************************************************************************
899 * SetScrollInfo16 (USER.475)
901 INT16
SetScrollInfo16( HWND16 hwnd
, INT16 nBar
, const SCROLLINFO
*info
,
904 return (INT16
)SetScrollInfo32( hwnd
, nBar
, info
, bRedraw
);
908 /*************************************************************************
909 * SetScrollInfo32 (USER32.500)
911 INT32
SetScrollInfo32( HWND32 hwnd
, INT32 nBar
, const SCROLLINFO
*info
,
914 SCROLLBAR_INFO
*infoPtr
;
916 BOOL32 repaint_arrows
= FALSE
;
918 if (!(infoPtr
= SCROLL_GetScrollInfo(hwnd
, nBar
))) return 0;
919 if (info
->fMask
& ~(SIF_ALL
| SIF_DISABLENOSCROLL
)) return 0;
920 if ((info
->cbSize
!= sizeof(*info
)) &&
921 (info
->cbSize
!= sizeof(*info
)-sizeof(info
->nTrackPos
))) return 0;
923 dprintf_scroll( stddeb
, "SetScrollInfo: hwnd=%04x bar=%d", hwnd
, nBar
);
925 /* Set the page size */
927 if (info
->fMask
& SIF_PAGE
)
929 dprintf_scroll( stddeb
, " page=%d", info
->nPage
);
930 infoPtr
->Page
= info
->nPage
;
933 /* Set the scroll pos */
935 if (info
->fMask
& SIF_POS
)
937 dprintf_scroll( stddeb
, " pos=%d", info
->nPos
);
938 infoPtr
->CurVal
= info
->nPos
;
941 /* Set the scroll range */
943 if (info
->fMask
& SIF_RANGE
)
945 dprintf_scroll( stddeb
, " min=%d max=%d", info
->nMin
, info
->nMax
);
947 /* Invalid range -> range is set to (0,0) */
948 if ((info
->nMin
> info
->nMax
) ||
949 ((UINT32
)(info
->nMax
- info
->nMin
) >= 0x80000000))
956 infoPtr
->MinVal
= info
->nMin
;
957 infoPtr
->MaxVal
= info
->nMax
;
961 /* Make sure the page size is valid */
963 if (infoPtr
->Page
< 0) infoPtr
->Page
= 0;
964 else if (infoPtr
->Page
> infoPtr
->MaxVal
- infoPtr
->MinVal
+ 1 )
965 infoPtr
->Page
= infoPtr
->MaxVal
- infoPtr
->MinVal
+ 1;
967 /* Make sure the pos is inside the range */
969 if (infoPtr
->CurVal
< infoPtr
->MinVal
)
970 infoPtr
->CurVal
= infoPtr
->MinVal
;
971 else if (infoPtr
->CurVal
> infoPtr
->MaxVal
- MAX( infoPtr
->Page
-1, 0 ))
972 infoPtr
->CurVal
= infoPtr
->MaxVal
- MAX( infoPtr
->Page
-1, 0 );
974 dprintf_scroll( stddeb
, "\n new values: page=%d pos=%d min=%d max=%d\n",
975 infoPtr
->Page
, infoPtr
->CurVal
,
976 infoPtr
->MinVal
, infoPtr
->MaxVal
);
978 /* Check if the scrollbar should be hidden or disabled */
980 new_flags
= infoPtr
->flags
;
981 if (infoPtr
->MinVal
>= infoPtr
->MaxVal
- MAX( infoPtr
->Page
-1, 0 ))
983 /* Hide or disable scroll-bar */
984 if (info
->fMask
& SIF_DISABLENOSCROLL
) new_flags
= ESB_DISABLE_BOTH
;
985 else if (nBar
!= SB_CTL
)
987 ShowScrollBar32( hwnd
, nBar
, FALSE
);
988 bRedraw
= FALSE
; /* No need to repaint anything */
991 else /* Show and enable scroll-bar */
994 if (nBar
!= SB_CTL
) ShowScrollBar32( hwnd
, nBar
, TRUE
);
997 if (infoPtr
->flags
!= new_flags
)
999 infoPtr
->flags
= new_flags
;
1000 repaint_arrows
= TRUE
;
1003 if (bRedraw
|| repaint_arrows
)
1004 SCROLL_RefreshScrollBar( hwnd
, nBar
, repaint_arrows
);
1006 /* Return current position */
1008 return infoPtr
->CurVal
;
1012 /*************************************************************************
1013 * GetScrollInfo16 (USER.476)
1015 BOOL16
GetScrollInfo16( HWND16 hwnd
, INT16 nBar
, LPSCROLLINFO info
)
1017 return GetScrollInfo32( hwnd
, nBar
, info
);
1021 /*************************************************************************
1022 * GetScrollInfo32 (USER32.283)
1024 BOOL32
GetScrollInfo32( HWND32 hwnd
, INT32 nBar
, LPSCROLLINFO info
)
1026 SCROLLBAR_INFO
*infoPtr
;
1028 if (!(infoPtr
= SCROLL_GetScrollInfo( hwnd
, nBar
))) return FALSE
;
1029 if (info
->fMask
& ~(SIF_ALL
| SIF_DISABLENOSCROLL
)) return FALSE
;
1030 if ((info
->cbSize
!= sizeof(*info
)) &&
1031 (info
->cbSize
!= sizeof(*info
)-sizeof(info
->nTrackPos
))) return FALSE
;
1033 if (info
->fMask
& SIF_PAGE
) info
->nPage
= infoPtr
->Page
;
1034 if (info
->fMask
& SIF_POS
) info
->nPos
= infoPtr
->CurVal
;
1035 if ((info
->fMask
& SIF_TRACKPOS
) && (info
->cbSize
== sizeof(*info
)))
1036 info
->nTrackPos
= (SCROLL_TrackingWin
==hwnd
) ? SCROLL_TrackingVal
: 0;
1037 if (info
->fMask
& SIF_RANGE
)
1039 info
->nMin
= infoPtr
->MinVal
;
1040 info
->nMax
= infoPtr
->MaxVal
;
1042 return (info
->fMask
& SIF_ALL
) != 0;
1046 /*************************************************************************
1047 * SetScrollPos16 (USER.62)
1049 INT16
SetScrollPos16( HWND16 hwnd
, INT16 nBar
, INT16 nPos
, BOOL16 bRedraw
)
1051 return (INT16
)SetScrollPos32( hwnd
, nBar
, nPos
, bRedraw
);
1055 /*************************************************************************
1056 * SetScrollPos32 (USER32.501)
1058 INT32
SetScrollPos32( HWND32 hwnd
, INT32 nBar
, INT32 nPos
, BOOL32 bRedraw
)
1061 SCROLLBAR_INFO
*infoPtr
;
1064 if (!(infoPtr
= SCROLL_GetScrollInfo( hwnd
, nBar
))) return 0;
1065 oldPos
= infoPtr
->CurVal
;
1066 info
.cbSize
= sizeof(info
);
1068 info
.fMask
= SIF_POS
;
1069 SetScrollInfo32( hwnd
, nBar
, &info
, bRedraw
);
1074 /*************************************************************************
1075 * GetScrollPos16 (USER.63)
1077 INT16
GetScrollPos16( HWND16 hwnd
, INT16 nBar
)
1079 return (INT16
)GetScrollPos32( hwnd
, nBar
);
1083 /*************************************************************************
1084 * GetScrollPos32 (USER32.284)
1086 INT32
GetScrollPos32( HWND32 hwnd
, INT32 nBar
)
1088 SCROLLBAR_INFO
*infoPtr
;
1090 if (!(infoPtr
= SCROLL_GetScrollInfo( hwnd
, nBar
))) return 0;
1091 return infoPtr
->CurVal
;
1095 /*************************************************************************
1096 * SetScrollRange16 (USER.64)
1098 void SetScrollRange16( HWND16 hwnd
, INT16 nBar
, INT16 MinVal
, INT16 MaxVal
,
1101 /* Invalid range -> range is set to (0,0) */
1102 if ((INT32
)MaxVal
- (INT32
)MinVal
> 0x7fff) MinVal
= MaxVal
= 0;
1103 SetScrollRange32( hwnd
, nBar
, MinVal
, MaxVal
, bRedraw
);
1107 /*************************************************************************
1108 * SetScrollRange32 (USER32.502)
1110 BOOL32
SetScrollRange32( HWND32 hwnd
, INT32 nBar
, INT32 MinVal
, INT32 MaxVal
,
1115 info
.cbSize
= sizeof(info
);
1118 info
.fMask
= SIF_RANGE
;
1119 SetScrollInfo32( hwnd
, nBar
, &info
, bRedraw
);
1124 /*************************************************************************
1125 * SCROLL_SetNCSbState
1127 * This is for CalcChildScroll in windows/mdi.c
1129 DWORD
SCROLL_SetNCSbState(WND
* wndPtr
, int vMin
, int vMax
, int vPos
,
1130 int hMin
, int hMax
, int hPos
)
1132 SCROLLBAR_INFO
*infoPtr
= SCROLL_GetPtrScrollInfo(wndPtr
, SB_VERT
);
1134 wndPtr
->dwStyle
|= (WS_VSCROLL
| WS_HSCROLL
);
1138 wndPtr
->dwStyle
&= ~WS_VSCROLL
; }
1139 if( vPos
> vMax
) vPos
= vMax
; else if( vPos
< vMin
) vPos
= vMin
;
1140 infoPtr
->MinVal
= vMin
;
1141 infoPtr
->MaxVal
= vMax
;
1142 infoPtr
->CurVal
= vPos
;
1144 infoPtr
= SCROLL_GetPtrScrollInfo(wndPtr
, SB_HORZ
);
1148 wndPtr
->dwStyle
&= ~WS_HSCROLL
; }
1149 if( hPos
> hMax
) hPos
= hMax
; else if( hPos
< hMin
) hPos
= hMin
;
1150 infoPtr
->MinVal
= hMin
;
1151 infoPtr
->MaxVal
= hMax
;
1152 infoPtr
->CurVal
= hPos
;
1154 return wndPtr
->dwStyle
& (WS_VSCROLL
| WS_HSCROLL
);
1158 /*************************************************************************
1159 * GetScrollRange16 (USER.65)
1161 BOOL16
GetScrollRange16( HWND16 hwnd
, INT16 nBar
, LPINT16 lpMin
, LPINT16 lpMax
)
1164 BOOL16 ret
= GetScrollRange32( hwnd
, nBar
, &min
, &max
);
1165 if (lpMin
) *lpMin
= min
;
1166 if (lpMax
) *lpMax
= max
;
1171 /*************************************************************************
1172 * GetScrollRange32 (USER32.285)
1174 BOOL32
GetScrollRange32( HWND32 hwnd
, INT32 nBar
, LPINT32 lpMin
, LPINT32 lpMax
)
1176 SCROLLBAR_INFO
*infoPtr
;
1178 if (!(infoPtr
= SCROLL_GetScrollInfo( hwnd
, nBar
)))
1180 if (lpMin
) lpMin
= 0;
1181 if (lpMax
) lpMax
= 0;
1184 if (lpMin
) *lpMin
= infoPtr
->MinVal
;
1185 if (lpMax
) *lpMax
= infoPtr
->MaxVal
;
1190 /*************************************************************************
1191 * ShowScrollBar16 (USER.267)
1193 void ShowScrollBar16( HWND16 hwnd
, INT16 nBar
, BOOL16 fShow
)
1195 ShowScrollBar32( hwnd
, nBar
, fShow
);
1199 /*************************************************************************
1200 * ShowScrollBar32 (USER32.531)
1202 BOOL32
ShowScrollBar32( HWND32 hwnd
, INT32 nBar
, BOOL32 fShow
)
1204 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1206 if (!wndPtr
) return FALSE
;
1207 dprintf_scroll( stddeb
, "ShowScrollBar: hwnd=%04x bar=%d on=%d\n",
1208 hwnd
, nBar
, fShow
);
1213 ShowWindow( hwnd
, fShow
? SW_SHOW
: SW_HIDE
);
1219 if (wndPtr
->dwStyle
& WS_HSCROLL
) return TRUE
;
1220 wndPtr
->dwStyle
|= WS_HSCROLL
;
1224 if (!(wndPtr
->dwStyle
& WS_HSCROLL
)) return TRUE
;
1225 wndPtr
->dwStyle
&= ~WS_HSCROLL
;
1232 if (wndPtr
->dwStyle
& WS_VSCROLL
) return TRUE
;
1233 wndPtr
->dwStyle
|= WS_VSCROLL
;
1237 if (!(wndPtr
->dwStyle
& WS_VSCROLL
)) return TRUE
;
1238 wndPtr
->dwStyle
&= ~WS_VSCROLL
;
1245 if ((wndPtr
->dwStyle
& WS_HSCROLL
)
1246 && (wndPtr
->dwStyle
& WS_VSCROLL
)) return TRUE
;
1247 wndPtr
->dwStyle
|= WS_HSCROLL
| WS_VSCROLL
;
1251 if (!(wndPtr
->dwStyle
& WS_HSCROLL
)
1252 && !(wndPtr
->dwStyle
& WS_VSCROLL
)) return TRUE
;
1253 wndPtr
->dwStyle
&= ~(WS_HSCROLL
| WS_VSCROLL
);
1258 return TRUE
; /* Nothing to do! */
1260 SetWindowPos( hwnd
, 0, 0, 0, 0, 0, SWP_NOSIZE
| SWP_NOMOVE
1261 | SWP_NOACTIVATE
| SWP_NOZORDER
| SWP_FRAMECHANGED
);
1266 /*************************************************************************
1267 * EnableScrollBar16 (USER.482)
1269 BOOL16
EnableScrollBar16( HWND16 hwnd
, INT16 nBar
, UINT16 flags
)
1271 return EnableScrollBar32( hwnd
, nBar
, flags
);
1275 /*************************************************************************
1276 * EnableScrollBar32 (USER32.170)
1278 BOOL32
EnableScrollBar32( HWND32 hwnd
, INT32 nBar
, UINT32 flags
)
1280 SCROLLBAR_INFO
*infoPtr
;
1282 if (!(infoPtr
= SCROLL_GetScrollInfo( hwnd
, nBar
))) return FALSE
;
1283 dprintf_scroll( stddeb
, "EnableScrollBar: %04x %d %d\n",
1284 hwnd
, nBar
, flags
);
1285 flags
&= ESB_DISABLE_BOTH
;
1286 if (infoPtr
->flags
== flags
) return FALSE
;
1287 infoPtr
->flags
= flags
;
1289 /* Redraw the whole scroll bar */
1290 SCROLL_RefreshScrollBar( hwnd
, nBar
, TRUE
);