status.c 36.6 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3 4
/*
 * Interface code to StatusWindow widget/control
 *
 * Copyright 1996 Bruce Milner
5
 * Copyright 1998, 1999 Eric Kohl
6
 * Copyright 2002 Dimitrie O. Paun
7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 23 24 25 26 27 28 29 30 31
 * NOTE
 * 
 * This code was audited for completeness against the documented features
 * of Comctl32.dll version 6.0 on Sep. 24, 2002, by Dimitrie O. Paun.
 * 
 * Unless otherwise noted, we believe this code to be complete, as per
 * the specification mentioned above.
 * If you discover missing features, or bugs, please note them below.
 * 
 * TODO:
32 33
 * 	-- CCS_BOTTOM (default)
 * 	-- CCS_LEFT
34
 * 	-- CCS_NODIVIDER
35 36 37 38 39 40
 * 	-- CCS_NOMOVEX
 * 	-- CCS_NOMOVEY
 * 	-- CCS_NOPARENTALIGN
 * 	-- CCS_RIGHT
 * 	-- CCS_TOP
 * 	-- CCS_VERT (defaults to RIGHT)
41
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
42

43
#include <stdarg.h>
44
#include <string.h>
45

46
#include "windef.h"
47
#include "winbase.h"
48
#include "wine/unicode.h"
49 50 51
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
52
#include "commctrl.h"
53
#include "comctl32.h"
54 55
#include "uxtheme.h"
#include "tmschema.h"
56
#include "wine/debug.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
57

58
WINE_DEFAULT_DEBUG_CHANNEL(statusbar);
59 60 61

typedef struct
{
62 63
    INT 	x;
    INT 	style;
64 65
    RECT	bound;
    LPWSTR	text;
66
    HICON       hIcon;
67 68 69 70
} STATUSWINDOWPART;

typedef struct
{
71
    HWND              Self;
72
    HWND              Notify;
73
    WORD              numParts;
74 75 76 77 78
    UINT              height;
    BOOL              simple;
    HWND              hwndToolTip;
    HFONT             hFont;
    HFONT             hDefaultFont;
79 80
    COLORREF          clrBk;		/* background color */
    BOOL              bUnicode;		/* unicode flag */
81
    BOOL              NtfUnicode;	/* notify format */
82 83
    STATUSWINDOWPART  part0;		/* simple window */
    STATUSWINDOWPART* parts;
Filip Navara's avatar
Filip Navara committed
84 85 86
    INT               horizontalBorder;
    INT               verticalBorder;
    INT               horizontalGap;
87
} STATUS_INFO;
88

Alexandre Julliard's avatar
Alexandre Julliard committed
89 90
/*
 * Run tests using Waite Group Windows95 API Bible Vol. 1&2
91
 * The second cdrom contains executables drawstat.exe, gettext.exe,
Alexandre Julliard's avatar
Alexandre Julliard committed
92 93 94
 * simple.exe, getparts.exe, setparts.exe, statwnd.exe
 */

Alexandre Julliard's avatar
Alexandre Julliard committed
95 96 97 98
#define HORZ_BORDER 0
#define VERT_BORDER 2
#define HORZ_GAP    2

99
static const WCHAR themeClass[] = { 'S','t','a','t','u','s',0 };
100

101 102
/* prototype */
static void
103
STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr);
104 105 106 107 108

static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW)
{
  return isW ? debugstr_w(text) : debugstr_a((LPCSTR)text);
}
Alexandre Julliard's avatar
Alexandre Julliard committed
109 110

static void
111
STATUSBAR_DrawSizeGrip (HTHEME theme, HDC hdc, LPRECT lpRect)
Alexandre Julliard's avatar
Alexandre Julliard committed
112
{
113
    HPEN hPenFace, hPenShadow, hPenHighlight, hOldPen;
114 115
    POINT pt;
    INT i;
Alexandre Julliard's avatar
Alexandre Julliard committed
116

117 118
    TRACE("draw size grip %s\n", wine_dbgstr_rect(lpRect));

119 120 121 122 123 124 125 126 127 128 129 130 131 132
    if (theme)
    {
        RECT gripperRect;
        SIZE gripperSize;
        gripperRect = *lpRect;
        if (SUCCEEDED (GetThemePartSize (theme, hdc, SP_GRIPPER, 0, lpRect, 
            TS_DRAW, &gripperSize)))
        {
            gripperRect.left = gripperRect.right - gripperSize.cx;
            gripperRect.top = gripperRect.bottom - gripperSize.cy;
            if (SUCCEEDED (DrawThemeBackground(theme, hdc, SP_GRIPPER, 0, &gripperRect, NULL)))
                return;
        }
    }
133

Alexandre Julliard's avatar
Alexandre Julliard committed
134 135 136
    pt.x = lpRect->right - 1;
    pt.y = lpRect->bottom - 1;

137 138
    hPenFace = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DFACE ));
    hOldPen = SelectObject( hdc, hPenFace );
139 140
    MoveToEx (hdc, pt.x - 12, pt.y, NULL);
    LineTo (hdc, pt.x, pt.y);
141
    LineTo (hdc, pt.x, pt.y - 13);
Alexandre Julliard's avatar
Alexandre Julliard committed
142 143 144 145

    pt.x--;
    pt.y--;

146 147
    hPenShadow = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DSHADOW ));
    SelectObject( hdc, hPenShadow );
Alexandre Julliard's avatar
Alexandre Julliard committed
148
    for (i = 1; i < 11; i += 4) {
149
	MoveToEx (hdc, pt.x - i, pt.y, NULL);
150
	LineTo (hdc, pt.x + 1, pt.y - i - 1);
Alexandre Julliard's avatar
Alexandre Julliard committed
151

152 153
	MoveToEx (hdc, pt.x - i - 1, pt.y, NULL);
	LineTo (hdc, pt.x + 1, pt.y - i - 2);
Alexandre Julliard's avatar
Alexandre Julliard committed
154
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
155

156 157
    hPenHighlight = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DHIGHLIGHT ));
    SelectObject( hdc, hPenHighlight );
Alexandre Julliard's avatar
Alexandre Julliard committed
158
    for (i = 3; i < 13; i += 4) {
159
	MoveToEx (hdc, pt.x - i, pt.y, NULL);
160
	LineTo (hdc, pt.x + 1, pt.y - i - 1);
Alexandre Julliard's avatar
Alexandre Julliard committed
161 162
    }

163 164 165 166
    SelectObject (hdc, hOldPen);
    DeleteObject( hPenFace );
    DeleteObject( hPenShadow );
    DeleteObject( hPenHighlight );
Alexandre Julliard's avatar
Alexandre Julliard committed
167 168 169
}


170
static void
171
STATUSBAR_DrawPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
Alexandre Julliard's avatar
Alexandre Julliard committed
172
{
173 174
    RECT r = part->bound;
    UINT border = BDR_SUNKENOUTER;
175 176
    HTHEME theme = GetWindowTheme (infoPtr->Self);
    int themePart = SP_PANE;
Alexandre Julliard's avatar
Alexandre Julliard committed
177

178
    TRACE("part bound %s\n", wine_dbgstr_rect(&r));
179
    if (part->style & SBT_POPOUT)
180
        border = BDR_RAISEDOUTER;
181
    else if (part->style & SBT_NOBORDERS)
182
        border = 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
183

184 185 186 187 188 189 190 191 192
    if (theme)
    {
        if ((GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
            && (infoPtr->simple || (itemID == (infoPtr->numParts-1))))
            themePart = SP_GRIPPERPANE;
        DrawThemeBackground(theme, hdc, themePart, 0, &r, NULL);
    }
    else
        DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
193

194 195 196 197 198 199 200 201
    if (part->style & SBT_OWNERDRAW) {
	DRAWITEMSTRUCT dis;

	dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
	dis.itemID = itemID;
	dis.hwndItem = infoPtr->Self;
	dis.hDC = hdc;
	dis.rcItem = r;
Frank Richter's avatar
Frank Richter committed
202
	dis.itemData = (ULONG_PTR)part->text;
203 204 205 206 207 208 209 210 211
	SendMessageW (infoPtr->Notify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis);
    } else {
	if (part->hIcon) {
	   INT cy = r.bottom - r.top;

	    r.left += 2;
	    DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
	    r.left += cy;
	}
212
        DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
Alexandre Julliard's avatar
Alexandre Julliard committed
213 214 215 216
    }
}


217
static void
218
STATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID)
Alexandre Julliard's avatar
Alexandre Julliard committed
219
{
220 221
    HBRUSH hbrBk;
    HFONT  hOldFont;
222
    HTHEME theme;
Alexandre Julliard's avatar
Alexandre Julliard committed
223

224
    TRACE("item %d\n", itemID);
225
    if (!IsWindowVisible (infoPtr->Self))
Alexandre Julliard's avatar
Alexandre Julliard committed
226 227
        return;

228 229
    if (part->bound.right < part->bound.left) return;

230 231 232 233 234 235
    if ((theme = GetWindowTheme (infoPtr->Self)))
    {
        RECT cr;
        GetClientRect (infoPtr->Self, &cr);
        DrawThemeBackground(theme, hdc, 0, 0, &cr, &part->bound);
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
236
    else
237 238 239 240 241 242 243 244 245
    {
        if (infoPtr->clrBk != CLR_DEFAULT)
                hbrBk = CreateSolidBrush (infoPtr->clrBk);
        else
                hbrBk = GetSysColorBrush (COLOR_3DFACE);
        FillRect(hdc, &part->bound, hbrBk);
        if (infoPtr->clrBk != CLR_DEFAULT)
                DeleteObject (hbrBk);
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
246

247
    hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
Alexandre Julliard's avatar
Alexandre Julliard committed
248

249
	STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);
Alexandre Julliard's avatar
Alexandre Julliard committed
250

251
    SelectObject (hdc, hOldFont);
Alexandre Julliard's avatar
Alexandre Julliard committed
252

253 254
    if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
        RECT rect;
Alexandre Julliard's avatar
Alexandre Julliard committed
255

256
	GetClientRect (infoPtr->Self, &rect);
257
	STATUSBAR_DrawSizeGrip (theme, hdc, &rect);
Alexandre Julliard's avatar
Alexandre Julliard committed
258 259 260 261
    }
}


262
static LRESULT
263
STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
Alexandre Julliard's avatar
Alexandre Julliard committed
264 265
{
    int      i;
266 267 268
    RECT   rect;
    HBRUSH hbrBk;
    HFONT  hOldFont;
269
    HTHEME theme;
Alexandre Julliard's avatar
Alexandre Julliard committed
270

271
    TRACE("\n");
272 273
    if (!IsWindowVisible(infoPtr->Self))
        return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
274

275
    STATUSBAR_SetPartBounds(infoPtr);
276

277
    GetClientRect (infoPtr->Self, &rect);
Alexandre Julliard's avatar
Alexandre Julliard committed
278

279 280 281 282
    if ((theme = GetWindowTheme (infoPtr->Self)))
    {
        DrawThemeBackground(theme, hdc, 0, 0, &rect, NULL);
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
283
    else
284 285 286 287 288 289 290 291 292
    {
        if (infoPtr->clrBk != CLR_DEFAULT)
            hbrBk = CreateSolidBrush (infoPtr->clrBk);
        else
            hbrBk = GetSysColorBrush (COLOR_3DFACE);
        FillRect(hdc, &rect, hbrBk);
        if (infoPtr->clrBk != CLR_DEFAULT)
            DeleteObject (hbrBk);
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
293

294
    hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
Alexandre Julliard's avatar
Alexandre Julliard committed
295

296
    if (infoPtr->simple) {
297
	STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
298
    } else {
299 300 301
	for (i = 0; i < infoPtr->numParts; i++) {
	    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
	}
Alexandre Julliard's avatar
Alexandre Julliard committed
302 303
    }

304
    SelectObject (hdc, hOldFont);
Alexandre Julliard's avatar
Alexandre Julliard committed
305

306
    if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
307
	    STATUSBAR_DrawSizeGrip (theme, hdc, &rect);
Alexandre Julliard's avatar
Alexandre Julliard committed
308

309
    return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
310 311 312
}


313 314 315 316 317 318 319 320 321 322 323 324 325 326
static int
STATUSBAR_InternalHitTest(const STATUS_INFO *infoPtr, const LPPOINT pt)
{
    int i;
    if (infoPtr->simple)
        return 255;

    for (i = 0; i < infoPtr->numParts; i++)
        if (pt->x >= infoPtr->parts[i].bound.left && pt->x <= infoPtr->parts[i].bound.right)
            return i;
    return -2;
}


Alexandre Julliard's avatar
Alexandre Julliard committed
327
static void
328
STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
Alexandre Julliard's avatar
Alexandre Julliard committed
329 330
{
    STATUSWINDOWPART *part;
331
    RECT rect, *r;
Alexandre Julliard's avatar
Alexandre Julliard committed
332
    int	i;
Alexandre Julliard's avatar
Alexandre Julliard committed
333 334

    /* get our window size */
335
    GetClientRect (infoPtr->Self, &rect);
336
    TRACE("client wnd size is %s\n", wine_dbgstr_rect(&rect));
Alexandre Julliard's avatar
Alexandre Julliard committed
337

Filip Navara's avatar
Filip Navara committed
338 339
    rect.left += infoPtr->horizontalBorder;
    rect.top += infoPtr->verticalBorder;
Alexandre Julliard's avatar
Alexandre Julliard committed
340

Alexandre Julliard's avatar
Alexandre Julliard committed
341
    /* set bounds for simple rectangle */
342
    infoPtr->part0.bound = rect;
Alexandre Julliard's avatar
Alexandre Julliard committed
343 344

    /* set bounds for non-simple rectangles */
345 346 347
    for (i = 0; i < infoPtr->numParts; i++) {
	part = &infoPtr->parts[i];
	r = &infoPtr->parts[i].bound;
Alexandre Julliard's avatar
Alexandre Julliard committed
348 349 350 351 352
	r->top = rect.top;
	r->bottom = rect.bottom;
	if (i == 0)
	    r->left = 0;
	else
Filip Navara's avatar
Filip Navara committed
353
	    r->left = infoPtr->parts[i-1].bound.right + infoPtr->horizontalGap;
Alexandre Julliard's avatar
Alexandre Julliard committed
354 355 356 357
	if (part->x == -1)
	    r->right = rect.right;
	else
	    r->right = part->x;
Alexandre Julliard's avatar
Alexandre Julliard committed
358

359
	if (infoPtr->hwndToolTip) {
360
	    TTTOOLINFOW ti;
Alexandre Julliard's avatar
Alexandre Julliard committed
361

362 363
	    ti.cbSize = sizeof(TTTOOLINFOW);
	    ti.hwnd = infoPtr->Self;
Alexandre Julliard's avatar
Alexandre Julliard committed
364 365
	    ti.uId = i;
	    ti.rect = *r;
366
	    SendMessageW (infoPtr->hwndToolTip, TTM_NEWTOOLRECTW,
Alexandre Julliard's avatar
Alexandre Julliard committed
367 368
			    0, (LPARAM)&ti);
	}
Alexandre Julliard's avatar
Alexandre Julliard committed
369 370 371
    }
}

Alexandre Julliard's avatar
Alexandre Julliard committed
372

373
static LRESULT
374
STATUSBAR_Relay2Tip (const STATUS_INFO *infoPtr, UINT uMsg,
375
		     WPARAM wParam, LPARAM lParam)
Alexandre Julliard's avatar
Alexandre Julliard committed
376
{
377
    MSG msg;
Alexandre Julliard's avatar
Alexandre Julliard committed
378

379
    msg.hwnd = infoPtr->Self;
Alexandre Julliard's avatar
Alexandre Julliard committed
380 381 382 383
    msg.message = uMsg;
    msg.wParam = wParam;
    msg.lParam = lParam;
    msg.time = GetMessageTime ();
384 385
    msg.pt.x = (short)LOWORD(GetMessagePos ());
    msg.pt.y = (short)HIWORD(GetMessagePos ());
Alexandre Julliard's avatar
Alexandre Julliard committed
386

387
    return SendMessageW (infoPtr->hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
Alexandre Julliard's avatar
Alexandre Julliard committed
388 389 390
}


391
static BOOL
392
STATUSBAR_GetBorders (const STATUS_INFO *infoPtr, INT out[])
Alexandre Julliard's avatar
Alexandre Julliard committed
393
{
394
    TRACE("\n");
Filip Navara's avatar
Filip Navara committed
395 396 397 398 399 400 401 402 403
    out[0] = infoPtr->horizontalBorder;
    out[1] = infoPtr->verticalBorder;
    out[2] = infoPtr->horizontalGap;

    return TRUE;
}


static BOOL
404
STATUSBAR_SetBorders (STATUS_INFO *infoPtr, const INT in[])
Filip Navara's avatar
Filip Navara committed
405 406 407 408 409 410
{
    TRACE("\n");
    infoPtr->horizontalBorder = in[0];
    infoPtr->verticalBorder = in[1];
    infoPtr->horizontalGap = in[2];
    InvalidateRect(infoPtr->Self, NULL, FALSE);
Alexandre Julliard's avatar
Alexandre Julliard committed
411 412 413 414

    return TRUE;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
415

416
static HICON
417
STATUSBAR_GetIcon (const STATUS_INFO *infoPtr, INT nPart)
Alexandre Julliard's avatar
Alexandre Julliard committed
418
{
419
    TRACE("%d\n", nPart);
420
    /* MSDN says: "simple parts are indexed with -1" */
421
    if ((nPart < -1) || (nPart >= infoPtr->numParts))
422
	return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
423

Alexandre Julliard's avatar
Alexandre Julliard committed
424
    if (nPart == -1)
425
        return (infoPtr->part0.hIcon);
Alexandre Julliard's avatar
Alexandre Julliard committed
426
    else
427
        return (infoPtr->parts[nPart].hIcon);
Alexandre Julliard's avatar
Alexandre Julliard committed
428 429
}

Alexandre Julliard's avatar
Alexandre Julliard committed
430

431
static INT
432
STATUSBAR_GetParts (const STATUS_INFO *infoPtr, INT num_parts, INT parts[])
Alexandre Julliard's avatar
Alexandre Julliard committed
433
{
434
    INT   i;
Alexandre Julliard's avatar
Alexandre Julliard committed
435

436
    TRACE("(%d)\n", num_parts);
Alexandre Julliard's avatar
Alexandre Julliard committed
437 438
    if (parts) {
	for (i = 0; i < num_parts; i++) {
439
	    parts[i] = infoPtr->parts[i].x;
Alexandre Julliard's avatar
Alexandre Julliard committed
440 441
	}
    }
442
    return infoPtr->numParts;
Alexandre Julliard's avatar
Alexandre Julliard committed
443 444 445
}


446
static BOOL
447
STATUSBAR_GetRect (const STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
Alexandre Julliard's avatar
Alexandre Julliard committed
448
{
449
    TRACE("part %d\n", nPart);
450 451
    if(nPart >= infoPtr->numParts || nPart < 0)
      return FALSE;
452 453
    if (infoPtr->simple)
	*rect = infoPtr->part0.bound;
Alexandre Julliard's avatar
Alexandre Julliard committed
454
    else
455
	*rect = infoPtr->parts[nPart].bound;
Alexandre Julliard's avatar
Alexandre Julliard committed
456 457 458
    return TRUE;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
459

Alexandre Julliard's avatar
Alexandre Julliard committed
460
static LRESULT
461
STATUSBAR_GetTextA (STATUS_INFO *infoPtr, INT nPart, LPSTR buf)
Alexandre Julliard's avatar
Alexandre Julliard committed
462 463
{
    STATUSWINDOWPART *part;
Alexandre Julliard's avatar
Alexandre Julliard committed
464
    LRESULT result;
Alexandre Julliard's avatar
Alexandre Julliard committed
465

466
    TRACE("part %d\n", nPart);
467 468

    /* MSDN says: "simple parts use index of 0", so this check is ok. */
469 470
    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;

471 472
    if (infoPtr->simple)
	part = &infoPtr->part0;
Alexandre Julliard's avatar
Alexandre Julliard committed
473
    else
474
	part = &infoPtr->parts[nPart];
Alexandre Julliard's avatar
Alexandre Julliard committed
475

476
    if (part->style & SBT_OWNERDRAW)
477
	result = (LRESULT)part->text;
Alexandre Julliard's avatar
Alexandre Julliard committed
478
    else {
479 480 481
        DWORD len = part->text ? WideCharToMultiByte( CP_ACP, 0, part->text, -1,
                                                      NULL, 0, NULL, NULL ) - 1 : 0;
        result = MAKELONG( len, part->style );
482 483
        if (part->text && buf)
            WideCharToMultiByte( CP_ACP, 0, part->text, -1, buf, len+1, NULL, NULL );
Alexandre Julliard's avatar
Alexandre Julliard committed
484 485 486 487
    }
    return result;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
488

489
static LRESULT
490
STATUSBAR_GetTextW (STATUS_INFO *infoPtr, INT nPart, LPWSTR buf)
491 492 493 494
{
    STATUSWINDOWPART *part;
    LRESULT result;

495
    TRACE("part %d\n", nPart);
496 497
    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;

498 499
    if (infoPtr->simple)
	part = &infoPtr->part0;
500
    else
501
	part = &infoPtr->parts[nPart];
502

503
    if (part->style & SBT_OWNERDRAW)
504 505
	result = (LRESULT)part->text;
    else {
506
	result = part->text ? strlenW (part->text) : 0;
507
	result |= (part->style << 16);
508 509
	if (part->text && buf)
	    strcpyW (buf, part->text);
510 511 512
    }
    return result;
}
Alexandre Julliard's avatar
Alexandre Julliard committed
513 514


Alexandre Julliard's avatar
Alexandre Julliard committed
515
static LRESULT
516
STATUSBAR_GetTextLength (STATUS_INFO *infoPtr, INT nPart)
Alexandre Julliard's avatar
Alexandre Julliard committed
517 518
{
    STATUSWINDOWPART *part;
519
    DWORD result;
Alexandre Julliard's avatar
Alexandre Julliard committed
520

521
    TRACE("part %d\n", nPart);
522 523 524 525

    /* MSDN says: "simple parts use index of 0", so this check is ok. */
    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;

526 527
    if (infoPtr->simple)
	part = &infoPtr->part0;
Alexandre Julliard's avatar
Alexandre Julliard committed
528
    else
529
	part = &infoPtr->parts[nPart];
Alexandre Julliard's avatar
Alexandre Julliard committed
530

531
    if ((~part->style & SBT_OWNERDRAW) && part->text)
532
	result = strlenW(part->text);
Alexandre Julliard's avatar
Alexandre Julliard committed
533 534 535 536 537 538 539 540
    else
	result = 0;

    result |= (part->style << 16);
    return result;
}

static LRESULT
541
STATUSBAR_GetTipTextA (const STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
Alexandre Julliard's avatar
Alexandre Julliard committed
542
{
543
    TRACE("\n");
544 545 546 547 548 549 550
    if (tip) {
        CHAR buf[INFOTIPSIZE];
        buf[0]='\0';

        if (infoPtr->hwndToolTip) {
            TTTOOLINFOA ti;
            ti.cbSize = sizeof(TTTOOLINFOA);
551 552
            ti.hwnd = infoPtr->Self;
            ti.uId = id;
553
            ti.lpszText = buf;
554
            SendMessageA (infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti);
555
        }
556
        lstrcpynA (tip, buf, size);
Alexandre Julliard's avatar
Alexandre Julliard committed
557
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
558
    return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
559 560
}

Alexandre Julliard's avatar
Alexandre Julliard committed
561

562
static LRESULT
563
STATUSBAR_GetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
564
{
565
    TRACE("\n");
566 567 568
    if (tip) {
        WCHAR buf[INFOTIPSIZE];
        buf[0]=0;
569

570 571 572
	if (infoPtr->hwndToolTip) {
	    TTTOOLINFOW ti;
	    ti.cbSize = sizeof(TTTOOLINFOW);
573 574
	    ti.hwnd = infoPtr->Self;
	    ti.uId = id;
575 576 577
            ti.lpszText = buf;
	    SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti);
	}
578
	lstrcpynW(tip, buf, size);
579 580 581 582 583 584
    }

    return 0;
}


585
static COLORREF
586
STATUSBAR_SetBkColor (STATUS_INFO *infoPtr, COLORREF color)
Alexandre Julliard's avatar
Alexandre Julliard committed
587 588 589
{
    COLORREF oldBkColor;

590
    oldBkColor = infoPtr->clrBk;
591 592
    infoPtr->clrBk = color;
    InvalidateRect(infoPtr->Self, NULL, FALSE);
Alexandre Julliard's avatar
Alexandre Julliard committed
593

594
    TRACE("CREF: %08x -> %08x\n", oldBkColor, infoPtr->clrBk);
Alexandre Julliard's avatar
Alexandre Julliard committed
595 596 597 598
    return oldBkColor;
}


599
static BOOL
600
STATUSBAR_SetIcon (STATUS_INFO *infoPtr, INT nPart, HICON hIcon)
Alexandre Julliard's avatar
Alexandre Julliard committed
601
{
602
    if ((nPart < -1) || (nPart >= infoPtr->numParts))
603
	return FALSE;
Alexandre Julliard's avatar
Alexandre Julliard committed
604

605
    TRACE("setting part %d\n", nPart);
606

607
    /* FIXME: MSDN says "if nPart is -1, the status bar is assumed simple" */
Alexandre Julliard's avatar
Alexandre Julliard committed
608
    if (nPart == -1) {
609
	if (infoPtr->part0.hIcon == hIcon) /* same as - no redraw */
610
	    return TRUE;
611
	infoPtr->part0.hIcon = hIcon;
612
	if (infoPtr->simple)
613
            InvalidateRect(infoPtr->Self, &infoPtr->part0.bound, FALSE);
614
    } else {
615
	if (infoPtr->parts[nPart].hIcon == hIcon) /* same as - no redraw */
616 617
	    return TRUE;

618
	infoPtr->parts[nPart].hIcon = hIcon;
619
	if (!(infoPtr->simple))
620
            InvalidateRect(infoPtr->Self, &infoPtr->parts[nPart].bound, FALSE);
Alexandre Julliard's avatar
Alexandre Julliard committed
621
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
622 623 624
    return TRUE;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
625

626
static BOOL
627
STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height)
Alexandre Julliard's avatar
Alexandre Julliard committed
628 629
{

630 631
    TRACE("(height=%d)\n", height);
    if (IsWindowVisible (infoPtr->Self)) {
632 633
	INT  width, x, y;
	RECT parent_rect;
634
        HTHEME theme;
Alexandre Julliard's avatar
Alexandre Julliard committed
635

Filip Navara's avatar
Filip Navara committed
636
	infoPtr->height = height + infoPtr->verticalBorder;
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652
        
        if ((theme = GetWindowTheme (infoPtr->Self)))
        {
            /* Determine bar height from theme such that the content area is
             * 'height' pixels large */
            HDC hdc = GetDC (infoPtr->Self);
            RECT r;
            memset (&r, 0, sizeof (r));
            r.bottom = height;
            if (SUCCEEDED(GetThemeBackgroundExtent (theme, hdc, SP_PANE, 0, &r, &r)))
            {
                infoPtr->height = r.bottom - r.top;
            }
            ReleaseDC (infoPtr->Self, hdc);
        }
        
653 654 655 656 657 658 659 660
        if (GetClientRect (infoPtr->Notify, &parent_rect))
        {
            width = parent_rect.right - parent_rect.left;
            x = parent_rect.left;
            y = parent_rect.bottom - infoPtr->height;
            MoveWindow (infoPtr->Self, x, y, width, infoPtr->height, TRUE);
            STATUSBAR_SetPartBounds (infoPtr);
        }
Alexandre Julliard's avatar
Alexandre Julliard committed
661 662 663 664 665 666
    }

    return TRUE;
}


667
static BOOL
668
STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
Alexandre Julliard's avatar
Alexandre Julliard committed
669
{
670
    STATUSWINDOWPART *tmp;
671
    UINT i, oldNumParts;
Alexandre Julliard's avatar
Alexandre Julliard committed
672

673
    TRACE("(%d,%p)\n", count, parts);
674

675
    oldNumParts = infoPtr->numParts;
676
    infoPtr->numParts = count;
677 678
    if (oldNumParts > infoPtr->numParts) {
	for (i = infoPtr->numParts ; i < oldNumParts; i++) {
679
	    if (!(infoPtr->parts[i].style & SBT_OWNERDRAW))
680
		Free (infoPtr->parts[i].text);
Alexandre Julliard's avatar
Alexandre Julliard committed
681
	}
682
    } else if (oldNumParts < infoPtr->numParts) {
683
	tmp = Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts);
684
	if (!tmp) return FALSE;
Alexandre Julliard's avatar
Alexandre Julliard committed
685
	for (i = 0; i < oldNumParts; i++) {
686
	    tmp[i] = infoPtr->parts[i];
Alexandre Julliard's avatar
Alexandre Julliard committed
687
	}
688
        Free (infoPtr->parts);
689
	infoPtr->parts = tmp;
Alexandre Julliard's avatar
Alexandre Julliard committed
690
    }
691
    if (oldNumParts == infoPtr->numParts) {
692
	for (i=0; i < oldNumParts; i++)
693
	    if (infoPtr->parts[i].x != parts[i])
694 695 696 697
		break;
	if (i==oldNumParts) /* Unchanged? no need to redraw! */
	    return TRUE;
    }
698

699 700
    for (i = 0; i < infoPtr->numParts; i++)
	infoPtr->parts[i].x = parts[i];
Alexandre Julliard's avatar
Alexandre Julliard committed
701

702
    if (infoPtr->hwndToolTip) {
703
	UINT nTipCount;
704 705 706 707 708
	TTTOOLINFOW ti;

	ZeroMemory (&ti, sizeof(TTTOOLINFOW));
	ti.cbSize = sizeof(TTTOOLINFOW);
	ti.hwnd = infoPtr->Self;
Alexandre Julliard's avatar
Alexandre Julliard committed
709

710
	nTipCount = SendMessageW (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);
711
	if (nTipCount < infoPtr->numParts) {
Alexandre Julliard's avatar
Alexandre Julliard committed
712
	    /* add tools */
713
	    for (i = nTipCount; i < infoPtr->numParts; i++) {
714
		TRACE("add tool %d\n", i);
Alexandre Julliard's avatar
Alexandre Julliard committed
715
		ti.uId = i;
716
		SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW,
Alexandre Julliard's avatar
Alexandre Julliard committed
717 718 719
				0, (LPARAM)&ti);
	    }
	}
720
	else if (nTipCount > infoPtr->numParts) {
Alexandre Julliard's avatar
Alexandre Julliard committed
721
	    /* delete tools */
722
	    for (i = nTipCount - 1; i >= infoPtr->numParts; i--) {
723 724 725 726
		TRACE("delete tool %d\n", i);
		ti.uId = i;
		SendMessageW (infoPtr->hwndToolTip, TTM_DELTOOLW,
				0, (LPARAM)&ti);
Alexandre Julliard's avatar
Alexandre Julliard committed
727 728 729
	    }
	}
    }
730 731
    STATUSBAR_SetPartBounds (infoPtr);
    InvalidateRect(infoPtr->Self, NULL, FALSE);
Alexandre Julliard's avatar
Alexandre Julliard committed
732 733 734 735
    return TRUE;
}


736
static BOOL
737
STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
738
		    LPCWSTR text, BOOL isW)
Alexandre Julliard's avatar
Alexandre Julliard committed
739
{
740
    STATUSWINDOWPART *part=NULL;
741
    BOOL changed = FALSE;
742
    INT  oldStyle;
Alexandre Julliard's avatar
Alexandre Julliard committed
743

744
    if (style & SBT_OWNERDRAW) {
Gerald Pfeifer's avatar
Gerald Pfeifer committed
745
         TRACE("part %d, text %p\n",nPart,text);
746 747
    }
    else TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW));
748

749 750 751 752
    /* MSDN says: "If the parameter is set to SB_SIMPLEID (255), the status
     * window is assumed to be a simple window */

    if (nPart == 0x00ff) {
753
	part = &infoPtr->part0;
754
    } else {
755
	if (infoPtr->parts && nPart >= 0 && nPart < infoPtr->numParts) {
756 757 758
	    part = &infoPtr->parts[nPart];
	}
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
759
    if (!part) return FALSE;
760

761 762
    if (part->style != style)
	changed = TRUE;
763

764
    oldStyle = part->style;
765
    part->style = style;
766
    if (style & SBT_OWNERDRAW) {
767 768 769
        if (!(oldStyle & SBT_OWNERDRAW))
            Free (part->text);
        else if (part->text == text)
770 771
            return TRUE;
        part->text = (LPWSTR)text;
772 773 774
    } else {
	LPWSTR ntext;

775 776 777
	if (text && !isW) {
	    LPCSTR atxt = (LPCSTR)text;
            DWORD len = MultiByteToWideChar( CP_ACP, 0, atxt, -1, NULL, 0 );
778
	    ntext = Alloc( (len + 1)*sizeof(WCHAR) );
779 780 781
	    if (!ntext) return FALSE;
            MultiByteToWideChar( CP_ACP, 0, atxt, -1, ntext, len );
	} else if (text) {
782
	    ntext = Alloc( (strlenW(text) + 1)*sizeof(WCHAR) );
783 784 785 786
	    if (!ntext) return FALSE;
	    strcpyW (ntext, text);
	} else ntext = 0;

787 788
	/* check if text is unchanged -> no need to redraw */
	if (text) {
789
	    if (!changed && part->text && !lstrcmpW(ntext, part->text)) {
790
		Free(ntext);
791 792 793
		return TRUE;
	    }
	} else {
794
	    if (!changed && !part->text)
795
		return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
796 797
	}

798
	if (!(oldStyle & SBT_OWNERDRAW))
799
	    Free (part->text);
800 801
	part->text = ntext;
    }
802
    InvalidateRect(infoPtr->Self, &part->bound, FALSE);
803
    UpdateWindow(infoPtr->Self);
Alexandre Julliard's avatar
Alexandre Julliard committed
804 805

    return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
806 807
}

Alexandre Julliard's avatar
Alexandre Julliard committed
808

809
static LRESULT
810
STATUSBAR_SetTipTextA (const STATUS_INFO *infoPtr, INT id, LPSTR text)
811
{
812
    TRACE("part %d: \"%s\"\n", id, text);
813
    if (infoPtr->hwndToolTip) {
814 815
	TTTOOLINFOA ti;
	ti.cbSize = sizeof(TTTOOLINFOA);
816 817
	ti.hwnd = infoPtr->Self;
	ti.uId = id;
Alexandre Julliard's avatar
Alexandre Julliard committed
818
	ti.hinst = 0;
819
	ti.lpszText = text;
820
	SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, 0, (LPARAM)&ti);
Alexandre Julliard's avatar
Alexandre Julliard committed
821 822 823 824 825 826
    }

    return 0;
}


827
static LRESULT
828
STATUSBAR_SetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR text)
829
{
830
    TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
831
    if (infoPtr->hwndToolTip) {
832 833
	TTTOOLINFOW ti;
	ti.cbSize = sizeof(TTTOOLINFOW);
834 835
	ti.hwnd = infoPtr->Self;
	ti.uId = id;
836
	ti.hinst = 0;
837
	ti.lpszText = text;
838
	SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
839 840 841 842 843 844
    }

    return 0;
}


845
static inline LRESULT
846
STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
847
{
848
    BOOL bOld = infoPtr->bUnicode;
849

850 851
    TRACE("(0x%x)\n", bUnicode);
    infoPtr->bUnicode = bUnicode;
852

853
    return bOld;
854
}
Alexandre Julliard's avatar
Alexandre Julliard committed
855 856


857
static BOOL
858
STATUSBAR_Simple (STATUS_INFO *infoPtr, BOOL simple)
Alexandre Julliard's avatar
Alexandre Julliard committed
859
{
Alexandre Julliard's avatar
Alexandre Julliard committed
860 861
    NMHDR  nmhdr;

862 863
    TRACE("(simple=%d)\n", simple);
    if (infoPtr->simple == simple) /* no need to change */
864 865
	return TRUE;

866
    infoPtr->simple = simple;
Alexandre Julliard's avatar
Alexandre Julliard committed
867 868

    /* send notification */
869
    nmhdr.hwndFrom = infoPtr->Self;
870
    nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
Alexandre Julliard's avatar
Alexandre Julliard committed
871
    nmhdr.code = SBN_SIMPLEMODECHANGE;
872
    SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
873
    InvalidateRect(infoPtr->Self, NULL, FALSE);
Alexandre Julliard's avatar
Alexandre Julliard committed
874 875 876 877 878
    return TRUE;
}


static LRESULT
879
STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
Alexandre Julliard's avatar
Alexandre Julliard committed
880
{
881 882 883 884
    int	i;

    TRACE("\n");
    for (i = 0; i < infoPtr->numParts; i++) {
885
	if (!(infoPtr->parts[i].style & SBT_OWNERDRAW))
886
	    Free (infoPtr->parts[i].text);
887
    }
888
    if (!(infoPtr->part0.style & SBT_OWNERDRAW))
889 890
	Free (infoPtr->part0.text);
    Free (infoPtr->parts);
891 892 893 894 895 896 897 898 899

    /* delete default font */
    if (infoPtr->hDefaultFont)
	DeleteObject (infoPtr->hDefaultFont);

    /* delete tool tip control */
    if (infoPtr->hwndToolTip)
	DestroyWindow (infoPtr->hwndToolTip);

900 901
    CloseThemeData (GetWindowTheme (infoPtr->Self));

902
    SetWindowLongPtrW(infoPtr->Self, 0, 0);
903
    Free (infoPtr);
904 905 906 907 908
    return 0;
}


static LRESULT
909
STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate)
910
{
911
    STATUS_INFO *infoPtr;
912
    NONCLIENTMETRICSW nclm;
913
    DWORD dwStyle;
914
    RECT rect;
915
    int	i, width, len, textHeight = 0;
916
    HDC	hdc;
Alexandre Julliard's avatar
Alexandre Julliard committed
917

918
    TRACE("\n");
919
    infoPtr = (STATUS_INFO*)Alloc (sizeof(STATUS_INFO));
920
    if (!infoPtr) goto create_fail;
921
    SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
922

923
    infoPtr->Self = hwnd;
924
    infoPtr->Notify = lpCreate->hwndParent;
925 926 927 928 929
    infoPtr->numParts = 1;
    infoPtr->parts = 0;
    infoPtr->simple = FALSE;
    infoPtr->clrBk = CLR_DEFAULT;
    infoPtr->hFont = 0;
Filip Navara's avatar
Filip Navara committed
930 931 932
    infoPtr->horizontalBorder = HORZ_BORDER;
    infoPtr->verticalBorder = VERT_BORDER;
    infoPtr->horizontalGap = HORZ_GAP;
933

934
    i = SendMessageW(infoPtr->Notify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
935
    infoPtr->NtfUnicode = (i == NFR_UNICODE);
Alexandre Julliard's avatar
Alexandre Julliard committed
936

937
    GetClientRect (hwnd, &rect);
938 939
    InvalidateRect (hwnd, &rect, 0);
    UpdateWindow(hwnd);
Alexandre Julliard's avatar
Alexandre Julliard committed
940

941 942 943 944
    ZeroMemory (&nclm, sizeof(nclm));
    nclm.cbSize = sizeof(nclm);
    SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0);
    infoPtr->hDefaultFont = CreateFontIndirectW (&nclm.lfStatusFont);
Alexandre Julliard's avatar
Alexandre Julliard committed
945 946

    /* initialize simple case */
947 948 949 950 951
    infoPtr->part0.bound = rect;
    infoPtr->part0.text = 0;
    infoPtr->part0.x = 0;
    infoPtr->part0.style = 0;
    infoPtr->part0.hIcon = 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
952 953

    /* initialize first part */
954
    infoPtr->parts = Alloc (sizeof(STATUSWINDOWPART));
955
    if (!infoPtr->parts) goto create_fail;
956 957 958 959 960
    infoPtr->parts[0].bound = rect;
    infoPtr->parts[0].text = 0;
    infoPtr->parts[0].x = -1;
    infoPtr->parts[0].style = 0;
    infoPtr->parts[0].hIcon = 0;
961 962
    
    OpenThemeData (hwnd, themeClass);
Alexandre Julliard's avatar
Alexandre Julliard committed
963

964
    if (IsWindowUnicode (hwnd)) {
965
	infoPtr->bUnicode = TRUE;
966
	if (lpCreate->lpszName &&
967
	    (len = strlenW ((LPCWSTR)lpCreate->lpszName))) {
968
	    infoPtr->parts[0].text = Alloc ((len + 1)*sizeof(WCHAR));
969
	    if (!infoPtr->parts[0].text) goto create_fail;
970
	    strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
971 972 973
	}
    }
    else {
974
	if (lpCreate->lpszName &&
975 976
	    (len = strlen((LPCSTR)lpCreate->lpszName))) {
            DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 );
977
	    infoPtr->parts[0].text = Alloc (lenW*sizeof(WCHAR));
978
	    if (!infoPtr->parts[0].text) goto create_fail;
979
            MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1,
980
                                 infoPtr->parts[0].text, lenW );
981
	}
Alexandre Julliard's avatar
Alexandre Julliard committed
982 983
    }

984
    dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
985 986
    /* native seems to clear WS_BORDER, too */
    dwStyle &= ~WS_BORDER;
987 988

    /* statusbars on managed windows should not have SIZEGRIP style */
989 990
    if ((dwStyle & SBARS_SIZEGRIP) && lpCreate->hwndParent &&
        GetPropA( lpCreate->hwndParent, "__wine_x11_managed" ))
991 992 993
        dwStyle &= ~SBARS_SIZEGRIP;

    SetWindowLongW (hwnd, GWL_STYLE, dwStyle);
994

995
    if ((hdc = GetDC (hwnd))) {
996
	TEXTMETRICW tm;
997
	HFONT hOldFont;
Alexandre Julliard's avatar
Alexandre Julliard committed
998

999 1000 1001
	hOldFont = SelectObject (hdc, infoPtr->hDefaultFont);
	GetTextMetricsW (hdc, &tm);
	textHeight = tm.tmHeight;
1002
	SelectObject (hdc, hOldFont);
1003
	ReleaseDC (hwnd, hdc);
Alexandre Julliard's avatar
Alexandre Julliard committed
1004
    }
1005
    TRACE("    textHeight=%d\n", textHeight);
Alexandre Julliard's avatar
Alexandre Julliard committed
1006

1007
    if (dwStyle & SBT_TOOLTIPS) {
1008
	infoPtr->hwndToolTip =
1009
	    CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, WS_POPUP | TTS_ALWAYSTIP,
1010 1011
			     CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
			     CW_USEDEFAULT, hwnd, 0,
1012
			     (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
Alexandre Julliard's avatar
Alexandre Julliard committed
1013

1014
	if (infoPtr->hwndToolTip) {
Alexandre Julliard's avatar
Alexandre Julliard committed
1015 1016
	    NMTOOLTIPSCREATED nmttc;

1017
	    nmttc.hdr.hwndFrom = hwnd;
1018
	    nmttc.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
Alexandre Julliard's avatar
Alexandre Julliard committed
1019
	    nmttc.hdr.code = NM_TOOLTIPSCREATED;
1020
	    nmttc.hwndToolTips = infoPtr->hwndToolTip;
Alexandre Julliard's avatar
Alexandre Julliard committed
1021

1022
	    SendMessageW (lpCreate->hwndParent, WM_NOTIFY, nmttc.hdr.idFrom, (LPARAM)&nmttc);
1023
	}
Alexandre Julliard's avatar
Alexandre Julliard committed
1024 1025
    }

1026
    if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */
1027
        HTHEME theme;
1028
        GetClientRect (infoPtr->Notify, &rect);
1029
        width = rect.right - rect.left;
Filip Navara's avatar
Filip Navara committed
1030
        infoPtr->height = textHeight + 4 + infoPtr->verticalBorder;
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
        
        if ((theme = GetWindowTheme (hwnd)))
        {
            /* Determine bar height from theme such that the content area is
             * textHeight pixels large */
            HDC hdc = GetDC (hwnd);
            RECT r;
            memset (&r, 0, sizeof (r));
            r.bottom = textHeight;
            if (SUCCEEDED(GetThemeBackgroundExtent (theme, hdc, SP_PANE, 0, &r, &r)))
            {
                infoPtr->height = r.bottom - r.top;
            }
            ReleaseDC (hwnd, hdc);
        }
    
1047 1048
        SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1,
			width, infoPtr->height, SWP_NOZORDER);
1049
        STATUSBAR_SetPartBounds (infoPtr);
1050
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
1051 1052

    return 0;
1053

1054 1055 1056 1057
create_fail:
    TRACE("    failed!\n");
    if (infoPtr) STATUSBAR_WMDestroy(infoPtr);
    return -1;
Alexandre Julliard's avatar
Alexandre Julliard committed
1058 1059 1060
}


1061 1062
/* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
 * of the first part only (usual behaviour) */
1063
static INT
1064
STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf)
Alexandre Julliard's avatar
Alexandre Julliard committed
1065
{
1066
    INT len;
Alexandre Julliard's avatar
Alexandre Julliard committed
1067

1068
    TRACE("\n");
1069
    if (!(infoPtr->parts[0].text))
Alexandre Julliard's avatar
Alexandre Julliard committed
1070
        return 0;
1071 1072 1073 1074 1075
    if (infoPtr->bUnicode)
        len = strlenW (infoPtr->parts[0].text);
    else
        len = WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, NULL, 0, NULL, NULL )-1;

1076
    if (size > len) {
1077
	if (infoPtr->bUnicode)
1078
	    strcpyW (buf, infoPtr->parts[0].text);
1079
	else
1080
            WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1,
1081
                                 (LPSTR)buf, len+1, NULL, NULL );
1082
	return len;
Alexandre Julliard's avatar
Alexandre Julliard committed
1083
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
1084

1085
    return -1;
Alexandre Julliard's avatar
Alexandre Julliard committed
1086 1087 1088
}


1089
static BOOL
1090
STATUSBAR_WMNCHitTest (const STATUS_INFO *infoPtr, INT x, INT y)
Alexandre Julliard's avatar
Alexandre Julliard committed
1091
{
1092
    if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
1093 1094
	RECT  rect;
	POINT pt;
Alexandre Julliard's avatar
Alexandre Julliard committed
1095

1096
	GetClientRect (infoPtr->Self, &rect);
Alexandre Julliard's avatar
Alexandre Julliard committed
1097

1098 1099 1100
	pt.x = x;
	pt.y = y;
	ScreenToClient (infoPtr->Self, &pt);
Alexandre Julliard's avatar
Alexandre Julliard committed
1101 1102 1103 1104

	rect.left = rect.right - 13;
	rect.top += 2;

1105
	if (PtInRect (&rect, pt))
Alexandre Julliard's avatar
Alexandre Julliard committed
1106 1107 1108
	    return HTBOTTOMRIGHT;
    }

1109
    return HTERROR;
Alexandre Julliard's avatar
Alexandre Julliard committed
1110 1111 1112 1113
}


static LRESULT
1114
STATUSBAR_WMPaint (STATUS_INFO *infoPtr, HDC hdc)
Alexandre Julliard's avatar
Alexandre Julliard committed
1115
{
1116
    PAINTSTRUCT ps;
Alexandre Julliard's avatar
Alexandre Julliard committed
1117

1118
    TRACE("\n");
1119 1120 1121 1122
    if (hdc) return STATUSBAR_Refresh (infoPtr, hdc);
    hdc = BeginPaint (infoPtr->Self, &ps);
    STATUSBAR_Refresh (infoPtr, hdc);
    EndPaint (infoPtr->Self, &ps);
Alexandre Julliard's avatar
Alexandre Julliard committed
1123 1124 1125 1126 1127 1128

    return 0;
}


static LRESULT
1129
STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw)
Alexandre Julliard's avatar
Alexandre Julliard committed
1130
{
1131
    infoPtr->hFont = font;
1132
    TRACE("%p\n", infoPtr->hFont);
1133 1134
    if (redraw)
        InvalidateRect(infoPtr->Self, NULL, FALSE);
Alexandre Julliard's avatar
Alexandre Julliard committed
1135

Alexandre Julliard's avatar
Alexandre Julliard committed
1136 1137 1138 1139
    return 0;
}


1140
static BOOL
1141
STATUSBAR_WMSetText (const STATUS_INFO *infoPtr, LPCSTR text)
Alexandre Julliard's avatar
Alexandre Julliard committed
1142 1143
{
    STATUSWINDOWPART *part;
Alexandre Julliard's avatar
Alexandre Julliard committed
1144
    int len;
Alexandre Julliard's avatar
Alexandre Julliard committed
1145

1146
    TRACE("\n");
1147
    if (infoPtr->numParts == 0)
Alexandre Julliard's avatar
Alexandre Julliard committed
1148
	return FALSE;
Alexandre Julliard's avatar
Alexandre Julliard committed
1149

1150
    part = &infoPtr->parts[0];
Alexandre Julliard's avatar
Alexandre Julliard committed
1151
    /* duplicate string */
1152
    Free (part->text);
Alexandre Julliard's avatar
Alexandre Julliard committed
1153
    part->text = 0;
1154
    if (infoPtr->bUnicode) {
1155
	if (text && (len = strlenW((LPCWSTR)text))) {
1156
	    part->text = Alloc ((len+1)*sizeof(WCHAR));
1157 1158
	    if (!part->text) return FALSE;
	    strcpyW (part->text, (LPCWSTR)text);
1159 1160 1161
	}
    }
    else {
1162 1163
	if (text && (len = lstrlenA(text))) {
            DWORD lenW = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 );
1164
            part->text = Alloc (lenW*sizeof(WCHAR));
1165 1166
	    if (!part->text) return FALSE;
            MultiByteToWideChar( CP_ACP, 0, text, -1, part->text, lenW );
1167
	}
Alexandre Julliard's avatar
Alexandre Julliard committed
1168
    }
Alexandre Julliard's avatar
Alexandre Julliard committed
1169

1170
    InvalidateRect(infoPtr->Self, &part->bound, FALSE);
Alexandre Julliard's avatar
Alexandre Julliard committed
1171

Alexandre Julliard's avatar
Alexandre Julliard committed
1172 1173 1174
    return TRUE;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
1175

1176
static BOOL
1177
STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
Alexandre Julliard's avatar
Alexandre Julliard committed
1178
{
1179
    INT  width, x, y;
1180
    RECT parent_rect;
Alexandre Julliard's avatar
Alexandre Julliard committed
1181

Alexandre Julliard's avatar
Alexandre Julliard committed
1182
    /* Need to resize width to match parent */
1183 1184
    TRACE("flags %04x\n", flags);

1185
    if (flags != SIZE_RESTORED && flags != SIZE_MAXIMIZED) {
1186
	WARN("flags MUST be SIZE_RESTORED or SIZE_MAXIMIZED\n");
1187 1188
	return FALSE;
    }
1189

1190
    if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE;
1191

1192
    /* width and height don't apply */
1193 1194 1195
    if (!GetClientRect (infoPtr->Notify, &parent_rect))
        return FALSE;

1196 1197 1198
    width = parent_rect.right - parent_rect.left;
    x = parent_rect.left;
    y = parent_rect.bottom - infoPtr->height;
1199
    MoveWindow (infoPtr->Self, x, y, width, infoPtr->height, TRUE);
1200 1201
    STATUSBAR_SetPartBounds (infoPtr);
    return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
1202 1203
}

Alexandre Julliard's avatar
Alexandre Julliard committed
1204

1205
/* update theme after a WM_THEMECHANGED message */
1206
static LRESULT theme_changed (const STATUS_INFO* infoPtr)
1207 1208 1209 1210 1211 1212 1213 1214
{
    HTHEME theme = GetWindowTheme (infoPtr->Self);
    CloseThemeData (theme);
    OpenThemeData (infoPtr->Self, themeClass);
    return 0;
}


1215
static LRESULT
1216
STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
1217 1218
{
    if (cmd == NF_REQUERY) {
1219
	INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY);
1220 1221 1222 1223 1224 1225
	infoPtr->NtfUnicode = (i == NFR_UNICODE);
    }
    return infoPtr->NtfUnicode ? NFR_UNICODE : NFR_ANSI;
}


Alexandre Julliard's avatar
Alexandre Julliard committed
1226
static LRESULT
1227
STATUSBAR_SendMouseNotify(const STATUS_INFO *infoPtr, UINT code, LPARAM lParam)
Alexandre Julliard's avatar
Alexandre Julliard committed
1228
{
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240
    NMMOUSE  nm;

    TRACE("code %04x, lParam=%lx\n", code, lParam);
    nm.hdr.hwndFrom = infoPtr->Self;
    nm.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID);
    nm.hdr.code = code;
    nm.pt.x = (short)LOWORD(lParam);
    nm.pt.y = (short)HIWORD(lParam);
    nm.dwItemSpec = STATUSBAR_InternalHitTest(infoPtr, &nm.pt);
    nm.dwItemData = 0;
    nm.dwHitInfo = 0x30000;     /* seems constant */
    SendMessageW(infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nm);
Alexandre Julliard's avatar
Alexandre Julliard committed
1241 1242 1243 1244 1245
    return 0;
}



1246
static LRESULT WINAPI
1247
StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Alexandre Julliard's avatar
Alexandre Julliard committed
1248
{
1249
    STATUS_INFO *infoPtr = (STATUS_INFO *)GetWindowLongPtrW (hwnd, 0);
1250 1251
    INT nPart = ((INT) wParam) & 0x00ff;
    LRESULT res;
1252

1253
    TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
1254 1255
    if (!infoPtr && msg != WM_CREATE)
        return DefWindowProcW (hwnd, msg, wParam, lParam);
1256

Alexandre Julliard's avatar
Alexandre Julliard committed
1257
    switch (msg) {
Alexandre Julliard's avatar
Alexandre Julliard committed
1258
	case SB_GETBORDERS:
Filip Navara's avatar
Filip Navara committed
1259
	    return STATUSBAR_GetBorders (infoPtr, (INT *)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1260 1261

	case SB_GETICON:
1262
	    return (LRESULT)STATUSBAR_GetIcon (infoPtr, nPart);
Alexandre Julliard's avatar
Alexandre Julliard committed
1263 1264

	case SB_GETPARTS:
1265
	    return STATUSBAR_GetParts (infoPtr, (INT)wParam, (INT *)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1266 1267

	case SB_GETRECT:
1268
	    return STATUSBAR_GetRect (infoPtr, nPart, (LPRECT)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1269

1270
	case SB_GETTEXTA:
1271
	    return STATUSBAR_GetTextA (infoPtr, nPart, (LPSTR)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1272

1273
	case SB_GETTEXTW:
1274
	    return STATUSBAR_GetTextW (infoPtr, nPart, (LPWSTR)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1275

1276 1277
	case SB_GETTEXTLENGTHA:
	case SB_GETTEXTLENGTHW:
1278
	    return STATUSBAR_GetTextLength (infoPtr, nPart);
Alexandre Julliard's avatar
Alexandre Julliard committed
1279

1280
	case SB_GETTIPTEXTA:
1281
	    return STATUSBAR_GetTipTextA (infoPtr,  LOWORD(wParam), (LPSTR)lParam,  HIWORD(wParam));
Alexandre Julliard's avatar
Alexandre Julliard committed
1282

1283
	case SB_GETTIPTEXTW:
1284
	    return STATUSBAR_GetTipTextW (infoPtr,  LOWORD(wParam), (LPWSTR)lParam,  HIWORD(wParam));
1285 1286

	case SB_GETUNICODEFORMAT:
1287
	    return infoPtr->bUnicode;
Alexandre Julliard's avatar
Alexandre Julliard committed
1288 1289

	case SB_ISSIMPLE:
1290
	    return infoPtr->simple;
Alexandre Julliard's avatar
Alexandre Julliard committed
1291

Filip Navara's avatar
Filip Navara committed
1292 1293 1294
	case SB_SETBORDERS:
	    return STATUSBAR_SetBorders (infoPtr, (INT *)lParam);

Alexandre Julliard's avatar
Alexandre Julliard committed
1295
	case SB_SETBKCOLOR:
1296
	    return STATUSBAR_SetBkColor (infoPtr, (COLORREF)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1297 1298

	case SB_SETICON:
1299
	    return STATUSBAR_SetIcon (infoPtr, nPart, (HICON)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1300 1301

	case SB_SETMINHEIGHT:
1302
	    return STATUSBAR_SetMinHeight (infoPtr, (INT)wParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1303

1304
	case SB_SETPARTS:
1305
	    return STATUSBAR_SetParts (infoPtr, (INT)wParam, (LPINT)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1306

1307
	case SB_SETTEXTA:
1308
	    return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPCWSTR)lParam, FALSE);
Alexandre Julliard's avatar
Alexandre Julliard committed
1309

1310
	case SB_SETTEXTW:
1311
	    return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPCWSTR)lParam, TRUE);
Alexandre Julliard's avatar
Alexandre Julliard committed
1312

1313
	case SB_SETTIPTEXTA:
1314
	    return STATUSBAR_SetTipTextA (infoPtr, (INT)wParam, (LPSTR)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1315

1316
	case SB_SETTIPTEXTW:
1317
	    return STATUSBAR_SetTipTextW (infoPtr, (INT)wParam, (LPWSTR)lParam);
1318 1319

	case SB_SETUNICODEFORMAT:
1320
	    return STATUSBAR_SetUnicodeFormat (infoPtr, (BOOL)wParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1321 1322

	case SB_SIMPLE:
1323
	    return STATUSBAR_Simple (infoPtr, (BOOL)wParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1324 1325

	case WM_CREATE:
1326
	    return STATUSBAR_WMCreate (hwnd, (LPCREATESTRUCTA)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1327 1328

	case WM_DESTROY:
1329
	    return STATUSBAR_WMDestroy (infoPtr);
Alexandre Julliard's avatar
Alexandre Julliard committed
1330 1331

	case WM_GETFONT:
1332
	    return (LRESULT)(infoPtr->hFont? infoPtr->hFont : infoPtr->hDefaultFont);
Alexandre Julliard's avatar
Alexandre Julliard committed
1333 1334

	case WM_GETTEXT:
1335
            return STATUSBAR_WMGetText (infoPtr, (INT)wParam, (LPWSTR)lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1336 1337

	case WM_GETTEXTLENGTH:
1338
	    return STATUSBAR_GetTextLength (infoPtr, 0);
Alexandre Julliard's avatar
Alexandre Julliard committed
1339 1340

	case WM_LBUTTONDBLCLK:
1341
            return STATUSBAR_SendMouseNotify(infoPtr, NM_DBLCLK, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1342 1343

	case WM_LBUTTONUP:
1344
	    return STATUSBAR_SendMouseNotify(infoPtr, NM_CLICK, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1345 1346

	case WM_MOUSEMOVE:
1347
	    return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1348 1349

	case WM_NCHITTEST:
1350 1351
	    res = STATUSBAR_WMNCHitTest(infoPtr, (short)LOWORD(lParam),
                                        (short)HIWORD(lParam));
1352 1353
	    if (res != HTERROR) return res;
	    return DefWindowProcW (hwnd, msg, wParam, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1354 1355

	case WM_NCLBUTTONUP:
1356
	case WM_NCLBUTTONDOWN:
1357
    	    PostMessageW (infoPtr->Notify, msg, wParam, lParam);
1358
	    return 0;
Alexandre Julliard's avatar
Alexandre Julliard committed
1359

1360 1361
	case WM_NOTIFYFORMAT:
	    return STATUSBAR_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam);
1362

1363
	case WM_PRINTCLIENT:
Alexandre Julliard's avatar
Alexandre Julliard committed
1364
	case WM_PAINT:
1365
	    return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1366 1367

	case WM_RBUTTONDBLCLK:
1368
	    return STATUSBAR_SendMouseNotify(infoPtr, NM_RDBLCLK, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1369 1370

	case WM_RBUTTONUP:
1371
	    return STATUSBAR_SendMouseNotify(infoPtr, NM_RCLICK, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1372 1373

	case WM_SETFONT:
1374
	    return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
Alexandre Julliard's avatar
Alexandre Julliard committed
1375 1376

	case WM_SETTEXT:
1377 1378
	    return STATUSBAR_WMSetText (infoPtr, (LPCSTR)lParam);

Alexandre Julliard's avatar
Alexandre Julliard committed
1379
	case WM_SIZE:
1380 1381
	    if (STATUSBAR_WMSize (infoPtr, (WORD)wParam)) return 0;
            return DefWindowProcW (hwnd, msg, wParam, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1382

1383 1384 1385
        case WM_THEMECHANGED:
            return theme_changed (infoPtr);

Alexandre Julliard's avatar
Alexandre Julliard committed
1386
	default:
1387
	    if ((msg >= WM_USER) && (msg < WM_APP))
1388
		ERR("unknown msg %04x wp=%04lx lp=%08lx\n",
Alexandre Julliard's avatar
Alexandre Julliard committed
1389
		     msg, wParam, lParam);
1390
	    return DefWindowProcW (hwnd, msg, wParam, lParam);
Alexandre Julliard's avatar
Alexandre Julliard committed
1391 1392 1393 1394
    }
}


Alexandre Julliard's avatar
Alexandre Julliard committed
1395
/***********************************************************************
Alexandre Julliard's avatar
Alexandre Julliard committed
1396
 * STATUS_Register [Internal]
Alexandre Julliard's avatar
Alexandre Julliard committed
1397 1398 1399
 *
 * Registers the status window class.
 */
1400

1401
void
1402
STATUS_Register (void)
Alexandre Julliard's avatar
Alexandre Julliard committed
1403
{
1404
    WNDCLASSW wndClass;
Alexandre Julliard's avatar
Alexandre Julliard committed
1405

1406
    ZeroMemory (&wndClass, sizeof(WNDCLASSW));
Alexandre Julliard's avatar
Alexandre Julliard committed
1407
    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
1408
    wndClass.lpfnWndProc   = StatusWindowProc;
Alexandre Julliard's avatar
Alexandre Julliard committed
1409
    wndClass.cbClsExtra    = 0;
1410
    wndClass.cbWndExtra    = sizeof(STATUS_INFO *);
1411
    wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
1412
    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1413
    wndClass.lpszClassName = STATUSCLASSNAMEW;
1414

1415
    RegisterClassW (&wndClass);
Alexandre Julliard's avatar
Alexandre Julliard committed
1416
}
Alexandre Julliard's avatar
Alexandre Julliard committed
1417

1418 1419 1420 1421 1422 1423 1424

/***********************************************************************
 * STATUS_Unregister [Internal]
 *
 * Unregisters the status window class.
 */

1425
void
1426
STATUS_Unregister (void)
1427
{
1428
    UnregisterClassW (STATUSCLASSNAMEW, NULL);
1429
}