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
24 * -- PBS_SMOOTHREVERSE
39 #include "wine/debug.h"
40 #include "wine/heap.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(progress
);
46 HWND Self
; /* The window handle for this control */
47 INT CurVal
; /* Current progress value */
48 INT MinVal
; /* Minimum progress value */
49 INT MaxVal
; /* Maximum progress value */
50 INT Step
; /* Step to use on PMB_STEPIT */
51 INT MarqueePos
; /* Marquee animation position */
52 BOOL Marquee
; /* Whether the marquee animation is enabled */
53 COLORREF ColorBar
; /* Bar color */
54 COLORREF ColorBk
; /* Background color */
55 HFONT Font
; /* Handle to font (not unused) */
58 /* Control configuration constants */
61 #define MARQUEE_LEDS 5
62 #define ID_MARQUEE_TIMER 1
63 #define DEFAULT_MARQUEE_PERIOD 30
65 /* Helper to obtain size of a progress bar chunk ("led"). */
66 static inline int get_led_size ( const PROGRESS_INFO
*infoPtr
, LONG style
,
69 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
73 if (SUCCEEDED( GetThemeInt( theme
, 0, 0, TMT_PROGRESSCHUNKSIZE
, &chunkSize
)))
77 if (style
& PBS_VERTICAL
)
78 return MulDiv (rect
->right
- rect
->left
, 2, 3);
80 return MulDiv (rect
->bottom
- rect
->top
, 2, 3);
83 /* Helper to obtain gap between progress bar chunks */
84 static inline int get_led_gap ( const PROGRESS_INFO
*infoPtr
)
86 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
90 if (SUCCEEDED( GetThemeInt( theme
, 0, 0, TMT_PROGRESSSPACESIZE
, &spaceSize
)))
97 /* Get client rect. Takes into account that theming needs no adjustment. */
98 static inline void get_client_rect (HWND hwnd
, RECT
* rect
)
100 HTHEME theme
= GetWindowTheme (hwnd
);
101 GetClientRect (hwnd
, rect
);
103 InflateRect(rect
, -1, -1);
106 DWORD dwStyle
= GetWindowLongW (hwnd
, GWL_STYLE
);
107 int part
= (dwStyle
& PBS_VERTICAL
) ? PP_BARVERT
: PP_BAR
;
108 GetThemeBackgroundContentRect (theme
, 0, part
, 0, rect
, rect
);
112 /* Compute the extend of the bar */
113 static inline int get_bar_size( LONG style
, const RECT
* rect
)
115 if (style
& PBS_VERTICAL
)
116 return rect
->bottom
- rect
->top
;
118 return rect
->right
- rect
->left
;
121 /* Compute the pixel position of a progress value */
122 static inline int get_bar_position( const PROGRESS_INFO
*infoPtr
, LONG style
,
123 const RECT
* rect
, INT value
)
125 return MulDiv (value
- infoPtr
->MinVal
, get_bar_size (style
, rect
),
126 infoPtr
->MaxVal
- infoPtr
->MinVal
);
129 /***********************************************************************
130 * PROGRESS_Invalidate
132 * Don't be too clever about invalidating the progress bar.
133 * InstallShield depends on this simple behaviour.
135 static void PROGRESS_Invalidate( const PROGRESS_INFO
*infoPtr
, INT old
, INT
new )
137 InvalidateRect( infoPtr
->Self
, NULL
, old
> new );
140 /* Information for a progress bar drawing helper */
141 typedef struct tagProgressDrawInfo
152 typedef void (*ProgressDrawProc
)(const ProgressDrawInfo
* di
, int start
, int end
);
154 /* draw solid horizontal bar from 'start' to 'end' */
155 static void draw_solid_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
158 SetRect(&r
, di
->rect
.left
+ start
, di
->rect
.top
, di
->rect
.left
+ end
, di
->rect
.bottom
);
159 FillRect (di
->hdc
, &r
, di
->hbrBar
);
162 /* draw solid horizontal background from 'start' to 'end' */
163 static void draw_solid_bkg_H (const ProgressDrawInfo
* di
, int start
, int end
)
166 SetRect(&r
, di
->rect
.left
+ start
, di
->rect
.top
, di
->rect
.left
+ end
, di
->rect
.bottom
);
167 FillRect (di
->hdc
, &r
, di
->hbrBk
);
170 /* draw solid vertical bar from 'start' to 'end' */
171 static void draw_solid_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
174 SetRect(&r
, di
->rect
.left
, di
->rect
.bottom
- end
, di
->rect
.right
, di
->rect
.bottom
- start
);
175 FillRect (di
->hdc
, &r
, di
->hbrBar
);
178 /* draw solid vertical background from 'start' to 'end' */
179 static void draw_solid_bkg_V (const ProgressDrawInfo
* di
, int start
, int end
)
182 SetRect(&r
, di
->rect
.left
, di
->rect
.bottom
- end
, di
->rect
.right
, di
->rect
.bottom
- start
);
183 FillRect (di
->hdc
, &r
, di
->hbrBk
);
186 /* draw chunky horizontal bar from 'start' to 'end' */
187 static void draw_chunk_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
190 int right
= di
->rect
.left
+ end
;
191 r
.left
= di
->rect
.left
+ start
;
192 r
.top
= di
->rect
.top
;
193 r
.bottom
= di
->rect
.bottom
;
194 while (r
.left
< right
)
196 r
.right
= min (r
.left
+ di
->ledW
, right
);
197 FillRect (di
->hdc
, &r
, di
->hbrBar
);
199 r
.right
= min (r
.left
+ di
->ledGap
, right
);
200 FillRect (di
->hdc
, &r
, di
->hbrBk
);
205 /* draw chunky vertical bar from 'start' to 'end' */
206 static void draw_chunk_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
209 int top
= di
->rect
.bottom
- end
;
210 r
.left
= di
->rect
.left
;
211 r
.right
= di
->rect
.right
;
212 r
.bottom
= di
->rect
.bottom
- start
;
213 while (r
.bottom
> top
)
215 r
.top
= max (r
.bottom
- di
->ledW
, top
);
216 FillRect (di
->hdc
, &r
, di
->hbrBar
);
218 r
.top
= max (r
.bottom
- di
->ledGap
, top
);
219 FillRect (di
->hdc
, &r
, di
->hbrBk
);
224 /* drawing functions for "classic" style */
225 static const ProgressDrawProc drawProcClassic
[8] = {
228 draw_solid_bar_H
, draw_solid_bkg_H
,
230 draw_solid_bar_V
, draw_solid_bkg_V
,
233 draw_chunk_bar_H
, draw_solid_bkg_H
,
235 draw_chunk_bar_V
, draw_solid_bkg_V
,
238 /* draw themed horizontal bar from 'start' to 'end' */
239 static void draw_theme_bar_H (const ProgressDrawInfo
* di
, int start
, int end
)
242 r
.left
= di
->rect
.left
+ start
;
243 r
.top
= di
->rect
.top
;
244 r
.bottom
= di
->rect
.bottom
;
245 r
.right
= di
->rect
.left
+ end
;
246 DrawThemeBackground (di
->theme
, di
->hdc
, PP_CHUNK
, 0, &r
, NULL
);
249 /* draw themed vertical bar from 'start' to 'end' */
250 static void draw_theme_bar_V (const ProgressDrawInfo
* di
, int start
, int end
)
253 r
.left
= di
->rect
.left
;
254 r
.right
= di
->rect
.right
;
255 r
.bottom
= di
->rect
.bottom
- start
;
256 r
.top
= di
->rect
.bottom
- end
;
257 DrawThemeBackground (di
->theme
, di
->hdc
, PP_CHUNKVERT
, 0, &r
, NULL
);
260 /* draw themed horizontal background from 'start' to 'end' */
261 static void draw_theme_bkg_H (const ProgressDrawInfo
* di
, int start
, int end
)
265 SetRect(&r
, di
->rect
.left
+ start
, di
->rect
.top
, di
->rect
.left
+ end
, di
->rect
.bottom
);
267 OffsetRect(&bgrect
, -bgrect
.left
, -bgrect
.top
);
269 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BAR
, 0, &bgrect
, &r
);
272 /* draw themed vertical background from 'start' to 'end' */
273 static void draw_theme_bkg_V (const ProgressDrawInfo
* di
, int start
, int end
)
277 SetRect(&r
, di
->rect
.left
, di
->rect
.bottom
- end
, di
->rect
.right
, di
->rect
.bottom
- start
);
279 OffsetRect(&bgrect
, -bgrect
.left
, -bgrect
.top
);
281 DrawThemeBackground (di
->theme
, di
->hdc
, PP_BARVERT
, 0, &bgrect
, &r
);
284 /* drawing functions for themed style */
285 static const ProgressDrawProc drawProcThemed
[8] = {
288 draw_theme_bar_H
, draw_theme_bkg_H
,
290 draw_theme_bar_V
, draw_theme_bkg_V
,
293 draw_theme_bar_H
, draw_theme_bkg_H
,
295 draw_theme_bar_V
, draw_theme_bkg_V
,
298 /***********************************************************************
300 * Draws the progress bar.
302 static LRESULT
PROGRESS_Draw (PROGRESS_INFO
*infoPtr
, HDC hdc
)
307 const ProgressDrawProc
* drawProcs
;
308 ProgressDrawInfo pdi
;
310 TRACE("(infoPtr=%p, hdc=%p)\n", infoPtr
, hdc
);
313 pdi
.theme
= GetWindowTheme (infoPtr
->Self
);
315 /* get the required bar brush */
316 if (infoPtr
->ColorBar
== CLR_DEFAULT
)
317 pdi
.hbrBar
= GetSysColorBrush(COLOR_HIGHLIGHT
);
319 pdi
.hbrBar
= CreateSolidBrush (infoPtr
->ColorBar
);
321 if (infoPtr
->ColorBk
== CLR_DEFAULT
)
322 pdi
.hbrBk
= GetSysColorBrush(COLOR_3DFACE
);
324 pdi
.hbrBk
= CreateSolidBrush(infoPtr
->ColorBk
);
326 /* get the window style */
327 dwStyle
= GetWindowLongW (infoPtr
->Self
, GWL_STYLE
);
329 /* get client rectangle */
330 GetClientRect (infoPtr
->Self
, &pdi
.rect
);
332 FrameRect( hdc
, &pdi
.rect
, pdi
.hbrBk
);
333 InflateRect(&pdi
.rect
, -1, -1);
338 int part
= (dwStyle
& PBS_VERTICAL
) ? PP_BARVERT
: PP_BAR
;
340 GetThemeBackgroundContentRect (pdi
.theme
, hdc
, part
, 0, &pdi
.rect
,
343 /* Exclude content rect - content background will be drawn later */
344 ExcludeClipRect (hdc
, cntRect
.left
, cntRect
.top
,
345 cntRect
.right
, cntRect
.bottom
);
346 if (IsThemeBackgroundPartiallyTransparent (pdi
.theme
, part
, 0))
347 DrawThemeParentBackground (infoPtr
->Self
, hdc
, NULL
);
348 DrawThemeBackground (pdi
.theme
, hdc
, part
, 0, &pdi
.rect
, NULL
);
349 SelectClipRgn (hdc
, NULL
);
353 /* compute some drawing parameters */
354 barSmooth
= (dwStyle
& PBS_SMOOTH
) && !pdi
.theme
;
355 drawProcs
= &((pdi
.theme
? drawProcThemed
: drawProcClassic
)[(barSmooth
? 0 : 4)
356 + ((dwStyle
& PBS_VERTICAL
) ? 2 : 0)]);
357 barSize
= get_bar_size( dwStyle
, &pdi
.rect
);
360 GetWindowRect( infoPtr
->Self
, &pdi
.bgRect
);
361 MapWindowPoints( infoPtr
->Self
, 0, (POINT
*)&pdi
.bgRect
, 2 );
365 pdi
.ledW
= get_led_size( infoPtr
, dwStyle
, &pdi
.rect
);
366 pdi
.ledGap
= get_led_gap( infoPtr
);
368 if (dwStyle
& PBS_MARQUEE
)
370 const int ledW
= !barSmooth
? (pdi
.ledW
+ pdi
.ledGap
) : 1;
371 const int leds
= (barSize
+ ledW
- 1) / ledW
;
372 const int ledMEnd
= infoPtr
->MarqueePos
+ MARQUEE_LEDS
;
376 /* case 1: the marquee bar extends over the end and wraps around to
378 const int gapStart
= max((ledMEnd
- leds
) * ledW
, 0);
379 const int gapEnd
= min(infoPtr
->MarqueePos
* ledW
, barSize
);
381 drawProcs
[0]( &pdi
, 0, gapStart
);
382 drawProcs
[1]( &pdi
, gapStart
, gapEnd
);
383 drawProcs
[0]( &pdi
, gapEnd
, barSize
);
387 /* case 2: the marquee bar is between start and end */
388 const int barStart
= infoPtr
->MarqueePos
* ledW
;
389 const int barEnd
= min (ledMEnd
* ledW
, barSize
);
391 drawProcs
[1]( &pdi
, 0, barStart
);
392 drawProcs
[0]( &pdi
, barStart
, barEnd
);
393 drawProcs
[1]( &pdi
, barEnd
, barSize
);
398 int barEnd
= get_bar_position( infoPtr
, dwStyle
, &pdi
.rect
,
402 const int ledW
= pdi
.ledW
+ pdi
.ledGap
;
403 barEnd
= min (((barEnd
+ ledW
- 1) / ledW
) * ledW
, barSize
);
405 drawProcs
[0]( &pdi
, 0, barEnd
);
406 drawProcs
[1]( &pdi
, barEnd
, barSize
);
409 /* delete bar brush */
410 if (infoPtr
->ColorBar
!= CLR_DEFAULT
) DeleteObject (pdi
.hbrBar
);
411 if (infoPtr
->ColorBk
!= CLR_DEFAULT
) DeleteObject (pdi
.hbrBk
);
416 /***********************************************************************
418 * Draw the progress bar. The background need not be erased.
419 * If dc!=0, it draws on it
421 static LRESULT
PROGRESS_Paint (PROGRESS_INFO
*infoPtr
, HDC hdc
)
424 if (hdc
) return PROGRESS_Draw (infoPtr
, hdc
);
425 hdc
= BeginPaint (infoPtr
->Self
, &ps
);
426 PROGRESS_Draw (infoPtr
, hdc
);
427 EndPaint (infoPtr
->Self
, &ps
);
432 /***********************************************************************
433 * Advance marquee progress by one step.
435 static void PROGRESS_UpdateMarquee (PROGRESS_INFO
*infoPtr
)
437 LONG style
= GetWindowLongW (infoPtr
->Self
, GWL_STYLE
);
440 HTHEME theme
= GetWindowTheme (infoPtr
->Self
);
441 BOOL smooth
= (style
& PBS_SMOOTH
) && !theme
;
443 get_client_rect (infoPtr
->Self
, &rect
);
448 ledWidth
= get_led_size( infoPtr
, style
, &rect
) + get_led_gap( infoPtr
);
450 leds
= (get_bar_size( style
, &rect
) + ledWidth
- 1) /
453 /* increment the marquee progress */
454 if (++infoPtr
->MarqueePos
>= leds
)
455 infoPtr
->MarqueePos
= 0;
457 InvalidateRect(infoPtr
->Self
, &rect
, TRUE
);
458 UpdateWindow(infoPtr
->Self
);
462 /***********************************************************************
464 * Makes sure the current position (CurVal) is within bounds.
466 static void PROGRESS_CoercePos(PROGRESS_INFO
*infoPtr
)
468 if(infoPtr
->CurVal
< infoPtr
->MinVal
)
469 infoPtr
->CurVal
= infoPtr
->MinVal
;
470 if(infoPtr
->CurVal
> infoPtr
->MaxVal
)
471 infoPtr
->CurVal
= infoPtr
->MaxVal
;
475 /***********************************************************************
477 * Set new Font for progress bar
479 static HFONT
PROGRESS_SetFont (PROGRESS_INFO
*infoPtr
, HFONT hFont
, BOOL bRedraw
)
481 HFONT hOldFont
= infoPtr
->Font
;
482 infoPtr
->Font
= hFont
;
483 /* Since infoPtr->Font is not used, there is no need for repaint */
487 static DWORD
PROGRESS_SetRange (PROGRESS_INFO
*infoPtr
, int low
, int high
)
489 DWORD res
= MAKELONG(LOWORD(infoPtr
->MinVal
), LOWORD(infoPtr
->MaxVal
));
491 /* if nothing changes, simply return */
492 if(infoPtr
->MinVal
== low
&& infoPtr
->MaxVal
== high
) return res
;
494 infoPtr
->MinVal
= low
;
495 infoPtr
->MaxVal
= high
;
496 PROGRESS_CoercePos(infoPtr
);
497 InvalidateRect(infoPtr
->Self
, NULL
, TRUE
);
501 static UINT
PROGRESS_SetPos (PROGRESS_INFO
*infoPtr
, INT pos
)
503 DWORD style
= GetWindowLongW(infoPtr
->Self
, GWL_STYLE
);
505 if (style
& PBS_MARQUEE
)
507 PROGRESS_UpdateMarquee(infoPtr
);
513 oldVal
= infoPtr
->CurVal
;
515 infoPtr
->CurVal
= pos
;
516 PROGRESS_CoercePos(infoPtr
);
517 TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
518 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
519 UpdateWindow( infoPtr
->Self
);
525 /***********************************************************************
528 static LRESULT WINAPI
ProgressWindowProc(HWND hwnd
, UINT message
,
529 WPARAM wParam
, LPARAM lParam
)
531 PROGRESS_INFO
*infoPtr
;
532 static const WCHAR themeClass
[] = L
"Progress";
535 TRACE("hwnd=%p msg=%04x wparam=%lx lParam=%lx\n", hwnd
, message
, wParam
, lParam
);
537 infoPtr
= (PROGRESS_INFO
*)GetWindowLongPtrW(hwnd
, 0);
539 if (!infoPtr
&& message
!= WM_CREATE
)
540 return DefWindowProcW( hwnd
, message
, wParam
, lParam
);
545 DWORD dwExStyle
= GetWindowLongW (hwnd
, GWL_EXSTYLE
);
547 theme
= OpenThemeData (hwnd
, themeClass
);
549 dwExStyle
&= ~(WS_EX_CLIENTEDGE
| WS_EX_WINDOWEDGE
);
550 if (!theme
) dwExStyle
|= WS_EX_STATICEDGE
;
551 SetWindowLongW (hwnd
, GWL_EXSTYLE
, dwExStyle
);
552 /* Force recalculation of a non-client area */
553 SetWindowPos(hwnd
, 0, 0, 0, 0, 0,
554 SWP_FRAMECHANGED
| SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOACTIVATE
);
556 /* allocate memory for info struct */
557 infoPtr
= heap_alloc_zero (sizeof(*infoPtr
));
558 if (!infoPtr
) return -1;
559 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
561 /* initialize the info struct */
562 infoPtr
->Self
= hwnd
;
564 infoPtr
->MaxVal
= 100;
567 infoPtr
->MarqueePos
= 0;
568 infoPtr
->Marquee
= FALSE
;
569 infoPtr
->ColorBar
= CLR_DEFAULT
;
570 infoPtr
->ColorBk
= CLR_DEFAULT
;
573 TRACE("Progress Ctrl creation, hwnd=%p\n", hwnd
);
578 TRACE("Progress Ctrl destruction, hwnd=%p\n", hwnd
);
580 SetWindowLongPtrW(hwnd
, 0, 0);
581 theme
= GetWindowTheme (hwnd
);
582 CloseThemeData (theme
);
589 return (LRESULT
)infoPtr
->Font
;
592 return (LRESULT
)PROGRESS_SetFont(infoPtr
, (HFONT
)wParam
, (BOOL
)lParam
);
596 return PROGRESS_Paint (infoPtr
, (HDC
)wParam
);
599 if (wParam
== ID_MARQUEE_TIMER
)
600 PROGRESS_UpdateMarquee (infoPtr
);
603 case WM_THEMECHANGED
:
605 DWORD dwExStyle
= GetWindowLongW (hwnd
, GWL_EXSTYLE
);
607 theme
= GetWindowTheme (hwnd
);
608 CloseThemeData (theme
);
609 theme
= OpenThemeData (hwnd
, themeClass
);
611 /* WS_EX_STATICEDGE disappears when the control is themed */
613 dwExStyle
&= ~WS_EX_STATICEDGE
;
615 dwExStyle
|= WS_EX_STATICEDGE
;
616 SetWindowLongW (hwnd
, GWL_EXSTYLE
, dwExStyle
);
618 InvalidateRect (hwnd
, NULL
, TRUE
);
625 oldVal
= infoPtr
->CurVal
;
627 infoPtr
->CurVal
+= (INT
)wParam
;
628 PROGRESS_CoercePos (infoPtr
);
629 TRACE("PBM_DELTAPOS: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
630 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
631 UpdateWindow( infoPtr
->Self
);
637 return PROGRESS_SetPos(infoPtr
, wParam
);
640 return PROGRESS_SetRange (infoPtr
, (int)LOWORD(lParam
), (int)HIWORD(lParam
));
645 oldStep
= infoPtr
->Step
;
646 infoPtr
->Step
= (INT
)wParam
;
651 return infoPtr
->Step
;
655 int oldVal
= infoPtr
->CurVal
;
657 if (infoPtr
->MinVal
!= infoPtr
->MaxVal
)
659 infoPtr
->CurVal
+= infoPtr
->Step
;
660 if (infoPtr
->CurVal
> infoPtr
->MaxVal
)
661 infoPtr
->CurVal
= (infoPtr
->CurVal
- infoPtr
->MinVal
) % (infoPtr
->MaxVal
- infoPtr
->MinVal
) + infoPtr
->MinVal
;
662 if (infoPtr
->CurVal
< infoPtr
->MinVal
)
663 infoPtr
->CurVal
= (infoPtr
->CurVal
- infoPtr
->MinVal
) % (infoPtr
->MaxVal
- infoPtr
->MinVal
) + infoPtr
->MaxVal
;
665 if (oldVal
!= infoPtr
->CurVal
)
667 TRACE("PBM_STEPIT: current pos changed from %d to %d\n", oldVal
, infoPtr
->CurVal
);
668 PROGRESS_Invalidate( infoPtr
, oldVal
, infoPtr
->CurVal
);
669 UpdateWindow( infoPtr
->Self
);
677 return PROGRESS_SetRange (infoPtr
, (int)wParam
, (int)lParam
);
681 ((PPBRANGE
)lParam
)->iLow
= infoPtr
->MinVal
;
682 ((PPBRANGE
)lParam
)->iHigh
= infoPtr
->MaxVal
;
684 return wParam
? infoPtr
->MinVal
: infoPtr
->MaxVal
;
687 return infoPtr
->CurVal
;
689 case PBM_SETBARCOLOR
:
691 COLORREF clr
= infoPtr
->ColorBar
;
693 infoPtr
->ColorBar
= (COLORREF
)lParam
;
694 InvalidateRect(hwnd
, NULL
, TRUE
);
698 case PBM_GETBARCOLOR
:
699 return infoPtr
->ColorBar
;
703 COLORREF clr
= infoPtr
->ColorBk
;
705 infoPtr
->ColorBk
= (COLORREF
)lParam
;
706 InvalidateRect(hwnd
, NULL
, TRUE
);
711 return infoPtr
->ColorBk
;
714 if(wParam
!= PBST_NORMAL
)
715 FIXME("state %04lx not yet handled\n", wParam
);
724 UINT period
= lParam
? (UINT
)lParam
: DEFAULT_MARQUEE_PERIOD
;
725 infoPtr
->Marquee
= TRUE
;
726 SetTimer(infoPtr
->Self
, ID_MARQUEE_TIMER
, period
, NULL
);
730 infoPtr
->Marquee
= FALSE
;
731 KillTimer(infoPtr
->Self
, ID_MARQUEE_TIMER
);
733 return infoPtr
->Marquee
;
736 if ((message
>= WM_USER
) && (message
< WM_APP
) && !COMCTL32_IsReflectedMessage(message
))
737 ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message
, wParam
, lParam
);
738 return DefWindowProcW( hwnd
, message
, wParam
, lParam
);
743 /***********************************************************************
744 * PROGRESS_Register [Internal]
746 * Registers the progress bar window class.
748 void PROGRESS_Register (void)
752 ZeroMemory (&wndClass
, sizeof(wndClass
));
753 wndClass
.style
= CS_GLOBALCLASS
| CS_VREDRAW
| CS_HREDRAW
;
754 wndClass
.lpfnWndProc
= ProgressWindowProc
;
755 wndClass
.cbClsExtra
= 0;
756 wndClass
.cbWndExtra
= sizeof (PROGRESS_INFO
*);
757 wndClass
.hCursor
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
758 wndClass
.lpszClassName
= PROGRESS_CLASSW
;
760 RegisterClassW (&wndClass
);
764 /***********************************************************************
765 * PROGRESS_Unregister [Internal]
767 * Unregisters the progress bar window class.
769 void PROGRESS_Unregister (void)
771 UnregisterClassW (PROGRESS_CLASSW
, NULL
);