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"
49 #include "wine/heap.h"
51 WINE_DEFAULT_DEBUG_CHANNEL(progress
);
55 HWND Self
; /* The window handle for this control */
56 INT CurVal
; /* Current progress value */
57 INT MinVal
; /* Minimum progress value */
58 INT MaxVal
; /* Maximum progress value */
59 INT Step
; /* Step to use on PMB_STEPIT */
60 INT MarqueePos
; /* Marquee animation position */
61 BOOL Marquee
; /* Whether the marquee animation is enabled */
62 COLORREF ColorBar
; /* Bar color */
63 COLORREF ColorBk
; /* Background color */
64 HFONT Font
; /* Handle to font (not unused) */
67 /* Control configuration constants */
70 #define MARQUEE_LEDS 5
71 #define ID_MARQUEE_TIMER 1
72 #define DEFAULT_MARQUEE_PERIOD 30
74 /* Helper to obtain size of a progress bar chunk ("led"). */
75 static inline int get_led_size ( const PROGRESS_INFO
*infoPtr
, LONG style
,
78 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
82 if (SUCCEEDED( GetThemeInt( theme
, 0, 0, TMT_PROGRESSCHUNKSIZE
, &chunkSize
)))
86 if (style
& PBS_VERTICAL
)
87 return MulDiv (rect
->right
- rect
->left
, 2, 3);
89 return MulDiv (rect
->bottom
- rect
->top
, 2, 3);
92 /* Helper to obtain gap between progress bar chunks */
93 static inline int get_led_gap ( const PROGRESS_INFO
*infoPtr
)
95 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
99 if (SUCCEEDED( GetThemeInt( theme
, 0, 0, TMT_PROGRESSSPACESIZE
, &spaceSize
)))
106 /* Get client rect. Takes into account that theming needs no adjustment. */
107 static inline void get_client_rect (HWND hwnd
, RECT
* rect
)
109 HTHEME theme
= GetWindowTheme (hwnd
);
110 GetClientRect (hwnd
, rect
);
112 InflateRect(rect
, -1, -1);
115 DWORD dwStyle
= GetWindowLongW (hwnd
, GWL_STYLE
);
116 int part
= (dwStyle
& PBS_VERTICAL
) ? PP_BARVERT
: PP_BAR
;
117 GetThemeBackgroundContentRect (theme
, 0, part
, 0, rect
, rect
);
121 /* Compute the extend of the bar */
122 static inline int get_bar_size( LONG style
, const RECT
* rect
)
124 if (style
& PBS_VERTICAL
)
125 return rect
->bottom
- rect
->top
;
127 return rect
->right
- rect
->left
;
130 /* Compute the pixel position of a progress value */
131 static inline int get_bar_position( const PROGRESS_INFO
*infoPtr
, LONG style
,
132 const RECT
* rect
, INT value
)
134 return MulDiv (value
- infoPtr
->MinVal
, get_bar_size (style
, rect
),
135 infoPtr
->MaxVal
- infoPtr
->MinVal
);
138 /***********************************************************************
139 * PROGRESS_Invalidate
141 * Don't be too clever about invalidating the progress bar.
142 * InstallShield depends on this simple behaviour.
144 static void PROGRESS_Invalidate( const PROGRESS_INFO
*infoPtr
, INT old
, INT
new )
146 InvalidateRect( infoPtr
->Self
, NULL
, old
> new );
149 /* Information for a progress bar drawing helper */
150 typedef struct tagProgressDrawInfo
161 typedef void (*ProgressDrawProc
)(const ProgressDrawInfo
* di
, int start
, int end
);
163 /* draw solid horizontal bar from 'start' to 'end' */
164 static void draw_solid_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
167 SetRect(&r
, di
->rect
.left
+ start
, di
->rect
.top
, di
->rect
.left
+ end
, di
->rect
.bottom
);
168 FillRect (di
->hdc
, &r
, di
->hbrBar
);
171 /* draw solid horizontal background from 'start' to 'end' */
172 static void draw_solid_bkg_H (const ProgressDrawInfo
* di
, int start
, int end
)
175 SetRect(&r
, di
->rect
.left
+ start
, di
->rect
.top
, di
->rect
.left
+ end
, di
->rect
.bottom
);
176 FillRect (di
->hdc
, &r
, di
->hbrBk
);
179 /* draw solid vertical bar from 'start' to 'end' */
180 static void draw_solid_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
183 SetRect(&r
, di
->rect
.left
, di
->rect
.bottom
- end
, di
->rect
.right
, di
->rect
.bottom
- start
);
184 FillRect (di
->hdc
, &r
, di
->hbrBar
);
187 /* draw solid vertical background from 'start' to 'end' */
188 static void draw_solid_bkg_V (const ProgressDrawInfo
* di
, int start
, int end
)
191 SetRect(&r
, di
->rect
.left
, di
->rect
.bottom
- end
, di
->rect
.right
, di
->rect
.bottom
- start
);
192 FillRect (di
->hdc
, &r
, di
->hbrBk
);
195 /* draw chunky horizontal bar from 'start' to 'end' */
196 static void draw_chunk_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
199 int right
= di
->rect
.left
+ end
;
200 r
.left
= di
->rect
.left
+ start
;
201 r
.top
= di
->rect
.top
;
202 r
.bottom
= di
->rect
.bottom
;
203 while (r
.left
< right
)
205 r
.right
= min (r
.left
+ di
->ledW
, right
);
206 FillRect (di
->hdc
, &r
, di
->hbrBar
);
208 r
.right
= min (r
.left
+ di
->ledGap
, right
);
209 FillRect (di
->hdc
, &r
, di
->hbrBk
);
214 /* draw chunky vertical bar from 'start' to 'end' */
215 static void draw_chunk_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
218 int top
= di
->rect
.bottom
- end
;
219 r
.left
= di
->rect
.left
;
220 r
.right
= di
->rect
.right
;
221 r
.bottom
= di
->rect
.bottom
- start
;
222 while (r
.bottom
> top
)
224 r
.top
= max (r
.bottom
- di
->ledW
, top
);
225 FillRect (di
->hdc
, &r
, di
->hbrBar
);
227 r
.top
= max (r
.bottom
- di
->ledGap
, top
);
228 FillRect (di
->hdc
, &r
, di
->hbrBk
);
233 /* drawing functions for "classic" style */
234 static const ProgressDrawProc drawProcClassic
[8] = {
237 draw_solid_bar_H
, draw_solid_bkg_H
,
239 draw_solid_bar_V
, draw_solid_bkg_V
,
242 draw_chunk_bar_H
, draw_solid_bkg_H
,
244 draw_chunk_bar_V
, draw_solid_bkg_V
,
247 /* draw themed horizontal bar from 'start' to 'end' */
248 static void draw_theme_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
251 r
.left
= di
->rect
.left
+ start
;
252 r
.top
= di
->rect
.top
;
253 r
.bottom
= di
->rect
.bottom
;
254 r
.right
= di
->rect
.left
+ end
;
255 DrawThemeBackground (di
->theme
, di
->hdc
, PP_CHUNK
, 0, &r
, NULL
);
258 /* draw themed vertical bar from 'start' to 'end' */
259 static void draw_theme_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
262 r
.left
= di
->rect
.left
;
263 r
.right
= di
->rect
.right
;
264 r
.bottom
= di
->rect
.bottom
- start
;
265 r
.top
= di
->rect
.bottom
- end
;
266 DrawThemeBackground (di
->theme
, di
->hdc
, PP_CHUNKVERT
, 0, &r
, NULL
);
269 /* draw themed horizontal background from 'start' to 'end' */
270 static void draw_theme_bkg_H (const ProgressDrawInfo
* di
, int start
, int end
)
274 SetRect(&r
, di
->rect
.left
+ start
, di
->rect
.top
, di
->rect
.left
+ end
, di
->rect
.bottom
);
276 OffsetRect(&bgrect
, -bgrect
.left
, -bgrect
.top
);
278 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BAR
, 0, &bgrect
, &r
);
281 /* draw themed vertical background from 'start' to 'end' */
282 static void draw_theme_bkg_V (const ProgressDrawInfo
* di
, int start
, int end
)
286 SetRect(&r
, di
->rect
.left
, di
->rect
.bottom
- end
, di
->rect
.right
, di
->rect
.bottom
- start
);
288 OffsetRect(&bgrect
, -bgrect
.left
, -bgrect
.top
);
290 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BARVERT
, 0, &bgrect
, &r
);
293 /* drawing functions for themed style */
294 static const ProgressDrawProc drawProcThemed
[8] = {
297 draw_theme_bar_H
, draw_theme_bkg_H
,
299 draw_theme_bar_V
, draw_theme_bkg_V
,
302 draw_theme_bar_H
, draw_theme_bkg_H
,
304 draw_theme_bar_V
, draw_theme_bkg_V
,
307 /***********************************************************************
309 * Draws the progress bar.
311 static LRESULT
PROGRESS_Draw (PROGRESS_INFO
*infoPtr
, HDC hdc
)
316 const ProgressDrawProc
* drawProcs
;
317 ProgressDrawInfo pdi
;
319 TRACE("(infoPtr=%p, hdc=%p)\n", infoPtr
, hdc
);
322 pdi
.theme
= GetWindowTheme (infoPtr
->Self
);
324 /* get the required bar brush */
325 if (infoPtr
->ColorBar
== CLR_DEFAULT
)
326 pdi
.hbrBar
= GetSysColorBrush(COLOR_HIGHLIGHT
);
328 pdi
.hbrBar
= CreateSolidBrush (infoPtr
->ColorBar
);
330 if (infoPtr
->ColorBk
== CLR_DEFAULT
)
331 pdi
.hbrBk
= GetSysColorBrush(COLOR_3DFACE
);
333 pdi
.hbrBk
= CreateSolidBrush(infoPtr
->ColorBk
);
335 /* get the window style */
336 dwStyle
= GetWindowLongW (infoPtr
->Self
, GWL_STYLE
);
338 /* get client rectangle */
339 GetClientRect (infoPtr
->Self
, &pdi
.rect
);
341 FrameRect( hdc
, &pdi
.rect
, pdi
.hbrBk
);
342 InflateRect(&pdi
.rect
, -1, -1);
347 int part
= (dwStyle
& PBS_VERTICAL
) ? PP_BARVERT
: PP_BAR
;
349 GetThemeBackgroundContentRect (pdi
.theme
, hdc
, part
, 0, &pdi
.rect
,
352 /* Exclude content rect - content background will be drawn later */
353 ExcludeClipRect (hdc
, cntRect
.left
, cntRect
.top
,
354 cntRect
.right
, cntRect
.bottom
);
355 if (IsThemeBackgroundPartiallyTransparent (pdi
.theme
, part
, 0))
356 DrawThemeParentBackground (infoPtr
->Self
, hdc
, NULL
);
357 DrawThemeBackground (pdi
.theme
, hdc
, part
, 0, &pdi
.rect
, NULL
);
358 SelectClipRgn (hdc
, NULL
);
362 /* compute some drawing parameters */
363 barSmooth
= (dwStyle
& PBS_SMOOTH
) && !pdi
.theme
;
364 drawProcs
= &((pdi
.theme
? drawProcThemed
: drawProcClassic
)[(barSmooth
? 0 : 4)
365 + ((dwStyle
& PBS_VERTICAL
) ? 2 : 0)]);
366 barSize
= get_bar_size( dwStyle
, &pdi
.rect
);
369 GetWindowRect( infoPtr
->Self
, &pdi
.bgRect
);
370 MapWindowPoints( infoPtr
->Self
, 0, (POINT
*)&pdi
.bgRect
, 2 );
374 pdi
.ledW
= get_led_size( infoPtr
, dwStyle
, &pdi
.rect
);
375 pdi
.ledGap
= get_led_gap( infoPtr
);
377 if (dwStyle
& PBS_MARQUEE
)
379 const int ledW
= !barSmooth
? (pdi
.ledW
+ pdi
.ledGap
) : 1;
380 const int leds
= (barSize
+ ledW
- 1) / ledW
;
381 const int ledMEnd
= infoPtr
->MarqueePos
+ MARQUEE_LEDS
;
385 /* case 1: the marquee bar extends over the end and wraps around to
387 const int gapStart
= max((ledMEnd
- leds
) * ledW
, 0);
388 const int gapEnd
= min(infoPtr
->MarqueePos
* ledW
, barSize
);
390 drawProcs
[0]( &pdi
, 0, gapStart
);
391 drawProcs
[1]( &pdi
, gapStart
, gapEnd
);
392 drawProcs
[0]( &pdi
, gapEnd
, barSize
);
396 /* case 2: the marquee bar is between start and end */
397 const int barStart
= infoPtr
->MarqueePos
* ledW
;
398 const int barEnd
= min (ledMEnd
* ledW
, barSize
);
400 drawProcs
[1]( &pdi
, 0, barStart
);
401 drawProcs
[0]( &pdi
, barStart
, barEnd
);
402 drawProcs
[1]( &pdi
, barEnd
, barSize
);
407 int barEnd
= get_bar_position( infoPtr
, dwStyle
, &pdi
.rect
,
411 const int ledW
= pdi
.ledW
+ pdi
.ledGap
;
412 barEnd
= min (((barEnd
+ ledW
- 1) / ledW
) * ledW
, barSize
);
414 drawProcs
[0]( &pdi
, 0, barEnd
);
415 drawProcs
[1]( &pdi
, barEnd
, barSize
);
418 /* delete bar brush */
419 if (infoPtr
->ColorBar
!= CLR_DEFAULT
) DeleteObject (pdi
.hbrBar
);
420 if (infoPtr
->ColorBk
!= CLR_DEFAULT
) DeleteObject (pdi
.hbrBk
);
425 /***********************************************************************
427 * Draw the progress bar. The background need not be erased.
428 * If dc!=0, it draws on it
430 static LRESULT
PROGRESS_Paint (PROGRESS_INFO
*infoPtr
, HDC hdc
)
433 if (hdc
) return PROGRESS_Draw (infoPtr
, hdc
);
434 hdc
= BeginPaint (infoPtr
->Self
, &ps
);
435 PROGRESS_Draw (infoPtr
, hdc
);
436 EndPaint (infoPtr
->Self
, &ps
);
441 /***********************************************************************
442 * Advance marquee progress by one step.
444 static void PROGRESS_UpdateMarquee (PROGRESS_INFO
*infoPtr
)
446 LONG style
= GetWindowLongW (infoPtr
->Self
, GWL_STYLE
);
449 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
450 BOOL smooth
= (style
& PBS_SMOOTH
) && !theme
;
452 get_client_rect (infoPtr
->Self
, &rect
);
457 ledWidth
= get_led_size( infoPtr
, style
, &rect
) + get_led_gap( infoPtr
);
459 leds
= (get_bar_size( style
, &rect
) + ledWidth
- 1) /
462 /* increment the marquee progress */
463 if (++infoPtr
->MarqueePos
>= leds
)
464 infoPtr
->MarqueePos
= 0;
466 InvalidateRect(infoPtr
->Self
, &rect
, TRUE
);
467 UpdateWindow(infoPtr
->Self
);
471 /***********************************************************************
473 * Makes sure the current position (CurVal) is within bounds.
475 static void PROGRESS_CoercePos(PROGRESS_INFO
*infoPtr
)
477 if(infoPtr
->CurVal
< infoPtr
->MinVal
)
478 infoPtr
->CurVal
= infoPtr
->MinVal
;
479 if(infoPtr
->CurVal
> infoPtr
->MaxVal
)
480 infoPtr
->CurVal
= infoPtr
->MaxVal
;
484 /***********************************************************************
486 * Set new Font for progress bar
488 static HFONT
PROGRESS_SetFont (PROGRESS_INFO
*infoPtr
, HFONT hFont
, BOOL bRedraw
)
490 HFONT hOldFont
= infoPtr
->Font
;
491 infoPtr
->Font
= hFont
;
492 /* Since infoPtr->Font is not used, there is no need for repaint */
496 static DWORD
PROGRESS_SetRange (PROGRESS_INFO
*infoPtr
, int low
, int high
)
498 DWORD res
= MAKELONG(LOWORD(infoPtr
->MinVal
), LOWORD(infoPtr
->MaxVal
));
500 /* if nothing changes, simply return */
501 if(infoPtr
->MinVal
== low
&& infoPtr
->MaxVal
== high
) return res
;
503 infoPtr
->MinVal
= low
;
504 infoPtr
->MaxVal
= high
;
505 PROGRESS_CoercePos(infoPtr
);
506 InvalidateRect(infoPtr
->Self
, NULL
, TRUE
);
510 static UINT
PROGRESS_SetPos (PROGRESS_INFO
*infoPtr
, INT pos
)
512 DWORD style
= GetWindowLongW(infoPtr
->Self
, GWL_STYLE
);
514 if (style
& PBS_MARQUEE
)
516 PROGRESS_UpdateMarquee(infoPtr
);
522 oldVal
= infoPtr
->CurVal
;
524 infoPtr
->CurVal
= pos
;
525 PROGRESS_CoercePos(infoPtr
);
526 TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
527 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
528 UpdateWindow( infoPtr
->Self
);
534 /***********************************************************************
537 static LRESULT WINAPI
ProgressWindowProc(HWND hwnd
, UINT message
,
538 WPARAM wParam
, LPARAM lParam
)
540 PROGRESS_INFO
*infoPtr
;
541 static const WCHAR themeClass
[] = {'P','r','o','g','r','e','s','s',0};
544 TRACE("hwnd=%p msg=%04x wparam=%lx lParam=%lx\n", hwnd
, message
, wParam
, lParam
);
546 infoPtr
= (PROGRESS_INFO
*)GetWindowLongPtrW(hwnd
, 0);
548 if (!infoPtr
&& message
!= WM_CREATE
)
549 return DefWindowProcW( hwnd
, message
, wParam
, lParam
);
554 DWORD dwExStyle
= GetWindowLongW (hwnd
, GWL_EXSTYLE
);
556 theme
= OpenThemeData (hwnd
, themeClass
);
558 dwExStyle
&= ~(WS_EX_CLIENTEDGE
| WS_EX_WINDOWEDGE
);
559 if (!theme
) dwExStyle
|= WS_EX_STATICEDGE
;
560 SetWindowLongW (hwnd
, GWL_EXSTYLE
, dwExStyle
);
561 /* Force recalculation of a non-client area */
562 SetWindowPos(hwnd
, 0, 0, 0, 0, 0,
563 SWP_FRAMECHANGED
| SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
565 /* allocate memory for info struct */
566 infoPtr
= heap_alloc_zero (sizeof(*infoPtr
));
567 if (!infoPtr
) return -1;
568 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
570 /* initialize the info struct */
571 infoPtr
->Self
= hwnd
;
573 infoPtr
->MaxVal
= 100;
576 infoPtr
->MarqueePos
= 0;
577 infoPtr
->Marquee
= FALSE
;
578 infoPtr
->ColorBar
= CLR_DEFAULT
;
579 infoPtr
->ColorBk
= CLR_DEFAULT
;
582 TRACE("Progress Ctrl creation, hwnd=%p\n", hwnd
);
587 TRACE("Progress Ctrl destruction, hwnd=%p\n", hwnd
);
589 SetWindowLongPtrW(hwnd
, 0, 0);
590 theme
= GetWindowTheme (hwnd
);
591 CloseThemeData (theme
);
598 return (LRESULT
)infoPtr
->Font
;
601 return (LRESULT
)PROGRESS_SetFont(infoPtr
, (HFONT
)wParam
, (BOOL
)lParam
);
605 return PROGRESS_Paint (infoPtr
, (HDC
)wParam
);
608 if (wParam
== ID_MARQUEE_TIMER
)
609 PROGRESS_UpdateMarquee (infoPtr
);
612 case WM_THEMECHANGED
:
614 DWORD dwExStyle
= GetWindowLongW (hwnd
, GWL_EXSTYLE
);
616 theme
= GetWindowTheme (hwnd
);
617 CloseThemeData (theme
);
618 theme
= OpenThemeData (hwnd
, themeClass
);
620 /* WS_EX_STATICEDGE disappears when the control is themed */
622 dwExStyle
&= ~WS_EX_STATICEDGE
;
624 dwExStyle
|= WS_EX_STATICEDGE
;
625 SetWindowLongW (hwnd
, GWL_EXSTYLE
, dwExStyle
);
627 InvalidateRect (hwnd
, NULL
, FALSE
);
634 oldVal
= infoPtr
->CurVal
;
636 infoPtr
->CurVal
+= (INT
)wParam
;
637 PROGRESS_CoercePos (infoPtr
);
638 TRACE("PBM_DELTAPOS: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
639 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
640 UpdateWindow( infoPtr
->Self
);
646 return PROGRESS_SetPos(infoPtr
, wParam
);
649 return PROGRESS_SetRange (infoPtr
, (int)LOWORD(lParam
), (int)HIWORD(lParam
));
654 oldStep
= infoPtr
->Step
;
655 infoPtr
->Step
= (INT
)wParam
;
660 return infoPtr
->Step
;
665 oldVal
= infoPtr
->CurVal
;
666 infoPtr
->CurVal
+= infoPtr
->Step
;
667 if(infoPtr
->CurVal
> infoPtr
->MaxVal
)
668 infoPtr
->CurVal
= infoPtr
->MinVal
;
669 if(oldVal
!= infoPtr
->CurVal
)
671 TRACE("PBM_STEPIT: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
672 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
673 UpdateWindow( infoPtr
->Self
);
679 return PROGRESS_SetRange (infoPtr
, (int)wParam
, (int)lParam
);
683 ((PPBRANGE
)lParam
)->iLow
= infoPtr
->MinVal
;
684 ((PPBRANGE
)lParam
)->iHigh
= infoPtr
->MaxVal
;
686 return wParam
? infoPtr
->MinVal
: infoPtr
->MaxVal
;
689 return infoPtr
->CurVal
;
691 case PBM_SETBARCOLOR
:
693 COLORREF clr
= infoPtr
->ColorBar
;
695 infoPtr
->ColorBar
= (COLORREF
)lParam
;
696 InvalidateRect(hwnd
, NULL
, TRUE
);
700 case PBM_GETBARCOLOR
:
701 return infoPtr
->ColorBar
;
705 COLORREF clr
= infoPtr
->ColorBk
;
707 infoPtr
->ColorBk
= (COLORREF
)lParam
;
708 InvalidateRect(hwnd
, NULL
, TRUE
);
713 return infoPtr
->ColorBk
;
716 if(wParam
!= PBST_NORMAL
)
717 FIXME("state %04lx not yet handled\n", wParam
);
726 UINT period
= lParam
? (UINT
)lParam
: DEFAULT_MARQUEE_PERIOD
;
727 infoPtr
->Marquee
= TRUE
;
728 SetTimer(infoPtr
->Self
, ID_MARQUEE_TIMER
, period
, NULL
);
732 infoPtr
->Marquee
= FALSE
;
733 KillTimer(infoPtr
->Self
, ID_MARQUEE_TIMER
);
735 return infoPtr
->Marquee
;
738 if ((message
>= WM_USER
) && (message
< WM_APP
) && !COMCTL32_IsReflectedMessage(message
))
739 ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message
, wParam
, lParam
);
740 return DefWindowProcW( hwnd
, message
, wParam
, lParam
);
745 /***********************************************************************
746 * PROGRESS_Register [Internal]
748 * Registers the progress bar window class.
750 void PROGRESS_Register (void)
754 ZeroMemory (&wndClass
, sizeof(wndClass
));
755 wndClass
.style
= CS_GLOBALCLASS
| CS_VREDRAW
| CS_HREDRAW
;
756 wndClass
.lpfnWndProc
= ProgressWindowProc
;
757 wndClass
.cbClsExtra
= 0;
758 wndClass
.cbWndExtra
= sizeof (PROGRESS_INFO
*);
759 wndClass
.hCursor
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
760 wndClass
.lpszClassName
= PROGRESS_CLASSW
;
762 RegisterClassW (&wndClass
);
766 /***********************************************************************
767 * PROGRESS_Unregister [Internal]
769 * Unregisters the progress bar window class.
771 void PROGRESS_Unregister (void)
773 UnregisterClassW (PROGRESS_CLASSW
, NULL
);