2 * Interface code to SCROLLBAR widget
4 * Copyright Martin Ayotte, 1993
11 static char Copyright
[] = "Copyright Martin Ayotte, 1993";
15 #include <sys/types.h>
18 #include "sysmetrics.h"
22 #include "prototypes.h"
28 HBITMAP hUpArrowD
= 0;
29 HBITMAP hDnArrowD
= 0;
30 HBITMAP hLfArrowD
= 0;
31 HBITMAP hRgArrowD
= 0;
33 LPHEADSCROLL
ScrollBarGetWindowAndStorage(HWND hWnd
, WND
**wndPtr
);
34 LPHEADSCROLL
ScrollBarGetStorageHeader(HWND hWnd
);
35 LPHEADSCROLL
GetScrollObjectStruct(HWND hWnd
, int nBar
);
36 void ScrollBarButtonDown(HWND hWnd
, int nBar
, int x
, int y
);
37 void ScrollBarButtonUp(HWND hWnd
, int nBar
, int x
, int y
);
38 void ScrollBarMouseMove(HWND hWnd
, int nBar
, WORD wParam
, int x
, int y
);
39 void StdDrawScrollBar(HWND hWnd
, HDC hDC
, int nBar
, LPRECT lprect
, LPHEADSCROLL lphs
);
40 int CreateScrollBarStruct(HWND hWnd
);
41 void NC_CreateScrollBars(HWND hWnd
);
42 LPHEADSCROLL
AllocScrollBar(DWORD dwStyle
, int width
, int height
);
45 /***********************************************************************
46 * WIDGETS_ScrollBarWndProc
48 LONG
ScrollBarWndProc( HWND hWnd
, WORD message
, WORD wParam
, LONG lParam
)
63 CreateScrollBarStruct(hWnd
);
65 printf("ScrollBar Creation !\n");
69 lphs
= ScrollBarGetWindowAndStorage(hWnd
, &wndPtr
);
70 if (lphs
== 0) return 0;
72 printf("ScrollBar WM_DESTROY %lX !\n", lphs
);
75 *((LPHEADSCROLL
*)&wndPtr
->wExtra
[1]) = 0;
80 ScrollBarButtonDown(hWnd
, SB_CTL
, LOWORD(lParam
), HIWORD(lParam
));
84 ScrollBarButtonUp(hWnd
, SB_CTL
, LOWORD(lParam
), HIWORD(lParam
));
88 ScrollBarMouseMove(hWnd
, SB_CTL
, wParam
, LOWORD(lParam
), HIWORD(lParam
));
93 lphs
= ScrollBarGetWindowAndStorage(hWnd
, &wndPtr
);
94 return(SendMessage(wndPtr
->hwndParent
, message
, wParam
, lParam
));
98 printf("ScrollBar WM_TIMER wParam=%X lParam=%lX !\n", wParam
, lParam
);
100 lphs
= ScrollBarGetWindowAndStorage(hWnd
, &wndPtr
);
101 KillTimer(hWnd
, wParam
);
102 switch(lphs
->ButtonDown
) {
104 lphs
->TimerPending
= FALSE
;
108 SendMessage(wndPtr
->hwndParent
, lphs
->Direction
,
109 SB_LINEUP
, MAKELONG(0, hWnd
));
113 SendMessage(wndPtr
->hwndParent
, lphs
->Direction
,
114 SB_LINEDOWN
, MAKELONG(0, hWnd
));
117 SendMessage(wndPtr
->hwndParent
, lphs
->Direction
,
118 SB_PAGEUP
, MAKELONG(0, hWnd
));
121 SendMessage(wndPtr
->hwndParent
, lphs
->Direction
,
122 SB_PAGEDOWN
, MAKELONG(0, hWnd
));
125 SetTimer(hWnd
, 1, 100, NULL
);
129 hDC
= BeginPaint(hWnd
, &ps
);
130 lphs
= ScrollBarGetStorageHeader(hWnd
);
132 GetClientRect(hWnd
, &rect
);
133 StdDrawScrollBar(hWnd
, hDC
, SB_CTL
, &rect
, lphs
);
138 return DefWindowProc( hWnd
, message
, wParam
, lParam
);
145 void ScrollBarButtonDown(HWND hWnd
, int nBar
, int x
, int y
)
152 lphs
= GetScrollObjectStruct(hWnd
, nBar
);
153 if (nBar
== SB_CTL
) {
154 hWndParent
= GetParent(hWnd
);
155 dwOwner
= MAKELONG(0, lphs
->hWndOwner
);
157 printf("ScrollBarButtonDown SB_CTL // x=%d y=%d\n", x
, y
);
164 printf("ScrollBarButtonDown SB_?SCROLL // x=%d y=%d\n", x
, y
);
168 SetFocus(lphs->hWndOwner);
170 CopyRect(&rect
, &lphs
->rect
);
172 printf("ScrollDown / x=%d y=%d left=%d top=%d right=%d bottom=%d \n",
173 x
, y
, rect
.left
, rect
.top
, rect
.right
, rect
.bottom
);
175 if (lphs
->Direction
== WM_VSCROLL
) {
176 width
= rect
.right
- rect
.left
;
177 if (y
< (lphs
->CurPix
+ width
)) {
179 lphs
->ButtonDown
= 1;
180 CopyRect(&rect2
, &rect
);
181 rect2
.bottom
= rect2
.top
+ width
;
182 InvalidateRect(lphs
->hWndOwner
, &rect2
, TRUE
);
184 printf("ScrollBarButtonDown send SB_LINEUP\n");
186 SendMessage(hWndParent
, lphs
->Direction
,
190 lphs
->ButtonDown
= 5;
192 printf("ScrollBarButtonDown send SB_PAGEUP\n");
194 SendMessage(hWndParent
, lphs
->Direction
,
198 if (y
> (lphs
->CurPix
+ (width
<< 1))) {
199 if (y
> (rect
.bottom
- rect
.top
- width
)) {
200 lphs
->ButtonDown
= 2;
201 CopyRect(&rect2
, &rect
);
202 rect2
.top
= rect2
.bottom
- width
;
203 InvalidateRect(lphs
->hWndOwner
, &rect2
, TRUE
);
205 printf("ScrollBarButtonDown send SB_LINEDOWN\n");
207 SendMessage(hWndParent
, lphs
->Direction
,
208 SB_LINEDOWN
, dwOwner
);
211 lphs
->ButtonDown
= 6;
213 printf("ScrollBarButtonDown send SB_PAGEDOWN\n");
215 SendMessage(hWndParent
, lphs
->Direction
,
216 SB_PAGEDOWN
, dwOwner
);
219 if ((y
> (lphs
->CurPix
+ width
)) &&
220 (y
< (lphs
->CurPix
+ (width
<< 1)))) {
221 lphs
->ThumbActive
= TRUE
;
223 printf("THUMB DOWN !\n");
228 height
= rect
.bottom
- rect
.top
;
229 if (x
< (lphs
->CurPix
+ height
)) {
231 lphs
->ButtonDown
= 3;
232 CopyRect(&rect2
, &rect
);
233 rect2
.right
= rect2
.left
+ height
;
234 InvalidateRect(lphs
->hWndOwner
, &rect2
, TRUE
);
236 printf("ScrollBarButtonDown send SB_LINEUP\n");
238 SendMessage(hWndParent
, lphs
->Direction
,
242 lphs
->ButtonDown
= 5;
244 printf("ScrollBarButtonDown send SB_PAGEUP\n");
246 SendMessage(hWndParent
, lphs
->Direction
,
250 if (x
> (lphs
->CurPix
+ (height
<< 1))) {
251 if (x
> (rect
.right
- rect
.left
- height
)) {
252 lphs
->ButtonDown
= 4;
253 CopyRect(&rect2
, &rect
);
254 rect2
.left
= rect2
.right
- height
;
255 InvalidateRect(lphs
->hWndOwner
, &rect2
, TRUE
);
257 printf("ScrollBarButtonDown send SB_LINEDOWN\n");
259 SendMessage(hWndParent
, lphs
->Direction
,
260 SB_LINEDOWN
, dwOwner
);
263 lphs
->ButtonDown
= 6;
265 printf("ScrollBarButtonDown send SB_PAGEDOWN\n");
267 SendMessage(hWndParent
, lphs
->Direction
,
268 SB_PAGEDOWN
, dwOwner
);
271 if ((x
> (lphs
->CurPix
+ height
)) &&
272 (x
< (lphs
->CurPix
+ (height
<< 1)))) {
273 lphs
->ThumbActive
= TRUE
;
275 printf("THUMB DOWN !\n");
279 if (lphs
->ButtonDown
!= 0) {
280 UpdateWindow(lphs
->hWndOwner
);
281 if (!lphs
->TimerPending
&& nBar
== SB_CTL
) {
282 lphs
->TimerPending
= TRUE
;
283 SetTimer(lphs
->hWndOwner
, 1, 500, NULL
);
289 void ScrollBarButtonUp(HWND hWnd
, int nBar
, int x
, int y
)
295 printf("ScrollBarButtonUp // x=%d y=%d\n", x
, y
);
297 lphs
= GetScrollObjectStruct(hWnd
, nBar
);
298 lphs
->ThumbActive
= FALSE
;
299 if (lphs
->ButtonDown
!= 0) {
300 lphs
->ButtonDown
= 0;
301 GetClientRect(lphs
->hWndOwner
, &rect
);
302 if (nBar
== SB_CTL
) {
303 InvalidateRect(lphs
->hWndOwner
, &rect
, TRUE
);
304 UpdateWindow(lphs
->hWndOwner
);
307 hDC
= GetWindowDC(lphs
->hWndOwner
);
308 StdDrawScrollBar(lphs
->hWndOwner
, hDC
, nBar
, &lphs
->rect
, lphs
);
309 ReleaseDC(lphs
->hWndOwner
, hDC
);
315 void ScrollBarMouseMove(HWND hWnd
, int nBar
, WORD wParam
, int x
, int y
)
321 if ((wParam
& MK_LBUTTON
) == 0) return;
322 lphs
= GetScrollObjectStruct(hWnd
, nBar
);
323 if (lphs
->ThumbActive
== 0) return;
324 if (nBar
== SB_CTL
) {
325 hWndParent
= GetParent(hWnd
);
326 hWndOwner
= lphs
->hWndOwner
;
328 printf("ScrollBarButtonMove SB_CTL // x=%d y=%d\n", x
, y
);
335 printf("ScrollBarButtonMove SB_?SCROLL // x=%d y=%d\n", x
, y
);
338 if (lphs
->Direction
== WM_VSCROLL
) {
339 int butsiz
= lphs
->rect
.right
- lphs
->rect
.left
;
340 y
= y
- butsiz
- (butsiz
>> 1);
343 int butsiz
= lphs
->rect
.bottom
- lphs
->rect
.top
;
344 y
= x
- butsiz
- (butsiz
>> 1);
346 x
= (y
* (lphs
->MaxVal
- lphs
->MinVal
) /
347 lphs
->MaxPix
) + lphs
->MinVal
;
349 printf("Scroll WM_MOUSEMOVE val=%d pix=%d\n", x
, y
);
351 SendMessage(hWndParent
, lphs
->Direction
,
352 SB_THUMBTRACK
, MAKELONG(x
, hWndOwner
));
356 LPHEADSCROLL
ScrollBarGetWindowAndStorage(HWND hWnd
, WND
**wndPtr
)
360 *(wndPtr
) = Ptr
= WIN_FindWndPtr(hWnd
);
362 printf("Bad Window handle on ScrollBar !\n");
365 lphs
= *((LPHEADSCROLL
*)&Ptr
->wExtra
[1]);
370 LPHEADSCROLL
ScrollBarGetStorageHeader(HWND hWnd
)
374 wndPtr
= WIN_FindWndPtr(hWnd
);
376 printf("Bad Window handle on ScrollBar !\n");
379 lphs
= *((LPHEADSCROLL
*)&wndPtr
->wExtra
[1]);
385 void StdDrawScrollBar(HWND hWnd
, HDC hDC
, int nBar
, LPRECT lprect
, LPHEADSCROLL lphs
)
394 if (lphs
== NULL
) return;
396 if (lphs
->Direction
== WM_VSCROLL
)
397 printf("StdDrawScrollBar Vertical left=%d top=%d right=%d bottom=%d !\n",
398 lprect
->left
, lprect
->top
, lprect
->right
, lprect
->bottom
);
400 printf("StdDrawScrollBar Horizontal left=%d top=%d right=%d bottom=%d !\n",
401 lprect
->left
, lprect
->top
, lprect
->right
, lprect
->bottom
);
404 hWndParent
= GetParent(hWnd
);
406 hWndParent
= lphs
->hWndOwner
;
407 hBrush
= SendMessage(hWndParent
, WM_CTLCOLOR
, (WORD
)hDC
,
408 MAKELONG(hWnd
, CTLCOLOR_SCROLLBAR
));
409 if (hBrush
== (HBRUSH
)NULL
) hBrush
= GetStockObject(LTGRAY_BRUSH
);
410 CopyRect(&lphs
->rect
, lprect
);
411 CopyRect(&rect
, lprect
);
412 w
= rect
.right
- rect
.left
;
413 h
= rect
.bottom
- rect
.top
;
414 if (lphs
->Direction
== WM_VSCROLL
)
415 lphs
->MaxPix
= h
- 3 * w
;
417 lphs
->MaxPix
= w
- 3 * h
;
418 if (lphs
->MaxVal
!= lphs
->MinVal
)
419 lphs
->CurPix
= lphs
->MaxPix
* (abs((short)lphs
->CurVal
) - abs(lphs
->MinVal
)) /
420 (abs(lphs
->MaxVal
) - abs(lphs
->MinVal
));
421 if (lphs
->CurPix
> lphs
->MaxPix
) lphs
->CurPix
= lphs
->MaxPix
;
422 hMemDC
= CreateCompatibleDC(hDC
);
423 if (lphs
->Direction
== WM_VSCROLL
) {
424 GetObject(hUpArrow
, sizeof(BITMAP
), (LPSTR
)&bm
);
425 if (lphs
->ButtonDown
== 1)
426 SelectObject(hMemDC
, hUpArrowD
);
428 SelectObject(hMemDC
, hUpArrow
);
429 StretchBlt(hDC
, rect
.left
, rect
.top
, w
, w
, hMemDC
,
430 0, 0, bm
.bmWidth
, bm
.bmHeight
, SRCCOPY
);
431 GetObject(hDnArrow
, sizeof(BITMAP
), (LPSTR
)&bm
);
432 if (lphs
->ButtonDown
== 2)
433 SelectObject(hMemDC
, hDnArrowD
);
435 SelectObject(hMemDC
, hDnArrow
);
436 StretchBlt(hDC
, rect
.left
, rect
.bottom
- w
, w
, w
, hMemDC
,
437 0, 0, bm
.bmWidth
, bm
.bmHeight
, SRCCOPY
);
442 GetObject(hLfArrow
, sizeof(BITMAP
), (LPSTR
)&bm
);
443 if (lphs
->ButtonDown
== 3)
444 SelectObject(hMemDC
, hLfArrowD
);
446 SelectObject(hMemDC
, hLfArrow
);
447 StretchBlt(hDC
, rect
.left
, rect
.top
, h
, h
, hMemDC
,
448 0, 0, bm
.bmWidth
, bm
.bmHeight
, SRCCOPY
);
449 GetObject(hRgArrow
, sizeof(BITMAP
), (LPSTR
)&bm
);
450 if (lphs
->ButtonDown
== 4)
451 SelectObject(hMemDC
, hRgArrowD
);
453 SelectObject(hMemDC
, hRgArrow
);
454 StretchBlt(hDC
, rect
.right
- h
, rect
.top
, h
, h
, hMemDC
,
455 0, 0, bm
.bmWidth
, bm
.bmHeight
, SRCCOPY
);
460 FillRect(hDC
, &rect
, hBrush
);
461 if (lphs
->Direction
== WM_VSCROLL
)
462 SetRect(&rect
, rect
.left
, rect
.top
+ lphs
->CurPix
,
463 rect
.left
+ w
, rect
.top
+ lphs
->CurPix
+ w
);
465 SetRect(&rect
, rect
.left
+ lphs
->CurPix
, rect
.top
,
466 rect
.left
+ lphs
->CurPix
+ h
, rect
.top
+ h
);
468 if (lphs->Direction == WM_VSCROLL)
469 SetRect(&rect, rect.left, rect.top + lphs->CurPix + w,
470 rect.left + w, rect.top + lphs->CurPix + (w << 1));
472 SetRect(&rect, rect.left + lphs->CurPix + h, rect.top,
473 rect.left + lphs->CurPix + (h << 1), rect.top + h);
475 FrameRect(hDC
, &rect
, GetStockObject(BLACK_BRUSH
));
476 InflateRect(&rect
, -1, -1);
477 FillRect(hDC
, &rect
, GetStockObject(LTGRAY_BRUSH
));
478 DrawReliefRect(hDC
, rect
, 2, 0);
479 InflateRect(&rect
, -3, -3);
480 DrawReliefRect(hDC
, rect
, 1, 1);
485 int CreateScrollBarStruct(HWND hWnd
)
491 wndPtr
= WIN_FindWndPtr(hWnd
);
492 width
= wndPtr
->rectClient
.right
- wndPtr
->rectClient
.left
;
493 height
= wndPtr
->rectClient
.bottom
- wndPtr
->rectClient
.top
;
495 lphs
= AllocScrollBar(WS_VSCROLL
, width
, height
);
497 lphs
= AllocScrollBar(WS_HSCROLL
, width
, height
);
499 printf("CreateScrollBarStruct %lX !\n", lphs
);
501 *((LPHEADSCROLL
*)&wndPtr
->wExtra
[1]) = lphs
;
502 lphs
->hWndOwner
= hWnd
;
503 CopyRect(&lphs
->rect
, &wndPtr
->rectClient
);
509 LPHEADSCROLL
AllocScrollBar(DWORD dwStyle
, int width
, int height
)
512 if (hUpArrow
== (HBITMAP
)NULL
)
513 hUpArrow
= LoadBitmap((HINSTANCE
)NULL
, MAKEINTRESOURCE(OBM_UPARROWI
));
514 if (hDnArrow
== (HBITMAP
)NULL
)
515 hDnArrow
= LoadBitmap((HINSTANCE
)NULL
, MAKEINTRESOURCE(OBM_DNARROWI
));
516 if (hLfArrow
== (HBITMAP
)NULL
)
517 hLfArrow
= LoadBitmap((HINSTANCE
)NULL
, MAKEINTRESOURCE(OBM_LFARROWI
));
518 if (hRgArrow
== (HBITMAP
)NULL
)
519 hRgArrow
= LoadBitmap((HINSTANCE
)NULL
, MAKEINTRESOURCE(OBM_RGARROWI
));
520 if (hUpArrowD
== (HBITMAP
)NULL
)
521 hUpArrowD
= LoadBitmap((HINSTANCE
)NULL
, MAKEINTRESOURCE(OBM_UPARROWD
));
522 if (hDnArrowD
== (HBITMAP
)NULL
)
523 hDnArrowD
= LoadBitmap((HINSTANCE
)NULL
, MAKEINTRESOURCE(OBM_DNARROWD
));
524 if (hLfArrowD
== (HBITMAP
)NULL
)
525 hLfArrowD
= LoadBitmap((HINSTANCE
)NULL
, MAKEINTRESOURCE(OBM_LFARROWD
));
526 if (hRgArrowD
== (HBITMAP
)NULL
)
527 hRgArrowD
= LoadBitmap((HINSTANCE
)NULL
, MAKEINTRESOURCE(OBM_RGARROWD
));
528 lphs
= (LPHEADSCROLL
)malloc(sizeof(HEADSCROLL
));
530 printf("Bad Memory Alloc on ScrollBar !\n");
533 lphs
->ThumbActive
= FALSE
;
534 lphs
->TimerPending
= FALSE
;
535 lphs
->ButtonDown
= 0;
540 if (dwStyle
& WS_VSCROLL
) {
541 lphs
->MaxPix
= height
- 3 * width
;
542 lphs
->Direction
= WM_VSCROLL
;
545 lphs
->MaxPix
= width
- 3 * height
;
546 lphs
->Direction
= WM_HSCROLL
;
548 if (lphs
->MaxPix
< 1) lphs
->MaxPix
= 1;
553 void NC_CreateScrollBars(HWND hWnd
)
559 wndPtr
= WIN_FindWndPtr(hWnd
);
560 width
= wndPtr
->rectClient
.right
- wndPtr
->rectClient
.left
;
561 height
= wndPtr
->rectClient
.bottom
- wndPtr
->rectClient
.top
;
562 if (wndPtr
->dwStyle
& WS_VSCROLL
) {
563 if (wndPtr
->dwStyle
& WS_HSCROLL
) height
-= SYSMETRICS_CYHSCROLL
;
564 lphs
= AllocScrollBar(WS_VSCROLL
, SYSMETRICS_CXVSCROLL
, height
);
566 printf("NC_CreateScrollBars Vertical %lX !\n", lphs
);
568 lphs
->hWndOwner
= hWnd
;
569 wndPtr
->VScroll
= lphs
;
571 if (wndPtr
->dwStyle
& WS_HSCROLL
) {
572 if (wndPtr
->dwStyle
& WS_VSCROLL
) width
-= SYSMETRICS_CYVSCROLL
;
573 lphs
= AllocScrollBar(WS_HSCROLL
, width
, SYSMETRICS_CYHSCROLL
);
575 printf("NC_CreateScrollBars Horizontal %lX !\n", lphs
);
577 lphs
->hWndOwner
= hWnd
;
578 wndPtr
->HScroll
= lphs
;
583 /*************************************************************************
584 * GetScrollObjectStruct [internal]
586 LPHEADSCROLL
GetScrollObjectStruct(HWND hWnd
, int nBar
)
589 if (nBar
!= SB_CTL
) {
590 wndPtr
= WIN_FindWndPtr(hWnd
);
591 if (nBar
== SB_VERT
) return (LPHEADSCROLL
)wndPtr
->VScroll
;
592 if (nBar
== SB_HORZ
) return (LPHEADSCROLL
)wndPtr
->HScroll
;
595 return ScrollBarGetStorageHeader(hWnd
);
599 /*************************************************************************
600 * SetScrollPos [USER.62]
602 int SetScrollPos(HWND hWnd
, int nBar
, int nPos
, BOOL bRedraw
)
607 lphs
= GetScrollObjectStruct(hWnd
, nBar
);
608 if (lphs
== NULL
) return 0;
610 lphs
->CurVal
= (short)nPos
;
611 if (lphs
->MaxVal
!= lphs
->MinVal
)
612 lphs
->CurPix
= lphs
->MaxPix
* (abs((short)nPos
) - abs(lphs
->MinVal
)) /
613 (abs(lphs
->MaxVal
) - abs(lphs
->MinVal
));
614 if (lphs
->CurPix
> lphs
->MaxPix
) lphs
->CurPix
= lphs
->MaxPix
;
616 printf("SetScrollPos val=%d pixval=%d pixmax%d\n",
617 (short)nPos
, lphs
->CurPix
, lphs
->MaxPix
);
618 printf("SetScrollPos min=%d max=%d\n",
619 lphs
->MinVal
, lphs
->MaxVal
);
621 if ((bRedraw
) && (IsWindowVisible(lphs
->hWndOwner
))) {
622 if (nBar
== SB_CTL
) {
623 InvalidateRect(lphs
->hWndOwner
, &lphs
->rect
, TRUE
);
624 UpdateWindow(lphs
->hWndOwner
);
627 if (lphs
->rect
.right
!= 0 && lphs
->rect
.bottom
!= 0) {
628 hDC
= GetWindowDC(lphs
->hWndOwner
);
629 StdDrawScrollBar(lphs
->hWndOwner
, hDC
, nBar
, &lphs
->rect
, lphs
);
630 ReleaseDC(lphs
->hWndOwner
, hDC
);
639 /*************************************************************************
640 * GetScrollPos [USER.63]
642 int GetScrollPos(HWND hWnd
, int nBar
)
645 lphs
= GetScrollObjectStruct(hWnd
, nBar
);
646 if (lphs
== NULL
) return 0;
652 /*************************************************************************
653 * SetScrollRange [USER.64]
655 void SetScrollRange(HWND hWnd
, int nBar
, int MinPos
, int MaxPos
, BOOL bRedraw
)
659 lphs
= GetScrollObjectStruct(hWnd
, nBar
);
660 if (lphs
== NULL
) return;
661 lphs
->MinVal
= (short)MinPos
;
662 lphs
->MaxVal
= (short)MaxPos
;
663 if (lphs
->MaxVal
!= lphs
->MinVal
)
664 lphs
->CurPix
= abs(lphs
->MaxVal
) *
665 (abs(lphs
->CurVal
) - abs(lphs
->MinVal
)) /
666 (abs(lphs
->MaxVal
) - abs(lphs
->MinVal
));
667 if (lphs
->CurPix
> lphs
->MaxPix
) lphs
->CurPix
= lphs
->MaxPix
;
669 printf("SetScrollRange min=%d max=%d\n", lphs
->MinVal
, lphs
->MaxVal
);
671 if ((bRedraw
) && (IsWindowVisible(lphs
->hWndOwner
))) {
672 if (nBar
== SB_CTL
) {
673 InvalidateRect(lphs
->hWndOwner
, &lphs
->rect
, TRUE
);
674 UpdateWindow(lphs
->hWndOwner
);
677 if (lphs
->rect
.right
!= 0 && lphs
->rect
.bottom
!= 0) {
678 hDC
= GetWindowDC(lphs
->hWndOwner
);
679 StdDrawScrollBar(lphs
->hWndOwner
, hDC
, nBar
, &lphs
->rect
, lphs
);
680 ReleaseDC(lphs
->hWndOwner
, hDC
);
688 /*************************************************************************
689 * GetScrollRange [USER.65]
691 void GetScrollRange(HWND hWnd
, int nBar
, LPINT lpMin
, LPINT lpMax
)
694 lphs
= GetScrollObjectStruct(hWnd
, nBar
);
695 if (lphs
== NULL
) return;
696 *lpMin
= lphs
->MinVal
;
697 *lpMax
= lphs
->MaxVal
;
702 /*************************************************************************
703 * ShowScrollBar [USER.267]
705 void ShowScrollBar(HWND hWnd
, WORD wBar
, BOOL bFlag
)
709 printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd
, wBar
, bFlag
);
711 if (wBar
== SB_CTL
) {
713 ShowWindow(hWnd
, SW_SHOW
);
715 ShowWindow(hWnd
, SW_HIDE
);
718 wndPtr
= WIN_FindWndPtr(hWnd
);
720 if ((wBar == SB_VERT) || (wBar == SB_BOTH)) {
722 wndPtr->dwStyle |= WS_VSCROLL;
724 wndPtr->dwStyle &= 0xFFFFFFFFL ^ WS_VSCROLL;
726 if ((wBar == SB_HORZ) || (wBar == SB_BOTH)) {
728 wndPtr->dwStyle |= WS_HSCROLL;
730 wndPtr->dwStyle &= 0xFFFFFFFFL ^ WS_HSCROLL;