4 * Copyright 1997, 2002 Dimitrie O. Paun
5 * Copyright 1998, 1999 Eric Kohl
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * This code was audited for completeness against the documented features
24 * of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun.
26 * Unless otherwise noted, we believe this code to be complete, as per
27 * the specification mentioned above.
28 * If you discover missing features, or bugs, please note them below.
43 #include "wine/debug.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(progress
);
49 HWND Self
; /* The window handle for this control */
50 INT CurVal
; /* Current progress value */
51 INT MinVal
; /* Minimum progress value */
52 INT MaxVal
; /* Maximum progress value */
53 INT Step
; /* Step to use on PMB_STEPIT */
54 INT MarqueePos
; /* Marquee animation position */
55 BOOL Marquee
; /* Whether the marquee animation is enabled */
56 COLORREF ColorBar
; /* Bar color */
57 COLORREF ColorBk
; /* Background color */
58 HFONT Font
; /* Handle to font (not unused) */
61 /* Control configuration constants */
64 #define MARQUEE_LEDS 5
65 #define ID_MARQUEE_TIMER 1
67 /* Helper to obtain size of a progress bar chunk ("led"). */
68 static inline int get_led_size ( const PROGRESS_INFO
*infoPtr
, LONG style
,
71 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
75 if (SUCCEEDED( GetThemeInt( theme
, 0, 0, TMT_PROGRESSCHUNKSIZE
, &chunkSize
)))
79 if (style
& PBS_VERTICAL
)
80 return MulDiv (rect
->right
- rect
->left
, 2, 3);
82 return MulDiv (rect
->bottom
- rect
->top
, 2, 3);
85 /* Helper to obtain gap between progress bar chunks */
86 static inline int get_led_gap ( const PROGRESS_INFO
*infoPtr
)
88 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
92 if (SUCCEEDED( GetThemeInt( theme
, 0, 0, TMT_PROGRESSSPACESIZE
, &spaceSize
)))
99 /* Get client rect. Takes into account that theming needs no adjustment. */
100 static inline void get_client_rect (HWND hwnd
, RECT
* rect
)
102 HTHEME theme
= GetWindowTheme (hwnd
);
103 GetClientRect (hwnd
, rect
);
105 InflateRect(rect
, -1, -1);
108 DWORD dwStyle
= GetWindowLongW (hwnd
, GWL_STYLE
);
109 int part
= (dwStyle
& PBS_VERTICAL
) ? PP_BARVERT
: PP_BAR
;
110 GetThemeBackgroundContentRect (theme
, 0, part
, 0, rect
, rect
);
114 /* Compute the extend of the bar */
115 static inline int get_bar_size( LONG style
, const RECT
* rect
)
117 if (style
& PBS_VERTICAL
)
118 return rect
->bottom
- rect
->top
;
120 return rect
->right
- rect
->left
;
123 /* Compute the pixel position of a progress value */
124 static inline int get_bar_position( const PROGRESS_INFO
*infoPtr
, LONG style
,
125 const RECT
* rect
, INT value
)
127 return MulDiv (value
- infoPtr
->MinVal
, get_bar_size (style
, rect
),
128 infoPtr
->MaxVal
- infoPtr
->MinVal
);
131 /***********************************************************************
132 * PROGRESS_Invalidate
134 * Don't be too clever about invalidating the progress bar.
135 * InstallShield depends on this simple behaviour.
137 static void PROGRESS_Invalidate( const PROGRESS_INFO
*infoPtr
, INT old
, INT
new )
139 InvalidateRect( infoPtr
->Self
, NULL
, old
> new );
142 /* Information for a progress bar drawing helper */
143 typedef struct tagProgressDrawInfo
154 typedef void (*ProgressDrawProc
)(const ProgressDrawInfo
* di
, int start
, int end
);
156 /* draw solid horizontal bar from 'start' to 'end' */
157 static void draw_solid_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
160 r
.left
= di
->rect
.left
+ start
;
161 r
.top
= di
->rect
.top
;
162 r
.right
= di
->rect
.left
+ end
;
163 r
.bottom
= di
->rect
.bottom
;
164 FillRect (di
->hdc
, &r
, di
->hbrBar
);
167 /* draw solid horizontal background from 'start' to 'end' */
168 static void draw_solid_bkg_H (const ProgressDrawInfo
* di
, int start
, int end
)
171 r
.left
= di
->rect
.left
+ start
;
172 r
.top
= di
->rect
.top
;
173 r
.right
= di
->rect
.left
+ end
;
174 r
.bottom
= di
->rect
.bottom
;
175 FillRect (di
->hdc
, &r
, di
->hbrBk
);
178 /* draw solid vertical bar from 'start' to 'end' */
179 static void draw_solid_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
182 r
.left
= di
->rect
.left
;
183 r
.top
= di
->rect
.bottom
- end
;
184 r
.right
= di
->rect
.right
;
185 r
.bottom
= di
->rect
.bottom
- start
;
186 FillRect (di
->hdc
, &r
, di
->hbrBar
);
189 /* draw solid vertical background from 'start' to 'end' */
190 static void draw_solid_bkg_V (const ProgressDrawInfo
* di
, int start
, int end
)
193 r
.left
= di
->rect
.left
;
194 r
.top
= di
->rect
.bottom
- end
;
195 r
.right
= di
->rect
.right
;
196 r
.bottom
= di
->rect
.bottom
- start
;
197 FillRect (di
->hdc
, &r
, di
->hbrBk
);
200 /* draw chunky horizontal bar from 'start' to 'end' */
201 static void draw_chunk_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
204 int right
= di
->rect
.left
+ end
;
205 r
.left
= di
->rect
.left
+ start
;
206 r
.top
= di
->rect
.top
;
207 r
.bottom
= di
->rect
.bottom
;
208 while (r
.left
< right
)
210 r
.right
= min (r
.left
+ di
->ledW
, right
);
211 FillRect (di
->hdc
, &r
, di
->hbrBar
);
213 r
.right
= min (r
.left
+ di
->ledGap
, right
);
214 FillRect (di
->hdc
, &r
, di
->hbrBk
);
219 /* draw chunky vertical bar from 'start' to 'end' */
220 static void draw_chunk_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
223 int top
= di
->rect
.bottom
- end
;
224 r
.left
= di
->rect
.left
;
225 r
.right
= di
->rect
.right
;
226 r
.bottom
= di
->rect
.bottom
- start
;
227 while (r
.bottom
> top
)
229 r
.top
= max (r
.bottom
- di
->ledW
, top
);
230 FillRect (di
->hdc
, &r
, di
->hbrBar
);
232 r
.top
= max (r
.bottom
- di
->ledGap
, top
);
233 FillRect (di
->hdc
, &r
, di
->hbrBk
);
238 /* drawing functions for "classic" style */
239 static const ProgressDrawProc drawProcClassic
[8] = {
242 draw_solid_bar_H
, draw_solid_bkg_H
,
244 draw_solid_bar_V
, draw_solid_bkg_V
,
247 draw_chunk_bar_H
, draw_solid_bkg_H
,
249 draw_chunk_bar_V
, draw_solid_bkg_V
,
252 /* draw themed horizontal bar from 'start' to 'end' */
253 static void draw_theme_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
256 int right
= di
->rect
.left
+ end
;
257 r
.left
= di
->rect
.left
+ start
;
258 r
.top
= di
->rect
.top
;
259 r
.bottom
= di
->rect
.bottom
;
260 while (r
.left
< right
)
262 r
.right
= min (r
.left
+ di
->ledW
, right
);
263 DrawThemeBackground (di
->theme
, di
->hdc
, PP_CHUNK
, 0, &r
, NULL
);
265 r
.right
= min (r
.left
+ di
->ledGap
, right
);
266 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BAR
, 0, &di
->bgRect
, &r
);
271 /* draw themed horizontal bar from 'start' to 'end' */
272 static void draw_theme_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
275 int top
= di
->rect
.bottom
- end
;
276 r
.left
= di
->rect
.left
;
277 r
.right
= di
->rect
.right
;
278 r
.bottom
= di
->rect
.bottom
- start
;
279 while (r
.bottom
> top
)
281 r
.top
= max (r
.bottom
- di
->ledW
, top
);
282 DrawThemeBackground (di
->theme
, di
->hdc
, PP_CHUNKVERT
, 0, &r
, NULL
);
284 r
.top
= max (r
.bottom
- di
->ledGap
, top
);
285 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BARVERT
, 0, &di
->bgRect
, &r
);
290 /* draw themed horizontal background from 'start' to 'end' */
291 static void draw_theme_bkg_H (const ProgressDrawInfo
* di
, int start
, int end
)
294 r
.left
= di
->rect
.left
+ start
;
295 r
.top
= di
->rect
.top
;
296 r
.right
= di
->rect
.left
+ end
;
297 r
.bottom
= di
->rect
.bottom
;
298 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BAR
, 0, &di
->bgRect
, &r
);
301 /* draw themed vertical background from 'start' to 'end' */
302 static void draw_theme_bkg_V (const ProgressDrawInfo
* di
, int start
, int end
)
305 r
.left
= di
->rect
.left
;
306 r
.top
= di
->rect
.bottom
- end
;
307 r
.right
= di
->rect
.right
;
308 r
.bottom
= di
->rect
.bottom
- start
;
309 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BARVERT
, 0, &di
->bgRect
, &r
);
312 /* drawing functions for themed style */
313 static const ProgressDrawProc drawProcThemed
[8] = {
316 draw_theme_bar_H
, draw_theme_bkg_H
,
318 draw_theme_bar_V
, draw_theme_bkg_V
,
321 draw_theme_bar_H
, draw_theme_bkg_H
,
323 draw_theme_bar_V
, draw_theme_bkg_V
,
326 /***********************************************************************
328 * Draws the progress bar.
330 static LRESULT
PROGRESS_Draw (PROGRESS_INFO
*infoPtr
, HDC hdc
)
335 const ProgressDrawProc
* drawProcs
;
336 ProgressDrawInfo pdi
;
338 TRACE("(infoPtr=%p, hdc=%p)\n", infoPtr
, hdc
);
341 pdi
.theme
= GetWindowTheme (infoPtr
->Self
);
343 /* get the required bar brush */
344 if (infoPtr
->ColorBar
== CLR_DEFAULT
)
345 pdi
.hbrBar
= GetSysColorBrush(COLOR_HIGHLIGHT
);
347 pdi
.hbrBar
= CreateSolidBrush (infoPtr
->ColorBar
);
349 if (infoPtr
->ColorBk
== CLR_DEFAULT
)
350 pdi
.hbrBk
= GetSysColorBrush(COLOR_3DFACE
);
352 pdi
.hbrBk
= CreateSolidBrush(infoPtr
->ColorBk
);
354 /* get the window style */
355 dwStyle
= GetWindowLongW (infoPtr
->Self
, GWL_STYLE
);
357 /* get client rectangle */
358 GetClientRect (infoPtr
->Self
, &pdi
.rect
);
360 FrameRect( hdc
, &pdi
.rect
, pdi
.hbrBk
);
361 InflateRect(&pdi
.rect
, -1, -1);
366 int part
= (dwStyle
& PBS_VERTICAL
) ? PP_BARVERT
: PP_BAR
;
368 GetThemeBackgroundContentRect (pdi
.theme
, hdc
, part
, 0, &pdi
.rect
,
371 /* Exclude content rect - content background will be drawn later */
372 ExcludeClipRect (hdc
, cntRect
.left
, cntRect
.top
,
373 cntRect
.right
, cntRect
.bottom
);
374 if (IsThemeBackgroundPartiallyTransparent (pdi
.theme
, part
, 0))
375 DrawThemeParentBackground (infoPtr
->Self
, hdc
, NULL
);
376 DrawThemeBackground (pdi
.theme
, hdc
, part
, 0, &pdi
.rect
, NULL
);
377 SelectClipRgn (hdc
, NULL
);
378 CopyRect (&pdi
.rect
, &cntRect
);
381 /* compute some drawing parameters */
382 barSmooth
= (dwStyle
& PBS_SMOOTH
) && !pdi
.theme
;
383 drawProcs
= &((pdi
.theme
? drawProcThemed
: drawProcClassic
)[(barSmooth
? 0 : 4)
384 + ((dwStyle
& PBS_VERTICAL
) ? 2 : 0)]);
385 barSize
= get_bar_size( dwStyle
, &pdi
.rect
);
388 GetWindowRect( infoPtr
->Self
, &pdi
.bgRect
);
389 ScreenToClient( infoPtr
->Self
, (POINT
*)&pdi
.bgRect
);
390 ScreenToClient( infoPtr
->Self
, (POINT
*)&pdi
.bgRect
.right
);
394 pdi
.ledW
= get_led_size( infoPtr
, dwStyle
, &pdi
.rect
);
395 pdi
.ledGap
= get_led_gap( infoPtr
);
397 if (dwStyle
& PBS_MARQUEE
)
399 const int ledW
= !barSmooth
? (pdi
.ledW
+ pdi
.ledGap
) : 1;
400 const int leds
= (barSize
+ ledW
- 1) / ledW
;
401 const int ledMEnd
= infoPtr
->MarqueePos
+ MARQUEE_LEDS
;
405 /* case 1: the marquee bar extends over the end and wraps around to
407 const int gapStart
= max((ledMEnd
- leds
) * ledW
, 0);
408 const int gapEnd
= min(infoPtr
->MarqueePos
* ledW
, barSize
);
410 drawProcs
[0]( &pdi
, 0, gapStart
);
411 drawProcs
[1]( &pdi
, gapStart
, gapEnd
);
412 drawProcs
[0]( &pdi
, gapEnd
, barSize
);
416 /* case 2: the marquee bar is between start and end */
417 const int barStart
= infoPtr
->MarqueePos
* ledW
;
418 const int barEnd
= min (ledMEnd
* ledW
, barSize
);
420 drawProcs
[1]( &pdi
, 0, barStart
);
421 drawProcs
[0]( &pdi
, barStart
, barEnd
);
422 drawProcs
[1]( &pdi
, barEnd
, barSize
);
427 int barEnd
= get_bar_position( infoPtr
, dwStyle
, &pdi
.rect
,
431 const int ledW
= pdi
.ledW
+ pdi
.ledGap
;
432 barEnd
= min (((barEnd
+ ledW
- 1) / ledW
) * ledW
, barSize
);
434 drawProcs
[0]( &pdi
, 0, barEnd
);
435 drawProcs
[1]( &pdi
, barEnd
, barSize
);
438 /* delete bar brush */
439 if (infoPtr
->ColorBar
!= CLR_DEFAULT
) DeleteObject (pdi
.hbrBar
);
440 if (infoPtr
->ColorBk
!= CLR_DEFAULT
) DeleteObject (pdi
.hbrBk
);
445 /***********************************************************************
447 * Draw the progress bar. The background need not be erased.
448 * If dc!=0, it draws on it
450 static LRESULT
PROGRESS_Paint (PROGRESS_INFO
*infoPtr
, HDC hdc
)
453 if (hdc
) return PROGRESS_Draw (infoPtr
, hdc
);
454 hdc
= BeginPaint (infoPtr
->Self
, &ps
);
455 PROGRESS_Draw (infoPtr
, hdc
);
456 EndPaint (infoPtr
->Self
, &ps
);
461 /***********************************************************************
463 * Handle the marquee timer messages
465 static LRESULT
PROGRESS_Timer (PROGRESS_INFO
*infoPtr
, INT idTimer
)
467 if(idTimer
== ID_MARQUEE_TIMER
)
469 LONG style
= GetWindowLongW (infoPtr
->Self
, GWL_STYLE
);
472 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
473 BOOL barSmooth
= (style
& PBS_SMOOTH
) && !theme
;
475 get_client_rect (infoPtr
->Self
, &rect
);
478 ledWidth
= get_led_size( infoPtr
, style
, &rect
) +
479 get_led_gap( infoPtr
);
483 leds
= (get_bar_size( style
, &rect
) + ledWidth
- 1) /
486 /* increment the marquee progress */
487 if(++infoPtr
->MarqueePos
>= leds
)
489 infoPtr
->MarqueePos
= 0;
492 InvalidateRect(infoPtr
->Self
, &rect
, FALSE
);
493 UpdateWindow(infoPtr
->Self
);
499 /***********************************************************************
501 * Makes sure the current position (CurVal) is within bounds.
503 static void PROGRESS_CoercePos(PROGRESS_INFO
*infoPtr
)
505 if(infoPtr
->CurVal
< infoPtr
->MinVal
)
506 infoPtr
->CurVal
= infoPtr
->MinVal
;
507 if(infoPtr
->CurVal
> infoPtr
->MaxVal
)
508 infoPtr
->CurVal
= infoPtr
->MaxVal
;
512 /***********************************************************************
514 * Set new Font for progress bar
516 static HFONT
PROGRESS_SetFont (PROGRESS_INFO
*infoPtr
, HFONT hFont
, BOOL bRedraw
)
518 HFONT hOldFont
= infoPtr
->Font
;
519 infoPtr
->Font
= hFont
;
520 /* Since infoPtr->Font is not used, there is no need for repaint */
524 static DWORD
PROGRESS_SetRange (PROGRESS_INFO
*infoPtr
, int low
, int high
)
526 DWORD res
= MAKELONG(LOWORD(infoPtr
->MinVal
), LOWORD(infoPtr
->MaxVal
));
528 /* if nothing changes, simply return */
529 if(infoPtr
->MinVal
== low
&& infoPtr
->MaxVal
== high
) return res
;
531 infoPtr
->MinVal
= low
;
532 infoPtr
->MaxVal
= high
;
533 PROGRESS_CoercePos(infoPtr
);
534 InvalidateRect(infoPtr
->Self
, NULL
, TRUE
);
538 /***********************************************************************
541 static LRESULT WINAPI
ProgressWindowProc(HWND hwnd
, UINT message
,
542 WPARAM wParam
, LPARAM lParam
)
544 PROGRESS_INFO
*infoPtr
;
545 static const WCHAR themeClass
[] = {'P','r','o','g','r','e','s','s',0};
548 TRACE("hwnd=%p msg=%04x wparam=%lx lParam=%lx\n", hwnd
, message
, wParam
, lParam
);
550 infoPtr
= (PROGRESS_INFO
*)GetWindowLongPtrW(hwnd
, 0);
552 if (!infoPtr
&& message
!= WM_CREATE
)
553 return DefWindowProcW( hwnd
, message
, wParam
, lParam
);
558 DWORD dwExStyle
= GetWindowLongW (hwnd
, GWL_EXSTYLE
);
560 theme
= OpenThemeData (hwnd
, themeClass
);
562 dwExStyle
&= ~(WS_EX_CLIENTEDGE
| WS_EX_WINDOWEDGE
);
563 if (!theme
) dwExStyle
|= WS_EX_STATICEDGE
;
564 SetWindowLongW (hwnd
, GWL_EXSTYLE
, dwExStyle
);
565 /* Force recalculation of a non-client area */
566 SetWindowPos(hwnd
, 0, 0, 0, 0, 0,
567 SWP_FRAMECHANGED
| SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
569 /* allocate memory for info struct */
570 infoPtr
= (PROGRESS_INFO
*)Alloc (sizeof(PROGRESS_INFO
));
571 if (!infoPtr
) return -1;
572 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
574 /* initialize the info struct */
575 infoPtr
->Self
= hwnd
;
577 infoPtr
->MaxVal
= 100;
580 infoPtr
->MarqueePos
= 0;
581 infoPtr
->Marquee
= FALSE
;
582 infoPtr
->ColorBar
= CLR_DEFAULT
;
583 infoPtr
->ColorBk
= CLR_DEFAULT
;
586 TRACE("Progress Ctrl creation, hwnd=%p\n", hwnd
);
591 TRACE("Progress Ctrl destruction, hwnd=%p\n", hwnd
);
593 SetWindowLongPtrW(hwnd
, 0, 0);
594 theme
= GetWindowTheme (hwnd
);
595 CloseThemeData (theme
);
602 return (LRESULT
)infoPtr
->Font
;
605 return (LRESULT
)PROGRESS_SetFont(infoPtr
, (HFONT
)wParam
, (BOOL
)lParam
);
609 return PROGRESS_Paint (infoPtr
, (HDC
)wParam
);
612 return PROGRESS_Timer (infoPtr
, (INT
)wParam
);
614 case WM_THEMECHANGED
:
616 DWORD dwExStyle
= GetWindowLongW (hwnd
, GWL_EXSTYLE
);
618 theme
= GetWindowTheme (hwnd
);
619 CloseThemeData (theme
);
620 theme
= OpenThemeData (hwnd
, themeClass
);
622 /* WS_EX_STATICEDGE disappears when the control is themed */
624 dwExStyle
&= ~WS_EX_STATICEDGE
;
626 dwExStyle
|= WS_EX_STATICEDGE
;
627 SetWindowLongW (hwnd
, GWL_EXSTYLE
, dwExStyle
);
629 InvalidateRect (hwnd
, NULL
, FALSE
);
636 oldVal
= infoPtr
->CurVal
;
638 infoPtr
->CurVal
+= (INT
)wParam
;
639 PROGRESS_CoercePos (infoPtr
);
640 TRACE("PBM_DELTAPOS: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
641 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
642 UpdateWindow( infoPtr
->Self
);
650 oldVal
= infoPtr
->CurVal
;
651 if(oldVal
!= wParam
) {
652 infoPtr
->CurVal
= (INT
)wParam
;
653 PROGRESS_CoercePos(infoPtr
);
654 TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
655 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
656 UpdateWindow( infoPtr
->Self
);
662 return PROGRESS_SetRange (infoPtr
, (int)LOWORD(lParam
), (int)HIWORD(lParam
));
667 oldStep
= infoPtr
->Step
;
668 infoPtr
->Step
= (INT
)wParam
;
675 oldVal
= infoPtr
->CurVal
;
676 infoPtr
->CurVal
+= infoPtr
->Step
;
677 if(infoPtr
->CurVal
> infoPtr
->MaxVal
)
678 infoPtr
->CurVal
= infoPtr
->MinVal
;
679 if(oldVal
!= infoPtr
->CurVal
)
681 TRACE("PBM_STEPIT: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
682 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
683 UpdateWindow( infoPtr
->Self
);
689 return PROGRESS_SetRange (infoPtr
, (int)wParam
, (int)lParam
);
693 ((PPBRANGE
)lParam
)->iLow
= infoPtr
->MinVal
;
694 ((PPBRANGE
)lParam
)->iHigh
= infoPtr
->MaxVal
;
696 return wParam
? infoPtr
->MinVal
: infoPtr
->MaxVal
;
699 return infoPtr
->CurVal
;
701 case PBM_SETBARCOLOR
:
702 infoPtr
->ColorBar
= (COLORREF
)lParam
;
703 InvalidateRect(hwnd
, NULL
, TRUE
);
707 infoPtr
->ColorBk
= (COLORREF
)lParam
;
708 InvalidateRect(hwnd
, NULL
, TRUE
);
714 infoPtr
->Marquee
= TRUE
;
715 SetTimer(infoPtr
->Self
, ID_MARQUEE_TIMER
, (UINT
)lParam
, NULL
);
719 infoPtr
->Marquee
= FALSE
;
720 KillTimer(infoPtr
->Self
, ID_MARQUEE_TIMER
);
722 return infoPtr
->Marquee
;
725 if ((message
>= WM_USER
) && (message
< WM_APP
) && !COMCTL32_IsReflectedMessage(message
))
726 ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message
, wParam
, lParam
);
727 return DefWindowProcW( hwnd
, message
, wParam
, lParam
);
732 /***********************************************************************
733 * PROGRESS_Register [Internal]
735 * Registers the progress bar window class.
737 void PROGRESS_Register (void)
741 ZeroMemory (&wndClass
, sizeof(wndClass
));
742 wndClass
.style
= CS_GLOBALCLASS
| CS_VREDRAW
| CS_HREDRAW
;
743 wndClass
.lpfnWndProc
= (WNDPROC
)ProgressWindowProc
;
744 wndClass
.cbClsExtra
= 0;
745 wndClass
.cbWndExtra
= sizeof (PROGRESS_INFO
*);
746 wndClass
.hCursor
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
747 wndClass
.lpszClassName
= PROGRESS_CLASSW
;
749 RegisterClassW (&wndClass
);
753 /***********************************************************************
754 * PROGRESS_Unregister [Internal]
756 * Unregisters the progress bar window class.
758 void PROGRESS_Unregister (void)
760 UnregisterClassW (PROGRESS_CLASSW
, NULL
);