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