e18a47ed85d823b1722411a5bf32fdb8d8318ab5
[reactos.git] / dll / win32 / comctl32 / status.c
1 /*
2 * Interface code to StatusWindow widget/control
3 *
4 * Copyright 1996 Bruce Milner
5 * Copyright 1998, 1999 Eric Kohl
6 * Copyright 2002 Dimitrie O. Paun
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 *
22 * NOTE
23 *
24 * This code was audited for completeness against the documented features
25 * of Comctl32.dll version 6.0 on Sep. 24, 2002, by Dimitrie O. Paun.
26 *
27 * Unless otherwise noted, we believe this code to be complete, as per
28 * the specification mentioned above.
29 * If you discover missing features, or bugs, please note them below.
30 *
31 * TODO:
32 * -- CCS_BOTTOM (default)
33 * -- CCS_LEFT
34 * -- CCS_NODIVIDER
35 * -- CCS_NOMOVEX
36 * -- CCS_NOMOVEY
37 * -- CCS_NOPARENTALIGN
38 * -- CCS_RIGHT
39 * -- CCS_TOP
40 * -- CCS_VERT (defaults to RIGHT)
41 */
42
43 #include "comctl32.h"
44
45 WINE_DEFAULT_DEBUG_CHANNEL(statusbar);
46
47 typedef struct
48 {
49 INT x;
50 INT style;
51 RECT bound;
52 LPWSTR text;
53 HICON hIcon;
54 } STATUSWINDOWPART;
55
56 typedef struct
57 {
58 HWND Self;
59 HWND Notify;
60 WORD numParts;
61 UINT height;
62 UINT minHeight; /* at least MIN_PANE_HEIGHT, can be increased by SB_SETMINHEIGHT */
63 BOOL simple;
64 HWND hwndToolTip;
65 HFONT hFont;
66 HFONT hDefaultFont;
67 COLORREF clrBk; /* background color */
68 BOOL bUnicode; /* notify format. TRUE if notifies in Unicode */
69 STATUSWINDOWPART part0; /* simple window */
70 STATUSWINDOWPART* parts;
71 INT horizontalBorder;
72 INT verticalBorder;
73 INT horizontalGap;
74 } STATUS_INFO;
75
76 /*
77 * Run tests using Waite Group Windows95 API Bible Vol. 1&2
78 * The second cdrom contains executables drawstat.exe, gettext.exe,
79 * simple.exe, getparts.exe, setparts.exe, statwnd.exe
80 */
81
82 #define HORZ_BORDER 0
83 #define VERT_BORDER 2
84 #define HORZ_GAP 2
85
86 static const WCHAR themeClass[] = { 'S','t','a','t','u','s',0 };
87
88 /* prototype */
89 static void
90 STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr);
91 static LRESULT
92 STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd);
93
94 static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW)
95 {
96 return isW ? debugstr_w(text) : debugstr_a((LPCSTR)text);
97 }
98
99 static UINT
100 STATUSBAR_ComputeHeight(STATUS_INFO *infoPtr)
101 {
102 HTHEME theme;
103 UINT height;
104 TEXTMETRICW tm;
105 int margin;
106
107 COMCTL32_GetFontMetrics(infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont, &tm);
108 margin = (tm.tmInternalLeading ? tm.tmInternalLeading : 2);
109 height = max(tm.tmHeight + margin + 2*GetSystemMetrics(SM_CYBORDER), infoPtr->minHeight) + infoPtr->verticalBorder;
110
111 if ((theme = GetWindowTheme(infoPtr->Self)))
112 {
113 /* Determine bar height from theme such that the content area is
114 * textHeight pixels large */
115 HDC hdc = GetDC(infoPtr->Self);
116 RECT r;
117
118 SetRect(&r, 0, 0, 0, max(infoPtr->minHeight, tm.tmHeight));
119 if (SUCCEEDED(GetThemeBackgroundExtent(theme, hdc, SP_PANE, 0, &r, &r)))
120 {
121 height = r.bottom - r.top;
122 }
123 ReleaseDC(infoPtr->Self, hdc);
124 }
125
126 TRACE(" textHeight=%d+%d, final height=%d\n", tm.tmHeight, tm.tmInternalLeading, height);
127 return height;
128 }
129
130 static void
131 STATUSBAR_DrawSizeGrip (HTHEME theme, HDC hdc, LPRECT lpRect)
132 {
133 RECT rc = *lpRect;
134
135 TRACE("draw size grip %s\n", wine_dbgstr_rect(lpRect));
136
137 if (theme)
138 {
139 SIZE gripperSize;
140 if (SUCCEEDED (GetThemePartSize (theme, hdc, SP_GRIPPER, 0, lpRect,
141 TS_DRAW, &gripperSize)))
142 {
143 rc.left = rc.right - gripperSize.cx;
144 rc.top = rc.bottom - gripperSize.cy;
145 if (SUCCEEDED (DrawThemeBackground(theme, hdc, SP_GRIPPER, 0, &rc, NULL)))
146 return;
147 }
148 }
149
150 rc.left = max( rc.left, rc.right - GetSystemMetrics(SM_CXVSCROLL) - 1 );
151 rc.top = max( rc.top, rc.bottom - GetSystemMetrics(SM_CYHSCROLL) - 1 );
152 DrawFrameControl( hdc, &rc, DFC_SCROLL, DFCS_SCROLLSIZEGRIP );
153 }
154
155
156 static void
157 STATUSBAR_DrawPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
158 {
159 RECT r = part->bound;
160 UINT border = BDR_SUNKENOUTER;
161 HTHEME theme = GetWindowTheme (infoPtr->Self);
162 int themePart = SP_PANE;
163 int x = 0;
164
165 TRACE("part bound %s\n", wine_dbgstr_rect(&r));
166 if (part->style & SBT_POPOUT)
167 border = BDR_RAISEDOUTER;
168 else if (part->style & SBT_NOBORDERS)
169 border = 0;
170
171 if (theme)
172 {
173 if ((GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
174 && (infoPtr->simple || (itemID == (infoPtr->numParts-1))))
175 themePart = SP_GRIPPERPANE;
176 DrawThemeBackground(theme, hdc, themePart, 0, &r, NULL);
177 }
178 else
179 DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
180
181 if (part->hIcon) {
182 INT cy = r.bottom - r.top;
183 DrawIconEx (hdc, r.left + 2, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
184 x = 2 + cy;
185 }
186
187 if (part->style & SBT_OWNERDRAW) {
188 DRAWITEMSTRUCT dis;
189
190 dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
191 dis.itemID = itemID;
192 dis.hwndItem = infoPtr->Self;
193 dis.hDC = hdc;
194 dis.rcItem = r;
195 dis.itemData = (ULONG_PTR)part->text;
196 SendMessageW (infoPtr->Notify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
197 } else {
198 r.left += x;
199 if (!theme)
200 DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
201 else
202 DrawThemeText(theme, hdc, SP_PANE, 0, part->text, -1, DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX, 0, &r);
203 }
204 }
205
206
207 static void
208 STATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
209 {
210 HBRUSH hbrBk;
211 HTHEME theme;
212
213 TRACE("item %d\n", itemID);
214
215 if (part->bound.right < part->bound.left) return;
216
217 if (!RectVisible(hdc, &part->bound))
218 return;
219
220 if ((theme = GetWindowTheme (infoPtr->Self)))
221 {
222 RECT cr;
223 GetClientRect (infoPtr->Self, &cr);
224 DrawThemeBackground(theme, hdc, 0, 0, &cr, &part->bound);
225 }
226 else
227 {
228 if (infoPtr->clrBk != CLR_DEFAULT)
229 hbrBk = CreateSolidBrush (infoPtr->clrBk);
230 else
231 hbrBk = GetSysColorBrush (COLOR_3DFACE);
232 FillRect(hdc, &part->bound, hbrBk);
233 if (infoPtr->clrBk != CLR_DEFAULT)
234 DeleteObject (hbrBk);
235 }
236
237 STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);
238 }
239
240
241 static LRESULT
242 STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
243 {
244 RECT rect;
245 HBRUSH hbrBk;
246 HFONT hOldFont;
247 HTHEME theme;
248
249 TRACE("\n");
250 if (!IsWindowVisible(infoPtr->Self))
251 return 0;
252
253 STATUSBAR_SetPartBounds(infoPtr);
254
255 GetClientRect (infoPtr->Self, &rect);
256
257 if ((theme = GetWindowTheme (infoPtr->Self)))
258 {
259 DrawThemeBackground(theme, hdc, 0, 0, &rect, NULL);
260 }
261 else
262 {
263 if (infoPtr->clrBk != CLR_DEFAULT)
264 hbrBk = CreateSolidBrush (infoPtr->clrBk);
265 else
266 hbrBk = GetSysColorBrush (COLOR_3DFACE);
267 FillRect(hdc, &rect, hbrBk);
268 if (infoPtr->clrBk != CLR_DEFAULT)
269 DeleteObject (hbrBk);
270 }
271
272 hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
273
274 if (infoPtr->simple) {
275 STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
276 } else {
277 unsigned int i;
278
279 for (i = 0; i < infoPtr->numParts; i++) {
280 STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
281 }
282 }
283
284 SelectObject (hdc, hOldFont);
285
286 if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
287 STATUSBAR_DrawSizeGrip (theme, hdc, &rect);
288
289 return 0;
290 }
291
292
293 static int
294 STATUSBAR_InternalHitTest(const STATUS_INFO *infoPtr, const POINT *pt)
295 {
296 unsigned int i;
297
298 if (infoPtr->simple)
299 return 255;
300
301 for (i = 0; i < infoPtr->numParts; i++)
302 if (pt->x >= infoPtr->parts[i].bound.left && pt->x <= infoPtr->parts[i].bound.right)
303 return i;
304 return -2;
305 }
306
307
308 static void
309 STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
310 {
311 STATUSWINDOWPART *part;
312 RECT rect, *r;
313 UINT i;
314
315 /* get our window size */
316 GetClientRect (infoPtr->Self, &rect);
317 TRACE("client wnd size is %s\n", wine_dbgstr_rect(&rect));
318
319 rect.left += infoPtr->horizontalBorder;
320 rect.top += infoPtr->verticalBorder;
321
322 /* set bounds for simple rectangle */
323 infoPtr->part0.bound = rect;
324
325 /* set bounds for non-simple rectangles */
326 for (i = 0; i < infoPtr->numParts; i++) {
327 part = &infoPtr->parts[i];
328 r = &infoPtr->parts[i].bound;
329 r->top = rect.top;
330 r->bottom = rect.bottom;
331 if (i == 0)
332 r->left = 0;
333 else
334 r->left = infoPtr->parts[i-1].bound.right + infoPtr->horizontalGap;
335 if (part->x == -1)
336 r->right = rect.right;
337 else
338 r->right = part->x;
339
340 if (infoPtr->hwndToolTip) {
341 TTTOOLINFOW ti;
342
343 ti.cbSize = sizeof(TTTOOLINFOW);
344 ti.hwnd = infoPtr->Self;
345 ti.uId = i;
346 ti.rect = *r;
347 SendMessageW (infoPtr->hwndToolTip, TTM_NEWTOOLRECTW,
348 0, (LPARAM)&ti);
349 }
350 }
351 }
352
353
354 static LRESULT
355 STATUSBAR_Relay2Tip (const STATUS_INFO *infoPtr, UINT uMsg,
356 WPARAM wParam, LPARAM lParam)
357 {
358 MSG msg;
359
360 msg.hwnd = infoPtr->Self;
361 msg.message = uMsg;
362 msg.wParam = wParam;
363 msg.lParam = lParam;
364 msg.time = GetMessageTime ();
365 msg.pt.x = (short)LOWORD(GetMessagePos ());
366 msg.pt.y = (short)HIWORD(GetMessagePos ());
367
368 return SendMessageW (infoPtr->hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
369 }
370
371
372 static BOOL
373 STATUSBAR_GetBorders (const STATUS_INFO *infoPtr, INT out[])
374 {
375 TRACE("\n");
376 out[0] = infoPtr->horizontalBorder;
377 out[1] = infoPtr->verticalBorder;
378 out[2] = infoPtr->horizontalGap;
379
380 return TRUE;
381 }
382
383
384 static BOOL
385 STATUSBAR_SetBorders (STATUS_INFO *infoPtr, const INT in[])
386 {
387 TRACE("\n");
388 infoPtr->horizontalBorder = in[0];
389 infoPtr->verticalBorder = in[1];
390 infoPtr->horizontalGap = in[2];
391 InvalidateRect(infoPtr->Self, NULL, FALSE);
392
393 return TRUE;
394 }
395
396
397 static HICON
398 STATUSBAR_GetIcon (const STATUS_INFO *infoPtr, INT nPart)
399 {
400 TRACE("%d\n", nPart);
401 /* MSDN says: "simple parts are indexed with -1" */
402 if ((nPart < -1) || (nPart >= infoPtr->numParts))
403 return 0;
404
405 if (nPart == -1)
406 return (infoPtr->part0.hIcon);
407 else
408 return (infoPtr->parts[nPart].hIcon);
409 }
410
411
412 static INT
413 STATUSBAR_GetParts (const STATUS_INFO *infoPtr, INT num_parts, INT parts[])
414 {
415 INT i;
416
417 TRACE("(%d)\n", num_parts);
418 if (parts) {
419 for (i = 0; i < num_parts; i++) {
420 parts[i] = infoPtr->parts[i].x;
421 }
422 }
423 return infoPtr->numParts;
424 }
425
426
427 static BOOL
428 STATUSBAR_GetRect (const STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
429 {
430 TRACE("part %d\n", nPart);
431 if(nPart >= infoPtr->numParts || nPart < 0)
432 return FALSE;
433 if (infoPtr->simple)
434 *rect = infoPtr->part0.bound;
435 else
436 *rect = infoPtr->parts[nPart].bound;
437 return TRUE;
438 }
439
440
441 static LRESULT
442 STATUSBAR_GetTextA (STATUS_INFO *infoPtr, INT nPart, LPSTR buf)
443 {
444 STATUSWINDOWPART *part;
445 LRESULT result;
446
447 TRACE("part %d\n", nPart);
448
449 /* MSDN says: "simple parts use index of 0", so this check is ok. */
450 if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
451
452 if (infoPtr->simple)
453 part = &infoPtr->part0;
454 else
455 part = &infoPtr->parts[nPart];
456
457 if (part->style & SBT_OWNERDRAW)
458 result = (LRESULT)part->text;
459 else {
460 DWORD len = part->text ? WideCharToMultiByte( CP_ACP, 0, part->text, -1,
461 NULL, 0, NULL, NULL ) - 1 : 0;
462 result = MAKELONG( len, part->style );
463 if (part->text && buf)
464 WideCharToMultiByte( CP_ACP, 0, part->text, -1, buf, len+1, NULL, NULL );
465 }
466 return result;
467 }
468
469
470 static LRESULT
471 STATUSBAR_GetTextW (STATUS_INFO *infoPtr, INT nPart, LPWSTR buf)
472 {
473 STATUSWINDOWPART *part;
474 LRESULT result;
475
476 TRACE("part %d\n", nPart);
477 if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
478
479 if (infoPtr->simple)
480 part = &infoPtr->part0;
481 else
482 part = &infoPtr->parts[nPart];
483
484 if (part->style & SBT_OWNERDRAW)
485 result = (LRESULT)part->text;
486 else {
487 result = part->text ? strlenW (part->text) : 0;
488 result |= (part->style << 16);
489 if (part->text && buf)
490 strcpyW (buf, part->text);
491 }
492 return result;
493 }
494
495
496 static LRESULT
497 STATUSBAR_GetTextLength (STATUS_INFO *infoPtr, INT nPart)
498 {
499 STATUSWINDOWPART *part;
500 DWORD result;
501
502 TRACE("part %d\n", nPart);
503
504 /* MSDN says: "simple parts use index of 0", so this check is ok. */
505 if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
506
507 if (infoPtr->simple)
508 part = &infoPtr->part0;
509 else
510 part = &infoPtr->parts[nPart];
511
512 if ((~part->style & SBT_OWNERDRAW) && part->text)
513 result = strlenW(part->text);
514 else
515 result = 0;
516
517 result |= (part->style << 16);
518 return result;
519 }
520
521 static LRESULT
522 STATUSBAR_GetTipTextA (const STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
523 {
524 TRACE("\n");
525 if (tip) {
526 CHAR buf[INFOTIPSIZE];
527 buf[0]='\0';
528
529 if (infoPtr->hwndToolTip) {
530 TTTOOLINFOA ti;
531 ti.cbSize = sizeof(TTTOOLINFOA);
532 ti.hwnd = infoPtr->Self;
533 ti.uId = id;
534 ti.lpszText = buf;
535 SendMessageA (infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti);
536 }
537 lstrcpynA (tip, buf, size);
538 }
539 return 0;
540 }
541
542
543 static LRESULT
544 STATUSBAR_GetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
545 {
546 TRACE("\n");
547 if (tip) {
548 WCHAR buf[INFOTIPSIZE];
549 buf[0]=0;
550
551 if (infoPtr->hwndToolTip) {
552 TTTOOLINFOW ti;
553 ti.cbSize = sizeof(TTTOOLINFOW);
554 ti.hwnd = infoPtr->Self;
555 ti.uId = id;
556 ti.lpszText = buf;
557 SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti);
558 }
559 lstrcpynW(tip, buf, size);
560 }
561
562 return 0;
563 }
564
565
566 static COLORREF
567 STATUSBAR_SetBkColor (STATUS_INFO *infoPtr, COLORREF color)
568 {
569 COLORREF oldBkColor;
570
571 oldBkColor = infoPtr->clrBk;
572 infoPtr->clrBk = color;
573 InvalidateRect(infoPtr->Self, NULL, FALSE);
574
575 TRACE("CREF: %08x -> %08x\n", oldBkColor, infoPtr->clrBk);
576 return oldBkColor;
577 }
578
579
580 static BOOL
581 STATUSBAR_SetIcon (STATUS_INFO *infoPtr, INT nPart, HICON hIcon)
582 {
583 if ((nPart < -1) || (nPart >= infoPtr->numParts))
584 return FALSE;
585
586 TRACE("setting part %d\n", nPart);
587
588 /* FIXME: MSDN says "if nPart is -1, the status bar is assumed simple" */
589 if (nPart == -1) {
590 if (infoPtr->part0.hIcon == hIcon) /* same as - no redraw */
591 return TRUE;
592 infoPtr->part0.hIcon = hIcon;
593 if (infoPtr->simple)
594 InvalidateRect(infoPtr->Self, &infoPtr->part0.bound, FALSE);
595 } else {
596 if (infoPtr->parts[nPart].hIcon == hIcon) /* same as - no redraw */
597 return TRUE;
598
599 infoPtr->parts[nPart].hIcon = hIcon;
600 if (!(infoPtr->simple))
601 InvalidateRect(infoPtr->Self, &infoPtr->parts[nPart].bound, FALSE);
602 }
603 return TRUE;
604 }
605
606
607 static BOOL
608 STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height)
609 {
610 DWORD ysize = GetSystemMetrics(SM_CYSIZE);
611 if (ysize & 1) ysize--;
612 infoPtr->minHeight = max(height, ysize);
613 infoPtr->height = STATUSBAR_ComputeHeight(infoPtr);
614 /* like native, don't resize the control */
615 return TRUE;
616 }
617
618
619 static BOOL
620 STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
621 {
622 STATUSWINDOWPART *tmp;
623 INT i, oldNumParts;
624
625 TRACE("(%d,%p)\n", count, parts);
626
627 if(!count) return FALSE;
628
629 oldNumParts = infoPtr->numParts;
630 infoPtr->numParts = count;
631 if (oldNumParts > infoPtr->numParts) {
632 for (i = infoPtr->numParts ; i < oldNumParts; i++) {
633 if (!(infoPtr->parts[i].style & SBT_OWNERDRAW))
634 Free (infoPtr->parts[i].text);
635 }
636 } else if (oldNumParts < infoPtr->numParts) {
637 tmp = Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts);
638 if (!tmp) return FALSE;
639 for (i = 0; i < oldNumParts; i++) {
640 tmp[i] = infoPtr->parts[i];
641 }
642 Free (infoPtr->parts);
643 infoPtr->parts = tmp;
644 }
645 if (oldNumParts == infoPtr->numParts) {
646 for (i=0; i < oldNumParts; i++)
647 if (infoPtr->parts[i].x != parts[i])
648 break;
649 if (i==oldNumParts) /* Unchanged? no need to redraw! */
650 return TRUE;
651 }
652
653 for (i = 0; i < infoPtr->numParts; i++)
654 infoPtr->parts[i].x = parts[i];
655
656 if (infoPtr->hwndToolTip) {
657 INT nTipCount;
658 TTTOOLINFOW ti;
659 WCHAR wEmpty = 0;
660
661 ZeroMemory (&ti, sizeof(TTTOOLINFOW));
662 ti.cbSize = sizeof(TTTOOLINFOW);
663 ti.hwnd = infoPtr->Self;
664 ti.lpszText = &wEmpty;
665
666 nTipCount = SendMessageW (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);
667 if (nTipCount < infoPtr->numParts) {
668 /* add tools */
669 for (i = nTipCount; i < infoPtr->numParts; i++) {
670 TRACE("add tool %d\n", i);
671 ti.uId = i;
672 SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW,
673 0, (LPARAM)&ti);
674 }
675 }
676 else if (nTipCount > infoPtr->numParts) {
677 /* delete tools */
678 for (i = nTipCount - 1; i >= infoPtr->numParts; i--) {
679 TRACE("delete tool %d\n", i);
680 ti.uId = i;
681 SendMessageW (infoPtr->hwndToolTip, TTM_DELTOOLW,
682 0, (LPARAM)&ti);
683 }
684 }
685 }
686 STATUSBAR_SetPartBounds (infoPtr);
687 InvalidateRect(infoPtr->Self, NULL, FALSE);
688 return TRUE;
689 }
690
691
692 static BOOL
693 STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
694 LPWSTR text, BOOL isW)
695 {
696 STATUSWINDOWPART *part=NULL;
697 BOOL changed = FALSE;
698 INT oldStyle;
699
700 if (style & SBT_OWNERDRAW) {
701 TRACE("part %d, text %p\n",nPart,text);
702 }
703 else TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW));
704
705 /* MSDN says: "If the parameter is set to SB_SIMPLEID (255), the status
706 * window is assumed to be a simple window */
707
708 if (nPart == 0x00ff) {
709 part = &infoPtr->part0;
710 } else {
711 if (infoPtr->parts && nPart >= 0 && nPart < infoPtr->numParts) {
712 part = &infoPtr->parts[nPart];
713 }
714 }
715 if (!part) return FALSE;
716
717 if (part->style != style)
718 changed = TRUE;
719
720 oldStyle = part->style;
721 part->style = style;
722 if (style & SBT_OWNERDRAW) {
723 if (!(oldStyle & SBT_OWNERDRAW))
724 Free (part->text);
725 part->text = text;
726 } else {
727 LPWSTR ntext;
728 WCHAR *idx;
729
730 if (text && !isW) {
731 LPCSTR atxt = (LPCSTR)text;
732 DWORD len = MultiByteToWideChar( CP_ACP, 0, atxt, -1, NULL, 0 );
733 ntext = Alloc( (len + 1)*sizeof(WCHAR) );
734 if (!ntext) return FALSE;
735 MultiByteToWideChar( CP_ACP, 0, atxt, -1, ntext, len );
736 } else if (text) {
737 ntext = Alloc( (strlenW(text) + 1)*sizeof(WCHAR) );
738 if (!ntext) return FALSE;
739 strcpyW (ntext, text);
740 } else ntext = 0;
741
742 /* replace nonprintable characters with spaces */
743 if (ntext) {
744 idx = ntext;
745 while (*idx) {
746 if(!isprintW(*idx))
747 *idx = ' ';
748 idx++;
749 }
750 }
751
752 /* check if text is unchanged -> no need to redraw */
753 if (text) {
754 if (!changed && part->text && !lstrcmpW(ntext, part->text)) {
755 Free(ntext);
756 return TRUE;
757 }
758 } else {
759 if (!changed && !part->text)
760 return TRUE;
761 }
762
763 if (!(oldStyle & SBT_OWNERDRAW))
764 Free (part->text);
765 part->text = ntext;
766 }
767 InvalidateRect(infoPtr->Self, &part->bound, FALSE);
768 UpdateWindow(infoPtr->Self);
769
770 return TRUE;
771 }
772
773
774 static LRESULT
775 STATUSBAR_SetTipTextA (const STATUS_INFO *infoPtr, INT id, LPSTR text)
776 {
777 TRACE("part %d: \"%s\"\n", id, text);
778 if (infoPtr->hwndToolTip) {
779 TTTOOLINFOA ti;
780 ti.cbSize = sizeof(TTTOOLINFOA);
781 ti.hwnd = infoPtr->Self;
782 ti.uId = id;
783 ti.hinst = 0;
784 ti.lpszText = text;
785 SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, 0, (LPARAM)&ti);
786 }
787
788 return 0;
789 }
790
791
792 static LRESULT
793 STATUSBAR_SetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR text)
794 {
795 TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
796 if (infoPtr->hwndToolTip) {
797 TTTOOLINFOW ti;
798 ti.cbSize = sizeof(TTTOOLINFOW);
799 ti.hwnd = infoPtr->Self;
800 ti.uId = id;
801 ti.hinst = 0;
802 ti.lpszText = text;
803 SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
804 }
805
806 return 0;
807 }
808
809
810 static inline LRESULT
811 STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
812 {
813 BOOL bOld = infoPtr->bUnicode;
814
815 TRACE("(0x%x)\n", bUnicode);
816 infoPtr->bUnicode = bUnicode;
817
818 return bOld;
819 }
820
821
822 static BOOL
823 STATUSBAR_Simple (STATUS_INFO *infoPtr, BOOL simple)
824 {
825 NMHDR nmhdr;
826
827 TRACE("(simple=%d)\n", simple);
828 if (infoPtr->simple == simple) /* no need to change */
829 return TRUE;
830
831 infoPtr->simple = simple;
832
833 /* send notification */
834 nmhdr.hwndFrom = infoPtr->Self;
835 nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
836 nmhdr.code = SBN_SIMPLEMODECHANGE;
837 SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
838 InvalidateRect(infoPtr->Self, NULL, FALSE);
839 return TRUE;
840 }
841
842
843 static LRESULT
844 STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
845 {
846 unsigned int i;
847
848 TRACE("\n");
849 for (i = 0; i < infoPtr->numParts; i++) {
850 if (!(infoPtr->parts[i].style & SBT_OWNERDRAW))
851 Free (infoPtr->parts[i].text);
852 }
853 if (!(infoPtr->part0.style & SBT_OWNERDRAW))
854 Free (infoPtr->part0.text);
855 Free (infoPtr->parts);
856
857 /* delete default font */
858 if (infoPtr->hDefaultFont)
859 DeleteObject (infoPtr->hDefaultFont);
860
861 /* delete tool tip control */
862 if (infoPtr->hwndToolTip)
863 DestroyWindow (infoPtr->hwndToolTip);
864
865 CloseThemeData (GetWindowTheme (infoPtr->Self));
866
867 SetWindowLongPtrW(infoPtr->Self, 0, 0);
868 Free (infoPtr);
869 return 0;
870 }
871
872
873 static LRESULT
874 STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate)
875 {
876 STATUS_INFO *infoPtr;
877 NONCLIENTMETRICSW nclm;
878 DWORD dwStyle;
879 RECT rect;
880 int len;
881
882 TRACE("\n");
883 infoPtr = Alloc (sizeof(STATUS_INFO));
884 if (!infoPtr) goto create_fail;
885 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
886
887 infoPtr->Self = hwnd;
888 infoPtr->Notify = lpCreate->hwndParent;
889 infoPtr->numParts = 1;
890 infoPtr->parts = 0;
891 infoPtr->simple = FALSE;
892 infoPtr->clrBk = CLR_DEFAULT;
893 infoPtr->hFont = 0;
894 infoPtr->horizontalBorder = HORZ_BORDER;
895 infoPtr->verticalBorder = VERT_BORDER;
896 infoPtr->horizontalGap = HORZ_GAP;
897 infoPtr->minHeight = GetSystemMetrics(SM_CYSIZE);
898 if (infoPtr->minHeight & 1) infoPtr->minHeight--;
899
900 STATUSBAR_NotifyFormat(infoPtr, infoPtr->Notify, NF_REQUERY);
901
902 ZeroMemory (&nclm, sizeof(nclm));
903 nclm.cbSize = sizeof(nclm);
904 SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0);
905 infoPtr->hDefaultFont = CreateFontIndirectW (&nclm.lfStatusFont);
906
907 GetClientRect (hwnd, &rect);
908
909 /* initialize simple case */
910 infoPtr->part0.bound = rect;
911 infoPtr->part0.text = 0;
912 infoPtr->part0.x = 0;
913 infoPtr->part0.style = 0;
914 infoPtr->part0.hIcon = 0;
915
916 /* initialize first part */
917 infoPtr->parts = Alloc (sizeof(STATUSWINDOWPART));
918 if (!infoPtr->parts) goto create_fail;
919 infoPtr->parts[0].bound = rect;
920 infoPtr->parts[0].text = 0;
921 infoPtr->parts[0].x = -1;
922 infoPtr->parts[0].style = 0;
923 infoPtr->parts[0].hIcon = 0;
924
925 OpenThemeData (hwnd, themeClass);
926
927 if (lpCreate->lpszName && (len = strlenW ((LPCWSTR)lpCreate->lpszName)))
928 {
929 infoPtr->parts[0].text = Alloc ((len + 1)*sizeof(WCHAR));
930 if (!infoPtr->parts[0].text) goto create_fail;
931 strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
932 }
933
934 dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
935 /* native seems to clear WS_BORDER, too */
936 dwStyle &= ~WS_BORDER;
937 SetWindowLongW (hwnd, GWL_STYLE, dwStyle);
938
939 infoPtr->height = STATUSBAR_ComputeHeight(infoPtr);
940
941 if (dwStyle & SBT_TOOLTIPS) {
942 infoPtr->hwndToolTip =
943 CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, WS_POPUP | TTS_ALWAYSTIP,
944 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
945 CW_USEDEFAULT, hwnd, 0,
946 (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
947
948 if (infoPtr->hwndToolTip) {
949 NMTOOLTIPSCREATED nmttc;
950
951 nmttc.hdr.hwndFrom = hwnd;
952 nmttc.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
953 nmttc.hdr.code = NM_TOOLTIPSCREATED;
954 nmttc.hwndToolTips = infoPtr->hwndToolTip;
955
956 SendMessageW (lpCreate->hwndParent, WM_NOTIFY, nmttc.hdr.idFrom, (LPARAM)&nmttc);
957 }
958 }
959
960 return 0;
961
962 create_fail:
963 TRACE(" failed!\n");
964 if (infoPtr) STATUSBAR_WMDestroy(infoPtr);
965 return -1;
966 }
967
968
969 /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
970 * of the first part only (usual behaviour) */
971 static INT
972 STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf)
973 {
974 INT len;
975
976 TRACE("\n");
977 if (!(infoPtr->parts[0].text))
978 return 0;
979
980 len = strlenW (infoPtr->parts[0].text);
981
982 if (!size)
983 return len;
984 else if (size > len) {
985 strcpyW (buf, infoPtr->parts[0].text);
986 return len;
987 }
988 else {
989 memcpy (buf, infoPtr->parts[0].text, (size - 1) * sizeof(WCHAR));
990 buf[size - 1] = 0;
991 return size - 1;
992 }
993 }
994
995
996 static BOOL
997 STATUSBAR_WMNCHitTest (const STATUS_INFO *infoPtr, INT x, INT y)
998 {
999 if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
1000 RECT rect;
1001 POINT pt;
1002
1003 GetClientRect (infoPtr->Self, &rect);
1004
1005 pt.x = x;
1006 pt.y = y;
1007 ScreenToClient (infoPtr->Self, &pt);
1008
1009 rect.left = rect.right - 13;
1010 rect.top += 2;
1011
1012 if (PtInRect (&rect, pt))
1013 {
1014 if (GetWindowLongW( infoPtr->Self, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) return HTBOTTOMLEFT;
1015 else return HTBOTTOMRIGHT;
1016 }
1017 }
1018
1019 return HTERROR;
1020 }
1021
1022
1023 static LRESULT
1024 STATUSBAR_WMPaint (STATUS_INFO *infoPtr, HDC hdc)
1025 {
1026 PAINTSTRUCT ps;
1027
1028 TRACE("\n");
1029 if (hdc) return STATUSBAR_Refresh (infoPtr, hdc);
1030 hdc = BeginPaint (infoPtr->Self, &ps);
1031 STATUSBAR_Refresh (infoPtr, hdc);
1032 EndPaint (infoPtr->Self, &ps);
1033
1034 return 0;
1035 }
1036
1037
1038 static LRESULT
1039 STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw)
1040 {
1041 infoPtr->hFont = font;
1042 TRACE("%p\n", infoPtr->hFont);
1043
1044 infoPtr->height = STATUSBAR_ComputeHeight(infoPtr);
1045 SendMessageW(infoPtr->Self, WM_SIZE, 0, 0); /* update size */
1046 if (redraw)
1047 InvalidateRect(infoPtr->Self, NULL, FALSE);
1048
1049 return 0;
1050 }
1051
1052
1053 static BOOL
1054 STATUSBAR_WMSetText (const STATUS_INFO *infoPtr, LPCSTR text)
1055 {
1056 STATUSWINDOWPART *part;
1057 int len;
1058
1059 TRACE("\n");
1060 if (infoPtr->numParts == 0)
1061 return FALSE;
1062
1063 part = &infoPtr->parts[0];
1064 /* duplicate string */
1065 Free (part->text);
1066 part->text = 0;
1067
1068 if (text && (len = strlenW((LPCWSTR)text))) {
1069 part->text = Alloc ((len+1)*sizeof(WCHAR));
1070 if (!part->text) return FALSE;
1071 strcpyW (part->text, (LPCWSTR)text);
1072 }
1073
1074 InvalidateRect(infoPtr->Self, &part->bound, FALSE);
1075
1076 return TRUE;
1077 }
1078
1079
1080 static BOOL
1081 STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
1082 {
1083 INT width, x, y;
1084 RECT parent_rect;
1085
1086 /* Need to resize width to match parent */
1087 TRACE("flags %04x\n", flags);
1088
1089 if (flags != SIZE_RESTORED && flags != SIZE_MAXIMIZED) {
1090 WARN("flags MUST be SIZE_RESTORED or SIZE_MAXIMIZED\n");
1091 return FALSE;
1092 }
1093
1094 if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE;
1095
1096 /* width and height don't apply */
1097 if (!GetClientRect (infoPtr->Notify, &parent_rect))
1098 return FALSE;
1099
1100 width = parent_rect.right - parent_rect.left;
1101 x = parent_rect.left;
1102 y = parent_rect.bottom - infoPtr->height;
1103 MoveWindow (infoPtr->Self, x, y, width, infoPtr->height, TRUE);
1104 STATUSBAR_SetPartBounds (infoPtr);
1105 return TRUE;
1106 }
1107
1108
1109 /* update theme after a WM_THEMECHANGED message */
1110 static LRESULT theme_changed (const STATUS_INFO* infoPtr)
1111 {
1112 HTHEME theme = GetWindowTheme (infoPtr->Self);
1113 CloseThemeData (theme);
1114 OpenThemeData (infoPtr->Self, themeClass);
1115 return 0;
1116 }
1117
1118
1119 static LRESULT
1120 STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
1121 {
1122 if (cmd == NF_REQUERY) {
1123 INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY);
1124 infoPtr->bUnicode = (i == NFR_UNICODE);
1125 }
1126 return infoPtr->bUnicode ? NFR_UNICODE : NFR_ANSI;
1127 }
1128
1129
1130 static LRESULT
1131 STATUSBAR_SendMouseNotify(const STATUS_INFO *infoPtr, UINT code, UINT msg, WPARAM wParam, LPARAM lParam)
1132 {
1133 NMMOUSE nm;
1134
1135 TRACE("code %04x, lParam=%lx\n", code, lParam);
1136 nm.hdr.hwndFrom = infoPtr->Self;
1137 nm.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID);
1138 nm.hdr.code = code;
1139 nm.pt.x = (short)LOWORD(lParam);
1140 nm.pt.y = (short)HIWORD(lParam);
1141 nm.dwItemSpec = STATUSBAR_InternalHitTest(infoPtr, &nm.pt);
1142 nm.dwItemData = 0;
1143 nm.dwHitInfo = 0x30000; /* seems constant */
1144
1145 /* Do default processing if WM_NOTIFY returns zero */
1146 if(!SendMessageW(infoPtr->Notify, WM_NOTIFY, nm.hdr.idFrom, (LPARAM)&nm))
1147 {
1148 return DefWindowProcW(infoPtr->Self, msg, wParam, lParam);
1149 }
1150 return 0;
1151 }
1152
1153
1154
1155 static LRESULT WINAPI
1156 StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1157 {
1158 STATUS_INFO *infoPtr = (STATUS_INFO *)GetWindowLongPtrW (hwnd, 0);
1159 INT nPart = ((INT) wParam) & 0x00ff;
1160 LRESULT res;
1161
1162 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
1163 if (!infoPtr && msg != WM_CREATE)
1164 return DefWindowProcW (hwnd, msg, wParam, lParam);
1165
1166 switch (msg) {
1167 case SB_GETBORDERS:
1168 return STATUSBAR_GetBorders (infoPtr, (INT *)lParam);
1169
1170 case SB_GETICON:
1171 return (LRESULT)STATUSBAR_GetIcon (infoPtr, nPart);
1172
1173 case SB_GETPARTS:
1174 return STATUSBAR_GetParts (infoPtr, (INT)wParam, (INT *)lParam);
1175
1176 case SB_GETRECT:
1177 return STATUSBAR_GetRect (infoPtr, nPart, (LPRECT)lParam);
1178
1179 case SB_GETTEXTA:
1180 return STATUSBAR_GetTextA (infoPtr, nPart, (LPSTR)lParam);
1181
1182 case SB_GETTEXTW:
1183 return STATUSBAR_GetTextW (infoPtr, nPart, (LPWSTR)lParam);
1184
1185 case SB_GETTEXTLENGTHA:
1186 case SB_GETTEXTLENGTHW:
1187 return STATUSBAR_GetTextLength (infoPtr, nPart);
1188
1189 case SB_GETTIPTEXTA:
1190 return STATUSBAR_GetTipTextA (infoPtr, LOWORD(wParam), (LPSTR)lParam, HIWORD(wParam));
1191
1192 case SB_GETTIPTEXTW:
1193 return STATUSBAR_GetTipTextW (infoPtr, LOWORD(wParam), (LPWSTR)lParam, HIWORD(wParam));
1194
1195 case SB_GETUNICODEFORMAT:
1196 return infoPtr->bUnicode;
1197
1198 case SB_ISSIMPLE:
1199 return infoPtr->simple;
1200
1201 case SB_SETBORDERS:
1202 return STATUSBAR_SetBorders (infoPtr, (INT *)lParam);
1203
1204 case SB_SETBKCOLOR:
1205 return STATUSBAR_SetBkColor (infoPtr, (COLORREF)lParam);
1206
1207 case SB_SETICON:
1208 return STATUSBAR_SetIcon (infoPtr, nPart, (HICON)lParam);
1209
1210 case SB_SETMINHEIGHT:
1211 return STATUSBAR_SetMinHeight (infoPtr, (INT)wParam);
1212
1213 case SB_SETPARTS:
1214 return STATUSBAR_SetParts (infoPtr, (INT)wParam, (LPINT)lParam);
1215
1216 case SB_SETTEXTA:
1217 return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPWSTR)lParam, FALSE);
1218
1219 case SB_SETTEXTW:
1220 return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPWSTR)lParam, TRUE);
1221
1222 case SB_SETTIPTEXTA:
1223 return STATUSBAR_SetTipTextA (infoPtr, (INT)wParam, (LPSTR)lParam);
1224
1225 case SB_SETTIPTEXTW:
1226 return STATUSBAR_SetTipTextW (infoPtr, (INT)wParam, (LPWSTR)lParam);
1227
1228 case SB_SETUNICODEFORMAT:
1229 return STATUSBAR_SetUnicodeFormat (infoPtr, (BOOL)wParam);
1230
1231 case SB_SIMPLE:
1232 return STATUSBAR_Simple (infoPtr, (BOOL)wParam);
1233
1234 case WM_CREATE:
1235 return STATUSBAR_WMCreate (hwnd, (LPCREATESTRUCTA)lParam);
1236
1237 case WM_DESTROY:
1238 return STATUSBAR_WMDestroy (infoPtr);
1239
1240 case WM_GETFONT:
1241 return (LRESULT)(infoPtr->hFont? infoPtr->hFont : infoPtr->hDefaultFont);
1242
1243 case WM_GETTEXT:
1244 return STATUSBAR_WMGetText (infoPtr, (INT)wParam, (LPWSTR)lParam);
1245
1246 case WM_GETTEXTLENGTH:
1247 return LOWORD(STATUSBAR_GetTextLength (infoPtr, 0));
1248
1249 case WM_LBUTTONDBLCLK:
1250 return STATUSBAR_SendMouseNotify(infoPtr, NM_DBLCLK, msg, wParam, lParam);
1251
1252 case WM_LBUTTONUP:
1253 return STATUSBAR_SendMouseNotify(infoPtr, NM_CLICK, msg, wParam, lParam);
1254
1255 case WM_MOUSEMOVE:
1256 return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
1257
1258 case WM_NCHITTEST:
1259 res = STATUSBAR_WMNCHitTest(infoPtr, (short)LOWORD(lParam),
1260 (short)HIWORD(lParam));
1261 if (res != HTERROR) return res;
1262 return DefWindowProcW (hwnd, msg, wParam, lParam);
1263
1264 case WM_NCLBUTTONUP:
1265 case WM_NCLBUTTONDOWN:
1266 PostMessageW (infoPtr->Notify, msg, wParam, lParam);
1267 return 0;
1268
1269 case WM_NOTIFYFORMAT:
1270 return STATUSBAR_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam);
1271
1272 case WM_PRINTCLIENT:
1273 case WM_PAINT:
1274 return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
1275
1276 case WM_RBUTTONDBLCLK:
1277 return STATUSBAR_SendMouseNotify(infoPtr, NM_RDBLCLK, msg, wParam, lParam);
1278
1279 case WM_RBUTTONUP:
1280 return STATUSBAR_SendMouseNotify(infoPtr, NM_RCLICK, msg, wParam, lParam);
1281
1282 case WM_SETFONT:
1283 return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
1284
1285 case WM_SETTEXT:
1286 return STATUSBAR_WMSetText (infoPtr, (LPCSTR)lParam);
1287
1288 case WM_SIZE:
1289 if (STATUSBAR_WMSize (infoPtr, (WORD)wParam)) return 0;
1290 return DefWindowProcW (hwnd, msg, wParam, lParam);
1291
1292 case WM_SYSCOLORCHANGE:
1293 COMCTL32_RefreshSysColors();
1294 return 0;
1295
1296 case WM_THEMECHANGED:
1297 return theme_changed (infoPtr);
1298
1299 default:
1300 if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg))
1301 ERR("unknown msg %04x wp=%04lx lp=%08lx\n",
1302 msg, wParam, lParam);
1303 return DefWindowProcW (hwnd, msg, wParam, lParam);
1304 }
1305 }
1306
1307
1308 /***********************************************************************
1309 * STATUS_Register [Internal]
1310 *
1311 * Registers the status window class.
1312 */
1313
1314 void
1315 STATUS_Register (void)
1316 {
1317 WNDCLASSW wndClass;
1318
1319 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
1320 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
1321 wndClass.lpfnWndProc = StatusWindowProc;
1322 wndClass.cbClsExtra = 0;
1323 wndClass.cbWndExtra = sizeof(STATUS_INFO *);
1324 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
1325 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1326 wndClass.lpszClassName = STATUSCLASSNAMEW;
1327
1328 RegisterClassW (&wndClass);
1329 }
1330
1331
1332 /***********************************************************************
1333 * STATUS_Unregister [Internal]
1334 *
1335 * Unregisters the status window class.
1336 */
1337
1338 void
1339 STATUS_Unregister (void)
1340 {
1341 UnregisterClassW (STATUSCLASSNAMEW, NULL);
1342 }