[SHELL32] CDrivesFolder: Implement the eject and disconnect menu items. CORE-13841
[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 DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
200 }
201 }
202
203
204 static void
205 STATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
206 {
207 HBRUSH hbrBk;
208 HTHEME theme;
209
210 TRACE("item %d\n", itemID);
211
212 if (part->bound.right < part->bound.left) return;
213
214 if (!RectVisible(hdc, &part->bound))
215 return;
216
217 if ((theme = GetWindowTheme (infoPtr->Self)))
218 {
219 RECT cr;
220 GetClientRect (infoPtr->Self, &cr);
221 DrawThemeBackground(theme, hdc, 0, 0, &cr, &part->bound);
222 }
223 else
224 {
225 if (infoPtr->clrBk != CLR_DEFAULT)
226 hbrBk = CreateSolidBrush (infoPtr->clrBk);
227 else
228 hbrBk = GetSysColorBrush (COLOR_3DFACE);
229 FillRect(hdc, &part->bound, hbrBk);
230 if (infoPtr->clrBk != CLR_DEFAULT)
231 DeleteObject (hbrBk);
232 }
233
234 STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);
235 }
236
237
238 static LRESULT
239 STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
240 {
241 RECT rect;
242 HBRUSH hbrBk;
243 HFONT hOldFont;
244 HTHEME theme;
245
246 TRACE("\n");
247 if (!IsWindowVisible(infoPtr->Self))
248 return 0;
249
250 STATUSBAR_SetPartBounds(infoPtr);
251
252 GetClientRect (infoPtr->Self, &rect);
253
254 if ((theme = GetWindowTheme (infoPtr->Self)))
255 {
256 DrawThemeBackground(theme, hdc, 0, 0, &rect, NULL);
257 }
258 else
259 {
260 if (infoPtr->clrBk != CLR_DEFAULT)
261 hbrBk = CreateSolidBrush (infoPtr->clrBk);
262 else
263 hbrBk = GetSysColorBrush (COLOR_3DFACE);
264 FillRect(hdc, &rect, hbrBk);
265 if (infoPtr->clrBk != CLR_DEFAULT)
266 DeleteObject (hbrBk);
267 }
268
269 hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
270
271 if (infoPtr->simple) {
272 STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
273 } else {
274 unsigned int i;
275
276 for (i = 0; i < infoPtr->numParts; i++) {
277 STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
278 }
279 }
280
281 SelectObject (hdc, hOldFont);
282
283 if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
284 STATUSBAR_DrawSizeGrip (theme, hdc, &rect);
285
286 return 0;
287 }
288
289
290 static int
291 STATUSBAR_InternalHitTest(const STATUS_INFO *infoPtr, const POINT *pt)
292 {
293 unsigned int i;
294
295 if (infoPtr->simple)
296 return 255;
297
298 for (i = 0; i < infoPtr->numParts; i++)
299 if (pt->x >= infoPtr->parts[i].bound.left && pt->x <= infoPtr->parts[i].bound.right)
300 return i;
301 return -2;
302 }
303
304
305 static void
306 STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
307 {
308 STATUSWINDOWPART *part;
309 RECT rect, *r;
310 UINT i;
311
312 /* get our window size */
313 GetClientRect (infoPtr->Self, &rect);
314 TRACE("client wnd size is %s\n", wine_dbgstr_rect(&rect));
315
316 rect.left += infoPtr->horizontalBorder;
317 rect.top += infoPtr->verticalBorder;
318
319 /* set bounds for simple rectangle */
320 infoPtr->part0.bound = rect;
321
322 /* set bounds for non-simple rectangles */
323 for (i = 0; i < infoPtr->numParts; i++) {
324 part = &infoPtr->parts[i];
325 r = &infoPtr->parts[i].bound;
326 r->top = rect.top;
327 r->bottom = rect.bottom;
328 if (i == 0)
329 r->left = 0;
330 else
331 r->left = infoPtr->parts[i-1].bound.right + infoPtr->horizontalGap;
332 if (part->x == -1)
333 r->right = rect.right;
334 else
335 r->right = part->x;
336
337 if (infoPtr->hwndToolTip) {
338 TTTOOLINFOW ti;
339
340 ti.cbSize = sizeof(TTTOOLINFOW);
341 ti.hwnd = infoPtr->Self;
342 ti.uId = i;
343 ti.rect = *r;
344 SendMessageW (infoPtr->hwndToolTip, TTM_NEWTOOLRECTW,
345 0, (LPARAM)&ti);
346 }
347 }
348 }
349
350
351 static LRESULT
352 STATUSBAR_Relay2Tip (const STATUS_INFO *infoPtr, UINT uMsg,
353 WPARAM wParam, LPARAM lParam)
354 {
355 MSG msg;
356
357 msg.hwnd = infoPtr->Self;
358 msg.message = uMsg;
359 msg.wParam = wParam;
360 msg.lParam = lParam;
361 msg.time = GetMessageTime ();
362 msg.pt.x = (short)LOWORD(GetMessagePos ());
363 msg.pt.y = (short)HIWORD(GetMessagePos ());
364
365 return SendMessageW (infoPtr->hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
366 }
367
368
369 static BOOL
370 STATUSBAR_GetBorders (const STATUS_INFO *infoPtr, INT out[])
371 {
372 TRACE("\n");
373 out[0] = infoPtr->horizontalBorder;
374 out[1] = infoPtr->verticalBorder;
375 out[2] = infoPtr->horizontalGap;
376
377 return TRUE;
378 }
379
380
381 static BOOL
382 STATUSBAR_SetBorders (STATUS_INFO *infoPtr, const INT in[])
383 {
384 TRACE("\n");
385 infoPtr->horizontalBorder = in[0];
386 infoPtr->verticalBorder = in[1];
387 infoPtr->horizontalGap = in[2];
388 InvalidateRect(infoPtr->Self, NULL, FALSE);
389
390 return TRUE;
391 }
392
393
394 static HICON
395 STATUSBAR_GetIcon (const STATUS_INFO *infoPtr, INT nPart)
396 {
397 TRACE("%d\n", nPart);
398 /* MSDN says: "simple parts are indexed with -1" */
399 if ((nPart < -1) || (nPart >= infoPtr->numParts))
400 return 0;
401
402 if (nPart == -1)
403 return (infoPtr->part0.hIcon);
404 else
405 return (infoPtr->parts[nPart].hIcon);
406 }
407
408
409 static INT
410 STATUSBAR_GetParts (const STATUS_INFO *infoPtr, INT num_parts, INT parts[])
411 {
412 INT i;
413
414 TRACE("(%d)\n", num_parts);
415 if (parts) {
416 for (i = 0; i < num_parts; i++) {
417 parts[i] = infoPtr->parts[i].x;
418 }
419 }
420 return infoPtr->numParts;
421 }
422
423
424 static BOOL
425 STATUSBAR_GetRect (const STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
426 {
427 TRACE("part %d\n", nPart);
428 if(nPart >= infoPtr->numParts || nPart < 0)
429 return FALSE;
430 if (infoPtr->simple)
431 *rect = infoPtr->part0.bound;
432 else
433 *rect = infoPtr->parts[nPart].bound;
434 return TRUE;
435 }
436
437
438 static LRESULT
439 STATUSBAR_GetTextA (STATUS_INFO *infoPtr, INT nPart, LPSTR buf)
440 {
441 STATUSWINDOWPART *part;
442 LRESULT result;
443
444 TRACE("part %d\n", nPart);
445
446 /* MSDN says: "simple parts use index of 0", so this check is ok. */
447 if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
448
449 if (infoPtr->simple)
450 part = &infoPtr->part0;
451 else
452 part = &infoPtr->parts[nPart];
453
454 if (part->style & SBT_OWNERDRAW)
455 result = (LRESULT)part->text;
456 else {
457 DWORD len = part->text ? WideCharToMultiByte( CP_ACP, 0, part->text, -1,
458 NULL, 0, NULL, NULL ) - 1 : 0;
459 result = MAKELONG( len, part->style );
460 if (part->text && buf)
461 WideCharToMultiByte( CP_ACP, 0, part->text, -1, buf, len+1, NULL, NULL );
462 }
463 return result;
464 }
465
466
467 static LRESULT
468 STATUSBAR_GetTextW (STATUS_INFO *infoPtr, INT nPart, LPWSTR buf)
469 {
470 STATUSWINDOWPART *part;
471 LRESULT result;
472
473 TRACE("part %d\n", nPart);
474 if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
475
476 if (infoPtr->simple)
477 part = &infoPtr->part0;
478 else
479 part = &infoPtr->parts[nPart];
480
481 if (part->style & SBT_OWNERDRAW)
482 result = (LRESULT)part->text;
483 else {
484 result = part->text ? strlenW (part->text) : 0;
485 result |= (part->style << 16);
486 if (part->text && buf)
487 strcpyW (buf, part->text);
488 }
489 return result;
490 }
491
492
493 static LRESULT
494 STATUSBAR_GetTextLength (STATUS_INFO *infoPtr, INT nPart)
495 {
496 STATUSWINDOWPART *part;
497 DWORD result;
498
499 TRACE("part %d\n", nPart);
500
501 /* MSDN says: "simple parts use index of 0", so this check is ok. */
502 if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
503
504 if (infoPtr->simple)
505 part = &infoPtr->part0;
506 else
507 part = &infoPtr->parts[nPart];
508
509 if ((~part->style & SBT_OWNERDRAW) && part->text)
510 result = strlenW(part->text);
511 else
512 result = 0;
513
514 result |= (part->style << 16);
515 return result;
516 }
517
518 static LRESULT
519 STATUSBAR_GetTipTextA (const STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
520 {
521 TRACE("\n");
522 if (tip) {
523 CHAR buf[INFOTIPSIZE];
524 buf[0]='\0';
525
526 if (infoPtr->hwndToolTip) {
527 TTTOOLINFOA ti;
528 ti.cbSize = sizeof(TTTOOLINFOA);
529 ti.hwnd = infoPtr->Self;
530 ti.uId = id;
531 ti.lpszText = buf;
532 SendMessageA (infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti);
533 }
534 lstrcpynA (tip, buf, size);
535 }
536 return 0;
537 }
538
539
540 static LRESULT
541 STATUSBAR_GetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
542 {
543 TRACE("\n");
544 if (tip) {
545 WCHAR buf[INFOTIPSIZE];
546 buf[0]=0;
547
548 if (infoPtr->hwndToolTip) {
549 TTTOOLINFOW ti;
550 ti.cbSize = sizeof(TTTOOLINFOW);
551 ti.hwnd = infoPtr->Self;
552 ti.uId = id;
553 ti.lpszText = buf;
554 SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti);
555 }
556 lstrcpynW(tip, buf, size);
557 }
558
559 return 0;
560 }
561
562
563 static COLORREF
564 STATUSBAR_SetBkColor (STATUS_INFO *infoPtr, COLORREF color)
565 {
566 COLORREF oldBkColor;
567
568 oldBkColor = infoPtr->clrBk;
569 infoPtr->clrBk = color;
570 InvalidateRect(infoPtr->Self, NULL, FALSE);
571
572 TRACE("CREF: %08x -> %08x\n", oldBkColor, infoPtr->clrBk);
573 return oldBkColor;
574 }
575
576
577 static BOOL
578 STATUSBAR_SetIcon (STATUS_INFO *infoPtr, INT nPart, HICON hIcon)
579 {
580 if ((nPart < -1) || (nPart >= infoPtr->numParts))
581 return FALSE;
582
583 TRACE("setting part %d\n", nPart);
584
585 /* FIXME: MSDN says "if nPart is -1, the status bar is assumed simple" */
586 if (nPart == -1) {
587 if (infoPtr->part0.hIcon == hIcon) /* same as - no redraw */
588 return TRUE;
589 infoPtr->part0.hIcon = hIcon;
590 if (infoPtr->simple)
591 InvalidateRect(infoPtr->Self, &infoPtr->part0.bound, FALSE);
592 } else {
593 if (infoPtr->parts[nPart].hIcon == hIcon) /* same as - no redraw */
594 return TRUE;
595
596 infoPtr->parts[nPart].hIcon = hIcon;
597 if (!(infoPtr->simple))
598 InvalidateRect(infoPtr->Self, &infoPtr->parts[nPart].bound, FALSE);
599 }
600 return TRUE;
601 }
602
603
604 static BOOL
605 STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height)
606 {
607 DWORD ysize = GetSystemMetrics(SM_CYSIZE);
608 if (ysize & 1) ysize--;
609 infoPtr->minHeight = max(height, ysize);
610 infoPtr->height = STATUSBAR_ComputeHeight(infoPtr);
611 /* like native, don't resize the control */
612 return TRUE;
613 }
614
615
616 static BOOL
617 STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
618 {
619 STATUSWINDOWPART *tmp;
620 INT i, oldNumParts;
621
622 TRACE("(%d,%p)\n", count, parts);
623
624 if(!count) return FALSE;
625
626 oldNumParts = infoPtr->numParts;
627 infoPtr->numParts = count;
628 if (oldNumParts > infoPtr->numParts) {
629 for (i = infoPtr->numParts ; i < oldNumParts; i++) {
630 if (!(infoPtr->parts[i].style & SBT_OWNERDRAW))
631 Free (infoPtr->parts[i].text);
632 }
633 } else if (oldNumParts < infoPtr->numParts) {
634 tmp = Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts);
635 if (!tmp) return FALSE;
636 for (i = 0; i < oldNumParts; i++) {
637 tmp[i] = infoPtr->parts[i];
638 }
639 Free (infoPtr->parts);
640 infoPtr->parts = tmp;
641 }
642 if (oldNumParts == infoPtr->numParts) {
643 for (i=0; i < oldNumParts; i++)
644 if (infoPtr->parts[i].x != parts[i])
645 break;
646 if (i==oldNumParts) /* Unchanged? no need to redraw! */
647 return TRUE;
648 }
649
650 for (i = 0; i < infoPtr->numParts; i++)
651 infoPtr->parts[i].x = parts[i];
652
653 if (infoPtr->hwndToolTip) {
654 INT nTipCount;
655 TTTOOLINFOW ti;
656 WCHAR wEmpty = 0;
657
658 ZeroMemory (&ti, sizeof(TTTOOLINFOW));
659 ti.cbSize = sizeof(TTTOOLINFOW);
660 ti.hwnd = infoPtr->Self;
661 ti.lpszText = &wEmpty;
662
663 nTipCount = SendMessageW (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);
664 if (nTipCount < infoPtr->numParts) {
665 /* add tools */
666 for (i = nTipCount; i < infoPtr->numParts; i++) {
667 TRACE("add tool %d\n", i);
668 ti.uId = i;
669 SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW,
670 0, (LPARAM)&ti);
671 }
672 }
673 else if (nTipCount > infoPtr->numParts) {
674 /* delete tools */
675 for (i = nTipCount - 1; i >= infoPtr->numParts; i--) {
676 TRACE("delete tool %d\n", i);
677 ti.uId = i;
678 SendMessageW (infoPtr->hwndToolTip, TTM_DELTOOLW,
679 0, (LPARAM)&ti);
680 }
681 }
682 }
683 STATUSBAR_SetPartBounds (infoPtr);
684 InvalidateRect(infoPtr->Self, NULL, FALSE);
685 return TRUE;
686 }
687
688
689 static BOOL
690 STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
691 LPWSTR text, BOOL isW)
692 {
693 STATUSWINDOWPART *part=NULL;
694 BOOL changed = FALSE;
695 INT oldStyle;
696
697 if (style & SBT_OWNERDRAW) {
698 TRACE("part %d, text %p\n",nPart,text);
699 }
700 else TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW));
701
702 /* MSDN says: "If the parameter is set to SB_SIMPLEID (255), the status
703 * window is assumed to be a simple window */
704
705 if (nPart == 0x00ff) {
706 part = &infoPtr->part0;
707 } else {
708 if (infoPtr->parts && nPart >= 0 && nPart < infoPtr->numParts) {
709 part = &infoPtr->parts[nPart];
710 }
711 }
712 if (!part) return FALSE;
713
714 if (part->style != style)
715 changed = TRUE;
716
717 oldStyle = part->style;
718 part->style = style;
719 if (style & SBT_OWNERDRAW) {
720 if (!(oldStyle & SBT_OWNERDRAW))
721 Free (part->text);
722 part->text = text;
723 } else {
724 LPWSTR ntext;
725 WCHAR *idx;
726
727 if (text && !isW) {
728 LPCSTR atxt = (LPCSTR)text;
729 DWORD len = MultiByteToWideChar( CP_ACP, 0, atxt, -1, NULL, 0 );
730 ntext = Alloc( (len + 1)*sizeof(WCHAR) );
731 if (!ntext) return FALSE;
732 MultiByteToWideChar( CP_ACP, 0, atxt, -1, ntext, len );
733 } else if (text) {
734 ntext = Alloc( (strlenW(text) + 1)*sizeof(WCHAR) );
735 if (!ntext) return FALSE;
736 strcpyW (ntext, text);
737 } else ntext = 0;
738
739 /* replace nonprintable characters with spaces */
740 if (ntext) {
741 idx = ntext;
742 while (*idx) {
743 if(!isprintW(*idx))
744 *idx = ' ';
745 idx++;
746 }
747 }
748
749 /* check if text is unchanged -> no need to redraw */
750 if (text) {
751 if (!changed && part->text && !lstrcmpW(ntext, part->text)) {
752 Free(ntext);
753 return TRUE;
754 }
755 } else {
756 if (!changed && !part->text)
757 return TRUE;
758 }
759
760 if (!(oldStyle & SBT_OWNERDRAW))
761 Free (part->text);
762 part->text = ntext;
763 }
764 InvalidateRect(infoPtr->Self, &part->bound, FALSE);
765 UpdateWindow(infoPtr->Self);
766
767 return TRUE;
768 }
769
770
771 static LRESULT
772 STATUSBAR_SetTipTextA (const STATUS_INFO *infoPtr, INT id, LPSTR text)
773 {
774 TRACE("part %d: \"%s\"\n", id, text);
775 if (infoPtr->hwndToolTip) {
776 TTTOOLINFOA ti;
777 ti.cbSize = sizeof(TTTOOLINFOA);
778 ti.hwnd = infoPtr->Self;
779 ti.uId = id;
780 ti.hinst = 0;
781 ti.lpszText = text;
782 SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, 0, (LPARAM)&ti);
783 }
784
785 return 0;
786 }
787
788
789 static LRESULT
790 STATUSBAR_SetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR text)
791 {
792 TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
793 if (infoPtr->hwndToolTip) {
794 TTTOOLINFOW ti;
795 ti.cbSize = sizeof(TTTOOLINFOW);
796 ti.hwnd = infoPtr->Self;
797 ti.uId = id;
798 ti.hinst = 0;
799 ti.lpszText = text;
800 SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
801 }
802
803 return 0;
804 }
805
806
807 static inline LRESULT
808 STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
809 {
810 BOOL bOld = infoPtr->bUnicode;
811
812 TRACE("(0x%x)\n", bUnicode);
813 infoPtr->bUnicode = bUnicode;
814
815 return bOld;
816 }
817
818
819 static BOOL
820 STATUSBAR_Simple (STATUS_INFO *infoPtr, BOOL simple)
821 {
822 NMHDR nmhdr;
823
824 TRACE("(simple=%d)\n", simple);
825 if (infoPtr->simple == simple) /* no need to change */
826 return TRUE;
827
828 infoPtr->simple = simple;
829
830 /* send notification */
831 nmhdr.hwndFrom = infoPtr->Self;
832 nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
833 nmhdr.code = SBN_SIMPLEMODECHANGE;
834 SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
835 InvalidateRect(infoPtr->Self, NULL, FALSE);
836 return TRUE;
837 }
838
839
840 static LRESULT
841 STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
842 {
843 unsigned int i;
844
845 TRACE("\n");
846 for (i = 0; i < infoPtr->numParts; i++) {
847 if (!(infoPtr->parts[i].style & SBT_OWNERDRAW))
848 Free (infoPtr->parts[i].text);
849 }
850 if (!(infoPtr->part0.style & SBT_OWNERDRAW))
851 Free (infoPtr->part0.text);
852 Free (infoPtr->parts);
853
854 /* delete default font */
855 if (infoPtr->hDefaultFont)
856 DeleteObject (infoPtr->hDefaultFont);
857
858 /* delete tool tip control */
859 if (infoPtr->hwndToolTip)
860 DestroyWindow (infoPtr->hwndToolTip);
861
862 CloseThemeData (GetWindowTheme (infoPtr->Self));
863
864 SetWindowLongPtrW(infoPtr->Self, 0, 0);
865 Free (infoPtr);
866 return 0;
867 }
868
869
870 static LRESULT
871 STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate)
872 {
873 STATUS_INFO *infoPtr;
874 NONCLIENTMETRICSW nclm;
875 DWORD dwStyle;
876 RECT rect;
877 int len;
878
879 TRACE("\n");
880 infoPtr = Alloc (sizeof(STATUS_INFO));
881 if (!infoPtr) goto create_fail;
882 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
883
884 infoPtr->Self = hwnd;
885 infoPtr->Notify = lpCreate->hwndParent;
886 infoPtr->numParts = 1;
887 infoPtr->parts = 0;
888 infoPtr->simple = FALSE;
889 infoPtr->clrBk = CLR_DEFAULT;
890 infoPtr->hFont = 0;
891 infoPtr->horizontalBorder = HORZ_BORDER;
892 infoPtr->verticalBorder = VERT_BORDER;
893 infoPtr->horizontalGap = HORZ_GAP;
894 infoPtr->minHeight = GetSystemMetrics(SM_CYSIZE);
895 if (infoPtr->minHeight & 1) infoPtr->minHeight--;
896
897 STATUSBAR_NotifyFormat(infoPtr, infoPtr->Notify, NF_REQUERY);
898
899 ZeroMemory (&nclm, sizeof(nclm));
900 nclm.cbSize = sizeof(nclm);
901 SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0);
902 infoPtr->hDefaultFont = CreateFontIndirectW (&nclm.lfStatusFont);
903
904 GetClientRect (hwnd, &rect);
905
906 /* initialize simple case */
907 infoPtr->part0.bound = rect;
908 infoPtr->part0.text = 0;
909 infoPtr->part0.x = 0;
910 infoPtr->part0.style = 0;
911 infoPtr->part0.hIcon = 0;
912
913 /* initialize first part */
914 infoPtr->parts = Alloc (sizeof(STATUSWINDOWPART));
915 if (!infoPtr->parts) goto create_fail;
916 infoPtr->parts[0].bound = rect;
917 infoPtr->parts[0].text = 0;
918 infoPtr->parts[0].x = -1;
919 infoPtr->parts[0].style = 0;
920 infoPtr->parts[0].hIcon = 0;
921
922 OpenThemeData (hwnd, themeClass);
923
924 if (lpCreate->lpszName && (len = strlenW ((LPCWSTR)lpCreate->lpszName)))
925 {
926 infoPtr->parts[0].text = Alloc ((len + 1)*sizeof(WCHAR));
927 if (!infoPtr->parts[0].text) goto create_fail;
928 strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
929 }
930
931 dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
932 /* native seems to clear WS_BORDER, too */
933 dwStyle &= ~WS_BORDER;
934 SetWindowLongW (hwnd, GWL_STYLE, dwStyle);
935
936 infoPtr->height = STATUSBAR_ComputeHeight(infoPtr);
937
938 if (dwStyle & SBT_TOOLTIPS) {
939 infoPtr->hwndToolTip =
940 CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, WS_POPUP | TTS_ALWAYSTIP,
941 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
942 CW_USEDEFAULT, hwnd, 0,
943 (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
944
945 if (infoPtr->hwndToolTip) {
946 NMTOOLTIPSCREATED nmttc;
947
948 nmttc.hdr.hwndFrom = hwnd;
949 nmttc.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
950 nmttc.hdr.code = NM_TOOLTIPSCREATED;
951 nmttc.hwndToolTips = infoPtr->hwndToolTip;
952
953 SendMessageW (lpCreate->hwndParent, WM_NOTIFY, nmttc.hdr.idFrom, (LPARAM)&nmttc);
954 }
955 }
956
957 return 0;
958
959 create_fail:
960 TRACE(" failed!\n");
961 if (infoPtr) STATUSBAR_WMDestroy(infoPtr);
962 return -1;
963 }
964
965
966 /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
967 * of the first part only (usual behaviour) */
968 static INT
969 STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf)
970 {
971 INT len;
972
973 TRACE("\n");
974 if (!(infoPtr->parts[0].text))
975 return 0;
976
977 len = strlenW (infoPtr->parts[0].text);
978
979 if (!size)
980 return len;
981 else if (size > len) {
982 strcpyW (buf, infoPtr->parts[0].text);
983 return len;
984 }
985 else {
986 memcpy (buf, infoPtr->parts[0].text, (size - 1) * sizeof(WCHAR));
987 buf[size - 1] = 0;
988 return size - 1;
989 }
990 }
991
992
993 static BOOL
994 STATUSBAR_WMNCHitTest (const STATUS_INFO *infoPtr, INT x, INT y)
995 {
996 if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
997 RECT rect;
998 POINT pt;
999
1000 GetClientRect (infoPtr->Self, &rect);
1001
1002 pt.x = x;
1003 pt.y = y;
1004 ScreenToClient (infoPtr->Self, &pt);
1005
1006 rect.left = rect.right - 13;
1007 rect.top += 2;
1008
1009 if (PtInRect (&rect, pt))
1010 {
1011 if (GetWindowLongW( infoPtr->Self, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) return HTBOTTOMLEFT;
1012 else return HTBOTTOMRIGHT;
1013 }
1014 }
1015
1016 return HTERROR;
1017 }
1018
1019
1020 static LRESULT
1021 STATUSBAR_WMPaint (STATUS_INFO *infoPtr, HDC hdc)
1022 {
1023 PAINTSTRUCT ps;
1024
1025 TRACE("\n");
1026 if (hdc) return STATUSBAR_Refresh (infoPtr, hdc);
1027 hdc = BeginPaint (infoPtr->Self, &ps);
1028 STATUSBAR_Refresh (infoPtr, hdc);
1029 EndPaint (infoPtr->Self, &ps);
1030
1031 return 0;
1032 }
1033
1034
1035 static LRESULT
1036 STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw)
1037 {
1038 infoPtr->hFont = font;
1039 TRACE("%p\n", infoPtr->hFont);
1040
1041 infoPtr->height = STATUSBAR_ComputeHeight(infoPtr);
1042 SendMessageW(infoPtr->Self, WM_SIZE, 0, 0); /* update size */
1043 if (redraw)
1044 InvalidateRect(infoPtr->Self, NULL, FALSE);
1045
1046 return 0;
1047 }
1048
1049
1050 static BOOL
1051 STATUSBAR_WMSetText (const STATUS_INFO *infoPtr, LPCSTR text)
1052 {
1053 STATUSWINDOWPART *part;
1054 int len;
1055
1056 TRACE("\n");
1057 if (infoPtr->numParts == 0)
1058 return FALSE;
1059
1060 part = &infoPtr->parts[0];
1061 /* duplicate string */
1062 Free (part->text);
1063 part->text = 0;
1064
1065 if (text && (len = strlenW((LPCWSTR)text))) {
1066 part->text = Alloc ((len+1)*sizeof(WCHAR));
1067 if (!part->text) return FALSE;
1068 strcpyW (part->text, (LPCWSTR)text);
1069 }
1070
1071 InvalidateRect(infoPtr->Self, &part->bound, FALSE);
1072
1073 return TRUE;
1074 }
1075
1076
1077 static BOOL
1078 STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
1079 {
1080 INT width, x, y;
1081 RECT parent_rect;
1082
1083 /* Need to resize width to match parent */
1084 TRACE("flags %04x\n", flags);
1085
1086 if (flags != SIZE_RESTORED && flags != SIZE_MAXIMIZED) {
1087 WARN("flags MUST be SIZE_RESTORED or SIZE_MAXIMIZED\n");
1088 return FALSE;
1089 }
1090
1091 if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE;
1092
1093 /* width and height don't apply */
1094 if (!GetClientRect (infoPtr->Notify, &parent_rect))
1095 return FALSE;
1096
1097 width = parent_rect.right - parent_rect.left;
1098 x = parent_rect.left;
1099 y = parent_rect.bottom - infoPtr->height;
1100 MoveWindow (infoPtr->Self, x, y, width, infoPtr->height, TRUE);
1101 STATUSBAR_SetPartBounds (infoPtr);
1102 return TRUE;
1103 }
1104
1105
1106 /* update theme after a WM_THEMECHANGED message */
1107 static LRESULT theme_changed (const STATUS_INFO* infoPtr)
1108 {
1109 HTHEME theme = GetWindowTheme (infoPtr->Self);
1110 CloseThemeData (theme);
1111 OpenThemeData (infoPtr->Self, themeClass);
1112 return 0;
1113 }
1114
1115
1116 static LRESULT
1117 STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
1118 {
1119 if (cmd == NF_REQUERY) {
1120 INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY);
1121 infoPtr->bUnicode = (i == NFR_UNICODE);
1122 }
1123 return infoPtr->bUnicode ? NFR_UNICODE : NFR_ANSI;
1124 }
1125
1126
1127 static LRESULT
1128 STATUSBAR_SendMouseNotify(const STATUS_INFO *infoPtr, UINT code, UINT msg, WPARAM wParam, LPARAM lParam)
1129 {
1130 NMMOUSE nm;
1131
1132 TRACE("code %04x, lParam=%lx\n", code, lParam);
1133 nm.hdr.hwndFrom = infoPtr->Self;
1134 nm.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID);
1135 nm.hdr.code = code;
1136 nm.pt.x = (short)LOWORD(lParam);
1137 nm.pt.y = (short)HIWORD(lParam);
1138 nm.dwItemSpec = STATUSBAR_InternalHitTest(infoPtr, &nm.pt);
1139 nm.dwItemData = 0;
1140 nm.dwHitInfo = 0x30000; /* seems constant */
1141
1142 /* Do default processing if WM_NOTIFY returns zero */
1143 if(!SendMessageW(infoPtr->Notify, WM_NOTIFY, nm.hdr.idFrom, (LPARAM)&nm))
1144 {
1145 return DefWindowProcW(infoPtr->Self, msg, wParam, lParam);
1146 }
1147 return 0;
1148 }
1149
1150
1151
1152 static LRESULT WINAPI
1153 StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1154 {
1155 STATUS_INFO *infoPtr = (STATUS_INFO *)GetWindowLongPtrW (hwnd, 0);
1156 INT nPart = ((INT) wParam) & 0x00ff;
1157 LRESULT res;
1158
1159 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
1160 if (!infoPtr && msg != WM_CREATE)
1161 return DefWindowProcW (hwnd, msg, wParam, lParam);
1162
1163 switch (msg) {
1164 case SB_GETBORDERS:
1165 return STATUSBAR_GetBorders (infoPtr, (INT *)lParam);
1166
1167 case SB_GETICON:
1168 return (LRESULT)STATUSBAR_GetIcon (infoPtr, nPart);
1169
1170 case SB_GETPARTS:
1171 return STATUSBAR_GetParts (infoPtr, (INT)wParam, (INT *)lParam);
1172
1173 case SB_GETRECT:
1174 return STATUSBAR_GetRect (infoPtr, nPart, (LPRECT)lParam);
1175
1176 case SB_GETTEXTA:
1177 return STATUSBAR_GetTextA (infoPtr, nPart, (LPSTR)lParam);
1178
1179 case SB_GETTEXTW:
1180 return STATUSBAR_GetTextW (infoPtr, nPart, (LPWSTR)lParam);
1181
1182 case SB_GETTEXTLENGTHA:
1183 case SB_GETTEXTLENGTHW:
1184 return STATUSBAR_GetTextLength (infoPtr, nPart);
1185
1186 case SB_GETTIPTEXTA:
1187 return STATUSBAR_GetTipTextA (infoPtr, LOWORD(wParam), (LPSTR)lParam, HIWORD(wParam));
1188
1189 case SB_GETTIPTEXTW:
1190 return STATUSBAR_GetTipTextW (infoPtr, LOWORD(wParam), (LPWSTR)lParam, HIWORD(wParam));
1191
1192 case SB_GETUNICODEFORMAT:
1193 return infoPtr->bUnicode;
1194
1195 case SB_ISSIMPLE:
1196 return infoPtr->simple;
1197
1198 case SB_SETBORDERS:
1199 return STATUSBAR_SetBorders (infoPtr, (INT *)lParam);
1200
1201 case SB_SETBKCOLOR:
1202 return STATUSBAR_SetBkColor (infoPtr, (COLORREF)lParam);
1203
1204 case SB_SETICON:
1205 return STATUSBAR_SetIcon (infoPtr, nPart, (HICON)lParam);
1206
1207 case SB_SETMINHEIGHT:
1208 return STATUSBAR_SetMinHeight (infoPtr, (INT)wParam);
1209
1210 case SB_SETPARTS:
1211 return STATUSBAR_SetParts (infoPtr, (INT)wParam, (LPINT)lParam);
1212
1213 case SB_SETTEXTA:
1214 return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPWSTR)lParam, FALSE);
1215
1216 case SB_SETTEXTW:
1217 return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPWSTR)lParam, TRUE);
1218
1219 case SB_SETTIPTEXTA:
1220 return STATUSBAR_SetTipTextA (infoPtr, (INT)wParam, (LPSTR)lParam);
1221
1222 case SB_SETTIPTEXTW:
1223 return STATUSBAR_SetTipTextW (infoPtr, (INT)wParam, (LPWSTR)lParam);
1224
1225 case SB_SETUNICODEFORMAT:
1226 return STATUSBAR_SetUnicodeFormat (infoPtr, (BOOL)wParam);
1227
1228 case SB_SIMPLE:
1229 return STATUSBAR_Simple (infoPtr, (BOOL)wParam);
1230
1231 case WM_CREATE:
1232 return STATUSBAR_WMCreate (hwnd, (LPCREATESTRUCTA)lParam);
1233
1234 case WM_DESTROY:
1235 return STATUSBAR_WMDestroy (infoPtr);
1236
1237 case WM_GETFONT:
1238 return (LRESULT)(infoPtr->hFont? infoPtr->hFont : infoPtr->hDefaultFont);
1239
1240 case WM_GETTEXT:
1241 return STATUSBAR_WMGetText (infoPtr, (INT)wParam, (LPWSTR)lParam);
1242
1243 case WM_GETTEXTLENGTH:
1244 return LOWORD(STATUSBAR_GetTextLength (infoPtr, 0));
1245
1246 case WM_LBUTTONDBLCLK:
1247 return STATUSBAR_SendMouseNotify(infoPtr, NM_DBLCLK, msg, wParam, lParam);
1248
1249 case WM_LBUTTONUP:
1250 return STATUSBAR_SendMouseNotify(infoPtr, NM_CLICK, msg, wParam, lParam);
1251
1252 case WM_MOUSEMOVE:
1253 return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
1254
1255 case WM_NCHITTEST:
1256 res = STATUSBAR_WMNCHitTest(infoPtr, (short)LOWORD(lParam),
1257 (short)HIWORD(lParam));
1258 if (res != HTERROR) return res;
1259 return DefWindowProcW (hwnd, msg, wParam, lParam);
1260
1261 case WM_NCLBUTTONUP:
1262 case WM_NCLBUTTONDOWN:
1263 PostMessageW (infoPtr->Notify, msg, wParam, lParam);
1264 return 0;
1265
1266 case WM_NOTIFYFORMAT:
1267 return STATUSBAR_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam);
1268
1269 case WM_PRINTCLIENT:
1270 case WM_PAINT:
1271 return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
1272
1273 case WM_RBUTTONDBLCLK:
1274 return STATUSBAR_SendMouseNotify(infoPtr, NM_RDBLCLK, msg, wParam, lParam);
1275
1276 case WM_RBUTTONUP:
1277 return STATUSBAR_SendMouseNotify(infoPtr, NM_RCLICK, msg, wParam, lParam);
1278
1279 case WM_SETFONT:
1280 return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
1281
1282 case WM_SETTEXT:
1283 return STATUSBAR_WMSetText (infoPtr, (LPCSTR)lParam);
1284
1285 case WM_SIZE:
1286 if (STATUSBAR_WMSize (infoPtr, (WORD)wParam)) return 0;
1287 return DefWindowProcW (hwnd, msg, wParam, lParam);
1288
1289 case WM_SYSCOLORCHANGE:
1290 COMCTL32_RefreshSysColors();
1291 return 0;
1292
1293 case WM_THEMECHANGED:
1294 return theme_changed (infoPtr);
1295
1296 default:
1297 if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg))
1298 ERR("unknown msg %04x wp=%04lx lp=%08lx\n",
1299 msg, wParam, lParam);
1300 return DefWindowProcW (hwnd, msg, wParam, lParam);
1301 }
1302 }
1303
1304
1305 /***********************************************************************
1306 * STATUS_Register [Internal]
1307 *
1308 * Registers the status window class.
1309 */
1310
1311 void
1312 STATUS_Register (void)
1313 {
1314 WNDCLASSW wndClass;
1315
1316 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
1317 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
1318 wndClass.lpfnWndProc = StatusWindowProc;
1319 wndClass.cbClsExtra = 0;
1320 wndClass.cbWndExtra = sizeof(STATUS_INFO *);
1321 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
1322 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1323 wndClass.lpszClassName = STATUSCLASSNAMEW;
1324
1325 RegisterClassW (&wndClass);
1326 }
1327
1328
1329 /***********************************************************************
1330 * STATUS_Unregister [Internal]
1331 *
1332 * Unregisters the status window class.
1333 */
1334
1335 void
1336 STATUS_Unregister (void)
1337 {
1338 UnregisterClassW (STATUSCLASSNAMEW, NULL);
1339 }