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.
33 * -- PBS_SMOOTHREVERSE
48 #include "wine/debug.h"
50 WINE_DEFAULT_DEBUG_CHANNEL(progress
);
54 HWND Self
; /* The window handle for this control */
55 INT CurVal
; /* Current progress value */
56 INT MinVal
; /* Minimum progress value */
57 INT MaxVal
; /* Maximum progress value */
58 INT Step
; /* Step to use on PMB_STEPIT */
59 INT MarqueePos
; /* Marquee animation position */
60 BOOL Marquee
; /* Whether the marquee animation is enabled */
61 COLORREF ColorBar
; /* Bar color */
62 COLORREF ColorBk
; /* Background color */
63 HFONT Font
; /* Handle to font (not unused) */
66 /* Control configuration constants */
69 #define MARQUEE_LEDS 5
70 #define ID_MARQUEE_TIMER 1
71 #define DEFAULT_MARQUEE_PERIOD 30
73 /* Helper to obtain size of a progress bar chunk ("led"). */
74 static inline int get_led_size ( const PROGRESS_INFO
*infoPtr
, LONG style
,
77 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
81 if (SUCCEEDED( GetThemeInt( theme
, 0, 0, TMT_PROGRESSCHUNKSIZE
, &chunkSize
)))
85 if (style
& PBS_VERTICAL
)
86 return MulDiv (rect
->right
- rect
->left
, 2, 3);
88 return MulDiv (rect
->bottom
- rect
->top
, 2, 3);
91 /* Helper to obtain gap between progress bar chunks */
92 static inline int get_led_gap ( const PROGRESS_INFO
*infoPtr
)
94 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
98 if (SUCCEEDED( GetThemeInt( theme
, 0, 0, TMT_PROGRESSSPACESIZE
, &spaceSize
)))
105 /* Get client rect. Takes into account that theming needs no adjustment. */
106 static inline void get_client_rect (HWND hwnd
, RECT
* rect
)
108 HTHEME theme
= GetWindowTheme (hwnd
);
109 GetClientRect (hwnd
, rect
);
111 InflateRect(rect
, -1, -1);
114 DWORD dwStyle
= GetWindowLongW (hwnd
, GWL_STYLE
);
115 int part
= (dwStyle
& PBS_VERTICAL
) ? PP_BARVERT
: PP_BAR
;
116 GetThemeBackgroundContentRect (theme
, 0, part
, 0, rect
, rect
);
120 /* Compute the extend of the bar */
121 static inline int get_bar_size( LONG style
, const RECT
* rect
)
123 if (style
& PBS_VERTICAL
)
124 return rect
->bottom
- rect
->top
;
126 return rect
->right
- rect
->left
;
129 /* Compute the pixel position of a progress value */
130 static inline int get_bar_position( const PROGRESS_INFO
*infoPtr
, LONG style
,
131 const RECT
* rect
, INT value
)
133 return MulDiv (value
- infoPtr
->MinVal
, get_bar_size (style
, rect
),
134 infoPtr
->MaxVal
- infoPtr
->MinVal
);
137 /***********************************************************************
138 * PROGRESS_Invalidate
140 * Don't be too clever about invalidating the progress bar.
141 * InstallShield depends on this simple behaviour.
143 static void PROGRESS_Invalidate( const PROGRESS_INFO
*infoPtr
, INT old
, INT
new )
145 InvalidateRect( infoPtr
->Self
, NULL
, old
> new );
148 /* Information for a progress bar drawing helper */
149 typedef struct tagProgressDrawInfo
160 typedef void (*ProgressDrawProc
)(const ProgressDrawInfo
* di
, int start
, int end
);
162 /* draw solid horizontal bar from 'start' to 'end' */
163 static void draw_solid_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
166 r
.left
= di
->rect
.left
+ start
;
167 r
.top
= di
->rect
.top
;
168 r
.right
= di
->rect
.left
+ end
;
169 r
.bottom
= di
->rect
.bottom
;
170 FillRect (di
->hdc
, &r
, di
->hbrBar
);
173 /* draw solid horizontal background from 'start' to 'end' */
174 static void draw_solid_bkg_H (const ProgressDrawInfo
* di
, int start
, int end
)
177 r
.left
= di
->rect
.left
+ start
;
178 r
.top
= di
->rect
.top
;
179 r
.right
= di
->rect
.left
+ end
;
180 r
.bottom
= di
->rect
.bottom
;
181 FillRect (di
->hdc
, &r
, di
->hbrBk
);
184 /* draw solid vertical bar from 'start' to 'end' */
185 static void draw_solid_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
188 r
.left
= di
->rect
.left
;
189 r
.top
= di
->rect
.bottom
- end
;
190 r
.right
= di
->rect
.right
;
191 r
.bottom
= di
->rect
.bottom
- start
;
192 FillRect (di
->hdc
, &r
, di
->hbrBar
);
195 /* draw solid vertical background from 'start' to 'end' */
196 static void draw_solid_bkg_V (const ProgressDrawInfo
* di
, int start
, int end
)
199 r
.left
= di
->rect
.left
;
200 r
.top
= di
->rect
.bottom
- end
;
201 r
.right
= di
->rect
.right
;
202 r
.bottom
= di
->rect
.bottom
- start
;
203 FillRect (di
->hdc
, &r
, di
->hbrBk
);
206 /* draw chunky horizontal bar from 'start' to 'end' */
207 static void draw_chunk_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
210 int right
= di
->rect
.left
+ end
;
211 r
.left
= di
->rect
.left
+ start
;
212 r
.top
= di
->rect
.top
;
213 r
.bottom
= di
->rect
.bottom
;
214 while (r
.left
< right
)
216 r
.right
= min (r
.left
+ di
->ledW
, right
);
217 FillRect (di
->hdc
, &r
, di
->hbrBar
);
219 r
.right
= min (r
.left
+ di
->ledGap
, right
);
220 FillRect (di
->hdc
, &r
, di
->hbrBk
);
225 /* draw chunky vertical bar from 'start' to 'end' */
226 static void draw_chunk_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
229 int top
= di
->rect
.bottom
- end
;
230 r
.left
= di
->rect
.left
;
231 r
.right
= di
->rect
.right
;
232 r
.bottom
= di
->rect
.bottom
- start
;
233 while (r
.bottom
> top
)
235 r
.top
= max (r
.bottom
- di
->ledW
, top
);
236 FillRect (di
->hdc
, &r
, di
->hbrBar
);
238 r
.top
= max (r
.bottom
- di
->ledGap
, top
);
239 FillRect (di
->hdc
, &r
, di
->hbrBk
);
244 /* drawing functions for "classic" style */
245 static const ProgressDrawProc drawProcClassic
[8] = {
248 draw_solid_bar_H
, draw_solid_bkg_H
,
250 draw_solid_bar_V
, draw_solid_bkg_V
,
253 draw_chunk_bar_H
, draw_solid_bkg_H
,
255 draw_chunk_bar_V
, draw_solid_bkg_V
,
258 /* draw themed horizontal bar from 'start' to 'end' */
259 static void draw_theme_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
262 r
.left
= di
->rect
.left
+ start
;
263 r
.top
= di
->rect
.top
;
264 r
.bottom
= di
->rect
.bottom
;
265 r
.right
= di
->rect
.left
+ end
;
266 DrawThemeBackground (di
->theme
, di
->hdc
, PP_CHUNK
, 0, &r
, NULL
);
269 /* draw themed vertical bar from 'start' to 'end' */
270 static void draw_theme_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
273 r
.left
= di
->rect
.left
;
274 r
.right
= di
->rect
.right
;
275 r
.bottom
= di
->rect
.bottom
- start
;
276 r
.top
= di
->rect
.bottom
- end
;
277 DrawThemeBackground (di
->theme
, di
->hdc
, PP_CHUNKVERT
, 0, &r
, NULL
);
280 /* draw themed horizontal background from 'start' to 'end' */
281 static void draw_theme_bkg_H (const ProgressDrawInfo
* di
, int start
, int end
)
284 r
.left
= di
->rect
.left
+ start
;
285 r
.top
= di
->rect
.top
;
286 r
.right
= di
->rect
.left
+ end
;
287 r
.bottom
= di
->rect
.bottom
;
288 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BAR
, 0, &di
->bgRect
, &r
);
291 /* draw themed vertical background from 'start' to 'end' */
292 static void draw_theme_bkg_V (const ProgressDrawInfo
* di
, int start
, int end
)
295 r
.left
= di
->rect
.left
;
296 r
.top
= di
->rect
.bottom
- end
;
297 r
.right
= di
->rect
.right
;
298 r
.bottom
= di
->rect
.bottom
- start
;
299 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BARVERT
, 0, &di
->bgRect
, &r
);
302 /* drawing functions for themed style */
303 static const ProgressDrawProc drawProcThemed
[8] = {
306 draw_theme_bar_H
, draw_theme_bkg_H
,
308 draw_theme_bar_V
, draw_theme_bkg_V
,
311 draw_theme_bar_H
, draw_theme_bkg_H
,
313 draw_theme_bar_V
, draw_theme_bkg_V
,
316 /***********************************************************************
318 * Draws the progress bar.
320 static LRESULT
PROGRESS_Draw (PROGRESS_INFO
*infoPtr
, HDC hdc
)
325 const ProgressDrawProc
* drawProcs
;
326 ProgressDrawInfo pdi
;
328 TRACE("(infoPtr=%p, hdc=%p)\n", infoPtr
, hdc
);
331 pdi
.theme
= GetWindowTheme (infoPtr
->Self
);
333 /* get the required bar brush */
334 if (infoPtr
->ColorBar
== CLR_DEFAULT
)
335 pdi
.hbrBar
= GetSysColorBrush(COLOR_HIGHLIGHT
);
337 pdi
.hbrBar
= CreateSolidBrush (infoPtr
->ColorBar
);
339 if (infoPtr
->ColorBk
== CLR_DEFAULT
)
340 pdi
.hbrBk
= GetSysColorBrush(COLOR_3DFACE
);
342 pdi
.hbrBk
= CreateSolidBrush(infoPtr
->ColorBk
);
344 /* get the window style */
345 dwStyle
= GetWindowLongW (infoPtr
->Self
, GWL_STYLE
);
347 /* get client rectangle */
348 GetClientRect (infoPtr
->Self
, &pdi
.rect
);
350 FrameRect( hdc
, &pdi
.rect
, pdi
.hbrBk
);
351 InflateRect(&pdi
.rect
, -1, -1);
356 int part
= (dwStyle
& PBS_VERTICAL
) ? PP_BARVERT
: PP_BAR
;
358 GetThemeBackgroundContentRect (pdi
.theme
, hdc
, part
, 0, &pdi
.rect
,
361 /* Exclude content rect - content background will be drawn later */
362 ExcludeClipRect (hdc
, cntRect
.left
, cntRect
.top
,
363 cntRect
.right
, cntRect
.bottom
);
364 if (IsThemeBackgroundPartiallyTransparent (pdi
.theme
, part
, 0))
365 DrawThemeParentBackground (infoPtr
->Self
, hdc
, NULL
);
366 DrawThemeBackground (pdi
.theme
, hdc
, part
, 0, &pdi
.rect
, NULL
);
367 SelectClipRgn (hdc
, NULL
);
368 CopyRect (&pdi
.rect
, &cntRect
);
371 /* compute some drawing parameters */
372 barSmooth
= (dwStyle
& PBS_SMOOTH
) && !pdi
.theme
;
373 drawProcs
= &((pdi
.theme
? drawProcThemed
: drawProcClassic
)[(barSmooth
? 0 : 4)
374 + ((dwStyle
& PBS_VERTICAL
) ? 2 : 0)]);
375 barSize
= get_bar_size( dwStyle
, &pdi
.rect
);
378 GetWindowRect( infoPtr
->Self
, &pdi
.bgRect
);
379 MapWindowPoints( infoPtr
->Self
, 0, (POINT
*)&pdi
.bgRect
, 2 );
383 pdi
.ledW
= get_led_size( infoPtr
, dwStyle
, &pdi
.rect
);
384 pdi
.ledGap
= get_led_gap( infoPtr
);
386 if (dwStyle
& PBS_MARQUEE
)
388 const int ledW
= !barSmooth
? (pdi
.ledW
+ pdi
.ledGap
) : 1;
389 const int leds
= (barSize
+ ledW
- 1) / ledW
;
390 const int ledMEnd
= infoPtr
->MarqueePos
+ MARQUEE_LEDS
;
394 /* case 1: the marquee bar extends over the end and wraps around to
396 const int gapStart
= max((ledMEnd
- leds
) * ledW
, 0);
397 const int gapEnd
= min(infoPtr
->MarqueePos
* ledW
, barSize
);
399 drawProcs
[0]( &pdi
, 0, gapStart
);
400 drawProcs
[1]( &pdi
, gapStart
, gapEnd
);
401 drawProcs
[0]( &pdi
, gapEnd
, barSize
);
405 /* case 2: the marquee bar is between start and end */
406 const int barStart
= infoPtr
->MarqueePos
* ledW
;
407 const int barEnd
= min (ledMEnd
* ledW
, barSize
);
409 drawProcs
[1]( &pdi
, 0, barStart
);
410 drawProcs
[0]( &pdi
, barStart
, barEnd
);
411 drawProcs
[1]( &pdi
, barEnd
, barSize
);
416 int barEnd
= get_bar_position( infoPtr
, dwStyle
, &pdi
.rect
,
420 const int ledW
= pdi
.ledW
+ pdi
.ledGap
;
421 barEnd
= min (((barEnd
+ ledW
- 1) / ledW
) * ledW
, barSize
);
423 drawProcs
[0]( &pdi
, 0, barEnd
);
424 drawProcs
[1]( &pdi
, barEnd
, barSize
);
427 /* delete bar brush */
428 if (infoPtr
->ColorBar
!= CLR_DEFAULT
) DeleteObject (pdi
.hbrBar
);
429 if (infoPtr
->ColorBk
!= CLR_DEFAULT
) DeleteObject (pdi
.hbrBk
);
434 /***********************************************************************
436 * Draw the progress bar. The background need not be erased.
437 * If dc!=0, it draws on it
439 static LRESULT
PROGRESS_Paint (PROGRESS_INFO
*infoPtr
, HDC hdc
)
442 if (hdc
) return PROGRESS_Draw (infoPtr
, hdc
);
443 hdc
= BeginPaint (infoPtr
->Self
, &ps
);
444 PROGRESS_Draw (infoPtr
, hdc
);
445 EndPaint (infoPtr
->Self
, &ps
);
450 /***********************************************************************
451 * Advance marquee progress by one step.
453 static void PROGRESS_UpdateMarquee (PROGRESS_INFO
*infoPtr
)
455 LONG style
= GetWindowLongW (infoPtr
->Self
, GWL_STYLE
);
458 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
459 BOOL smooth
= (style
& PBS_SMOOTH
) && !theme
;
461 get_client_rect (infoPtr
->Self
, &rect
);
466 ledWidth
= get_led_size( infoPtr
, style
, &rect
) + get_led_gap( infoPtr
);
468 leds
= (get_bar_size( style
, &rect
) + ledWidth
- 1) /
471 /* increment the marquee progress */
472 if (++infoPtr
->MarqueePos
>= leds
)
473 infoPtr
->MarqueePos
= 0;
475 InvalidateRect(infoPtr
->Self
, &rect
, TRUE
);
476 UpdateWindow(infoPtr
->Self
);
480 /***********************************************************************
482 * Makes sure the current position (CurVal) is within bounds.
484 static void PROGRESS_CoercePos(PROGRESS_INFO
*infoPtr
)
486 if(infoPtr
->CurVal
< infoPtr
->MinVal
)
487 infoPtr
->CurVal
= infoPtr
->MinVal
;
488 if(infoPtr
->CurVal
> infoPtr
->MaxVal
)
489 infoPtr
->CurVal
= infoPtr
->MaxVal
;
493 /***********************************************************************
495 * Set new Font for progress bar
497 static HFONT
PROGRESS_SetFont (PROGRESS_INFO
*infoPtr
, HFONT hFont
, BOOL bRedraw
)
499 HFONT hOldFont
= infoPtr
->Font
;
500 infoPtr
->Font
= hFont
;
501 /* Since infoPtr->Font is not used, there is no need for repaint */
505 static DWORD
PROGRESS_SetRange (PROGRESS_INFO
*infoPtr
, int low
, int high
)
507 DWORD res
= MAKELONG(LOWORD(infoPtr
->MinVal
), LOWORD(infoPtr
->MaxVal
));
509 /* if nothing changes, simply return */
510 if(infoPtr
->MinVal
== low
&& infoPtr
->MaxVal
== high
) return res
;
512 infoPtr
->MinVal
= low
;
513 infoPtr
->MaxVal
= high
;
514 PROGRESS_CoercePos(infoPtr
);
515 InvalidateRect(infoPtr
->Self
, NULL
, TRUE
);
519 static UINT
PROGRESS_SetPos (PROGRESS_INFO
*infoPtr
, INT pos
)
521 DWORD style
= GetWindowLongW(infoPtr
->Self
, GWL_STYLE
);
523 if (style
& PBS_MARQUEE
)
525 PROGRESS_UpdateMarquee(infoPtr
);
531 oldVal
= infoPtr
->CurVal
;
533 infoPtr
->CurVal
= pos
;
534 PROGRESS_CoercePos(infoPtr
);
535 TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
536 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
537 UpdateWindow( infoPtr
->Self
);
543 /***********************************************************************
546 static LRESULT WINAPI
ProgressWindowProc(HWND hwnd
, UINT message
,
547 WPARAM wParam
, LPARAM lParam
)
549 PROGRESS_INFO
*infoPtr
;
550 static const WCHAR themeClass
[] = {'P','r','o','g','r','e','s','s',0};
553 TRACE("hwnd=%p msg=%04x wparam=%lx lParam=%lx\n", hwnd
, message
, wParam
, lParam
);
555 infoPtr
= (PROGRESS_INFO
*)GetWindowLongPtrW(hwnd
, 0);
557 if (!infoPtr
&& message
!= WM_CREATE
)
558 return DefWindowProcW( hwnd
, message
, wParam
, lParam
);
563 DWORD dwExStyle
= GetWindowLongW (hwnd
, GWL_EXSTYLE
);
565 theme
= OpenThemeData (hwnd
, themeClass
);
567 dwExStyle
&= ~(WS_EX_CLIENTEDGE
| WS_EX_WINDOWEDGE
);
568 if (!theme
) dwExStyle
|= WS_EX_STATICEDGE
;
569 SetWindowLongW (hwnd
, GWL_EXSTYLE
, dwExStyle
);
570 /* Force recalculation of a non-client area */
571 SetWindowPos(hwnd
, 0, 0, 0, 0, 0,
572 SWP_FRAMECHANGED
| SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
574 /* allocate memory for info struct */
575 infoPtr
= Alloc (sizeof(PROGRESS_INFO
));
576 if (!infoPtr
) return -1;
577 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
579 /* initialize the info struct */
580 infoPtr
->Self
= hwnd
;
582 infoPtr
->MaxVal
= 100;
585 infoPtr
->MarqueePos
= 0;
586 infoPtr
->Marquee
= FALSE
;
587 infoPtr
->ColorBar
= CLR_DEFAULT
;
588 infoPtr
->ColorBk
= CLR_DEFAULT
;
591 TRACE("Progress Ctrl creation, hwnd=%p\n", hwnd
);
596 TRACE("Progress Ctrl destruction, hwnd=%p\n", hwnd
);
598 SetWindowLongPtrW(hwnd
, 0, 0);
599 theme
= GetWindowTheme (hwnd
);
600 CloseThemeData (theme
);
607 return (LRESULT
)infoPtr
->Font
;
610 return (LRESULT
)PROGRESS_SetFont(infoPtr
, (HFONT
)wParam
, (BOOL
)lParam
);
614 return PROGRESS_Paint (infoPtr
, (HDC
)wParam
);
617 if (wParam
== ID_MARQUEE_TIMER
)
618 PROGRESS_UpdateMarquee (infoPtr
);
621 case WM_THEMECHANGED
:
623 DWORD dwExStyle
= GetWindowLongW (hwnd
, GWL_EXSTYLE
);
625 theme
= GetWindowTheme (hwnd
);
626 CloseThemeData (theme
);
627 theme
= OpenThemeData (hwnd
, themeClass
);
629 /* WS_EX_STATICEDGE disappears when the control is themed */
631 dwExStyle
&= ~WS_EX_STATICEDGE
;
633 dwExStyle
|= WS_EX_STATICEDGE
;
634 SetWindowLongW (hwnd
, GWL_EXSTYLE
, dwExStyle
);
636 InvalidateRect (hwnd
, NULL
, FALSE
);
643 oldVal
= infoPtr
->CurVal
;
645 infoPtr
->CurVal
+= (INT
)wParam
;
646 PROGRESS_CoercePos (infoPtr
);
647 TRACE("PBM_DELTAPOS: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
648 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
649 UpdateWindow( infoPtr
->Self
);
655 return PROGRESS_SetPos(infoPtr
, wParam
);
658 return PROGRESS_SetRange (infoPtr
, (int)LOWORD(lParam
), (int)HIWORD(lParam
));
663 oldStep
= infoPtr
->Step
;
664 infoPtr
->Step
= (INT
)wParam
;
669 return infoPtr
->Step
;
674 oldVal
= infoPtr
->CurVal
;
675 infoPtr
->CurVal
+= infoPtr
->Step
;
676 if(infoPtr
->CurVal
> infoPtr
->MaxVal
)
677 infoPtr
->CurVal
= infoPtr
->MinVal
;
678 if(oldVal
!= infoPtr
->CurVal
)
680 TRACE("PBM_STEPIT: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
681 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
682 UpdateWindow( infoPtr
->Self
);
688 return PROGRESS_SetRange (infoPtr
, (int)wParam
, (int)lParam
);
692 ((PPBRANGE
)lParam
)->iLow
= infoPtr
->MinVal
;
693 ((PPBRANGE
)lParam
)->iHigh
= infoPtr
->MaxVal
;
695 return wParam
? infoPtr
->MinVal
: infoPtr
->MaxVal
;
698 return infoPtr
->CurVal
;
700 case PBM_SETBARCOLOR
:
702 COLORREF clr
= infoPtr
->ColorBar
;
704 infoPtr
->ColorBar
= (COLORREF
)lParam
;
705 InvalidateRect(hwnd
, NULL
, TRUE
);
709 case PBM_GETBARCOLOR
:
710 return infoPtr
->ColorBar
;
714 COLORREF clr
= infoPtr
->ColorBk
;
716 infoPtr
->ColorBk
= (COLORREF
)lParam
;
717 InvalidateRect(hwnd
, NULL
, TRUE
);
722 return infoPtr
->ColorBk
;
725 if(wParam
!= PBST_NORMAL
)
726 FIXME("state %04lx not yet handled\n", wParam
);
735 UINT period
= lParam
? (UINT
)lParam
: DEFAULT_MARQUEE_PERIOD
;
736 infoPtr
->Marquee
= TRUE
;
737 SetTimer(infoPtr
->Self
, ID_MARQUEE_TIMER
, period
, NULL
);
741 infoPtr
->Marquee
= FALSE
;
742 KillTimer(infoPtr
->Self
, ID_MARQUEE_TIMER
);
744 return infoPtr
->Marquee
;
747 if ((message
>= WM_USER
) && (message
< WM_APP
) && !COMCTL32_IsReflectedMessage(message
))
748 ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message
, wParam
, lParam
);
749 return DefWindowProcW( hwnd
, message
, wParam
, lParam
);
754 /***********************************************************************
755 * PROGRESS_Register [Internal]
757 * Registers the progress bar window class.
759 void PROGRESS_Register (void)
763 ZeroMemory (&wndClass
, sizeof(wndClass
));
764 wndClass
.style
= CS_GLOBALCLASS
| CS_VREDRAW
| CS_HREDRAW
;
765 wndClass
.lpfnWndProc
= ProgressWindowProc
;
766 wndClass
.cbClsExtra
= 0;
767 wndClass
.cbWndExtra
= sizeof (PROGRESS_INFO
*);
768 wndClass
.hCursor
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
769 wndClass
.lpszClassName
= PROGRESS_CLASSW
;
771 RegisterClassW (&wndClass
);
775 /***********************************************************************
776 * PROGRESS_Unregister [Internal]
778 * Unregisters the progress bar window class.
780 void PROGRESS_Unregister (void)
782 UnregisterClassW (PROGRESS_CLASSW
, NULL
);