Changeset 19075


Ignore:
Timestamp:
May 29, 2002, 6:05:40 PM (23 years ago)
Author:
sandervl
Message:

Updated status control to latest Wine & applied two bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/comctl32/status.c

    r18084 r19075  
    44 * Copyright 1996 Bruce Milner
    55 * 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 * FIXME:
     23 * 1) Implement all CCS_* styles.
     24 * 2) Should we hide grip if the parent window is maximized?
    625 */
    7 /*
    8  * FIXME/TODO
    9  * 1) Don't hard code bar to bottom of window, allow CCS_TOP also.
    10  * 2) Tooltip support (almost done).
    11  * 3) where else should we use infoPtr->hwndParent instead of GetParent() ?
    12  * 4) send WM_QUERYFORMAT
    13  */
    1426
    1527#include <string.h>
     28
    1629#include "winbase.h"
    1730#include "wine/unicode.h"
    1831#include "commctrl.h"
    19 #include "debugtools.h"
    20 #ifdef __WIN32OS2__
    21 #include "ccbase.h"
    22 #endif
    23 
    24 DEFAULT_DEBUG_CHANNEL(statusbar);
     32#include "wine/debug.h"
     33
     34WINE_DEFAULT_DEBUG_CHANNEL(statusbar);
    2535
    2636typedef struct
    2737{
    28     INT x;
    29     INT style;
     38    INT         x;
     39    INT         style;
    3040    RECT        bound;
    3141    LPWSTR      text;
    32     HICON     hIcon;
     42    HICON       hIcon;
    3343} STATUSWINDOWPART;
    3444
    3545typedef struct
    3646{
    37 #ifdef __WIN32OS2__
    38     COMCTL32_HEADER   header;
    39 #endif
    40     HWND              hwndParent;
     47    HWND              Self;
    4148    WORD              numParts;
    42     WORD              textHeight;
    4349    UINT              height;
    4450    BOOL              simple;
     
    4652    HFONT             hFont;
    4753    HFONT             hDefaultFont;
    48     COLORREF            clrBk;     /* background color */
    49     BOOL              bUnicode;  /* unicode flag */
    50     STATUSWINDOWPART    part0;     /* simple window */
    51     STATUSWINDOWPART   *parts;
     54    COLORREF          clrBk;            /* background color */
     55    BOOL              bUnicode;         /* unicode flag */
     56    BOOL              NtfUnicode;       /* notify format */
     57    STATUSWINDOWPART  part0;            /* simple window */
     58    STATUSWINDOWPART* parts;
    5259} STATUSWINDOWINFO;
    5360
     
    5865 */
    5966
    60 
    61 #define _MAX(a,b) (((a)>(b))?(a):(b))
    62 #define _MIN(a,b) (((a)>(b))?(b):(a))
    63 
    6467#define HORZ_BORDER 0
    6568#define VERT_BORDER 2
    6669#define HORZ_GAP    2
    6770
    68 #define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongA (hwnd, 0))
     71#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongW (hwnd, 0))
    6972
    7073/* prototype */
    7174static void
    72 STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr, HWND hwnd);
     75STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr);
     76
     77static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW)
     78{
     79  return isW ? debugstr_w(text) : debugstr_a((LPCSTR)text);
     80}
    7381
    7482static void
    7583STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
    7684{
    77     HPEN hOldPen;
     85    HPEN hPenFace, hPenShadow, hPenHighlight, hOldPen;
    7886    POINT pt;
    7987    INT i;
    8088
    8189    TRACE("draw size grip %d,%d - %d,%d\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
     90
    8291    pt.x = lpRect->right - 1;
    8392    pt.y = lpRect->bottom - 1;
    8493
    85     hOldPen = SelectObject (hdc, GetSysColorPen (COLOR_3DFACE));
     94    hPenFace = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DFACE ));
     95    hOldPen = SelectObject( hdc, hPenFace );
    8696    MoveToEx (hdc, pt.x - 12, pt.y, NULL);
    8797    LineTo (hdc, pt.x, pt.y);
    88     LineTo (hdc, pt.x, pt.y - 12);
     98    LineTo (hdc, pt.x, pt.y - 13);
    8999
    90100    pt.x--;
    91101    pt.y--;
    92102
    93     SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW));
     103    hPenShadow = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DSHADOW ));
     104    SelectObject( hdc, hPenShadow );
    94105    for (i = 1; i < 11; i += 4) {
    95106        MoveToEx (hdc, pt.x - i, pt.y, NULL);
    96         LineTo (hdc, pt.x, pt.y - i);
    97 
    98         MoveToEx (hdc, pt.x - i-1, pt.y, NULL);
    99         LineTo (hdc, pt.x, pt.y - i-1);
    100     }
    101 
    102     SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT));
     107        LineTo (hdc, pt.x + 1, pt.y - i - 1);
     108
     109        MoveToEx (hdc, pt.x - i - 1, pt.y, NULL);
     110        LineTo (hdc, pt.x + 1, pt.y - i - 2);
     111    }
     112
     113    hPenHighlight = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DHIGHLIGHT ));
     114    SelectObject( hdc, hPenHighlight );
    103115    for (i = 3; i < 13; i += 4) {
    104116        MoveToEx (hdc, pt.x - i, pt.y, NULL);
    105         LineTo (hdc, pt.x, pt.y - i);
     117        LineTo (hdc, pt.x + 1, pt.y - i - 1);
    106118    }
    107119
    108120    SelectObject (hdc, hOldPen);
     121    DeleteObject( hPenFace );
     122    DeleteObject( hPenShadow );
     123    DeleteObject( hPenHighlight );
    109124}
    110125
    111126
    112127static void
    113 STATUSBAR_DrawPart (HDC hdc, STATUSWINDOWPART *part)
     128STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINFO *infoPtr, int itemID)
    114129{
    115130    RECT r = part->bound;
     
    118133    TRACE("part bound %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom);
    119134    if (part->style & SBT_POPOUT)
    120       border = BDR_RAISEDOUTER;
     135        border = BDR_RAISEDOUTER;
    121136    else if (part->style & SBT_NOBORDERS)
    122       border = 0;
     137        border = 0;
    123138
    124139    DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
    125 
    126     /* draw the icon */
    127     if (part->hIcon) {
    128         INT cy = r.bottom - r.top;
    129 
    130         r.left += 2;
    131         DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
    132         r.left += cy;
    133     }
    134 
    135     /* now draw text */
    136     if (part->text) {
    137       int oldbkmode = SetBkMode(hdc, TRANSPARENT);
    138       LPWSTR p = (LPWSTR)part->text;
    139       UINT align = DT_LEFT;
    140       if (*p == L'\t') {
    141         p++;
    142         align = DT_CENTER;
    143 
    144         if (*p == L'\t') {
    145           p++;
    146           align = DT_RIGHT;
    147         }
    148       }
    149       r.left += 3;
    150       TRACE("%s at %d,%d - %d,%d\n", debugstr_w(p), r.left, r.top, r.right, r.bottom);
    151       DrawTextW (hdc, p, -1, &r, align|DT_VCENTER|DT_SINGLELINE);
    152       if (oldbkmode != TRANSPARENT)
    153         SetBkMode(hdc, oldbkmode);
    154     }
    155 }
    156 
    157 
    158 static VOID
    159 STATUSBAR_RefreshPart (STATUSWINDOWINFO *infoPtr, HWND hwnd, STATUSWINDOWPART *part, HDC hdc, int itemID)
     140       
     141    if (part->style & SBT_OWNERDRAW)
     142        {
     143            DRAWITEMSTRUCT dis;
     144
     145            dis.CtlID = GetWindowLongW (infoPtr->Self, GWL_ID);
     146            dis.itemID = itemID;
     147            dis.hwndItem = infoPtr->Self;
     148            dis.hDC = hdc;
     149            dis.rcItem = r;
     150            dis.itemData = (INT)part->text;
     151            SendMessageW (GetParent (infoPtr->Self), WM_DRAWITEM,
     152                    (WPARAM)dis.CtlID, (LPARAM)&dis);
     153    }
     154    else
     155        {
     156            if (part->hIcon)
     157                {
     158                INT cy = r.bottom - r.top;
     159
     160                r.left += 2;
     161                DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
     162                r.left += cy;
     163                }
     164        DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
     165    }
     166}
     167
     168
     169static void
     170STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *part, HDC hdc, int itemID)
    160171{
    161172    HBRUSH hbrBk;
     
    163174
    164175    TRACE("item %d\n", itemID);
    165     if (!IsWindowVisible (hwnd))
     176    if (!IsWindowVisible (infoPtr->Self))
    166177        return;
    167178
     
    169180
    170181    if (infoPtr->clrBk != CLR_DEFAULT)
    171         hbrBk = CreateSolidBrush (infoPtr->clrBk);
     182            hbrBk = CreateSolidBrush (infoPtr->clrBk);
    172183    else
    173         hbrBk = GetSysColorBrush (COLOR_3DFACE);
     184            hbrBk = GetSysColorBrush (COLOR_3DFACE);
    174185    FillRect(hdc, &part->bound, hbrBk);
    175186
    176187    hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
    177188
    178     if (part->style & SBT_OWNERDRAW) {
    179         DRAWITEMSTRUCT dis;
    180 
    181         dis.CtlID = GetWindowLongA (hwnd, GWL_ID);
    182         dis.itemID = itemID;
    183         dis.hwndItem = hwnd;
    184         dis.hDC = hdc;
    185         dis.rcItem = part->bound;
    186         dis.itemData = (INT)part->text;
    187         SendMessageA (GetParent (hwnd), WM_DRAWITEM,
    188                 (WPARAM)dis.CtlID, (LPARAM)&dis);
    189     } else
    190         STATUSBAR_DrawPart (hdc, part);
     189        STATUSBAR_DrawPart (hdc, part, infoPtr, itemID);
    191190
    192191    SelectObject (hdc, hOldFont);
    193192
    194193    if (infoPtr->clrBk != CLR_DEFAULT)
    195         DeleteObject (hbrBk);
    196 
    197     if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) {
    198         RECT rect;
    199 
    200         GetClientRect (hwnd, &rect);
    201         STATUSBAR_DrawSizeGrip (hdc, &rect);
    202     }
    203 }
    204 
    205 
    206 static BOOL
    207 STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HWND hwnd, HDC hdc)
     194            DeleteObject (hbrBk);
     195
     196    if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
     197        {
     198            RECT rect;
     199
     200            GetClientRect (infoPtr->Self, &rect);
     201            STATUSBAR_DrawSizeGrip (hdc, &rect);
     202    }
     203}
     204
     205
     206static LRESULT
     207STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc)
    208208{
    209209    int      i;
     
    213213
    214214    TRACE("\n");
    215     if (!IsWindowVisible(hwnd))
    216         return (TRUE);
    217 
    218     STATUSBAR_SetPartBounds(infoPtr, hwnd);
    219 
    220     GetClientRect (hwnd, &rect);
     215    if (!IsWindowVisible(infoPtr->Self))
     216        return 0;
     217
     218    STATUSBAR_SetPartBounds(infoPtr);
     219
     220    GetClientRect (infoPtr->Self, &rect);
    221221
    222222    if (infoPtr->clrBk != CLR_DEFAULT)
    223         hbrBk = CreateSolidBrush (infoPtr->clrBk);
     223            hbrBk = CreateSolidBrush (infoPtr->clrBk);
    224224    else
    225         hbrBk = GetSysColorBrush (COLOR_3DFACE);
     225            hbrBk = GetSysColorBrush (COLOR_3DFACE);
    226226    FillRect(hdc, &rect, hbrBk);
    227227
     
    229229
    230230    if (infoPtr->simple) {
    231         STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->part0, hdc, 0);
     231            STATUSBAR_RefreshPart (infoPtr, &infoPtr->part0, hdc, 0);
    232232    } else {
    233         for (i = 0; i < infoPtr->numParts; i++) {
    234             if (infoPtr->parts[i].style & SBT_OWNERDRAW) {
    235                 DRAWITEMSTRUCT dis;
    236 
    237                 dis.CtlID = GetWindowLongA (hwnd, GWL_ID);
    238                 dis.itemID = i;
    239                 dis.hwndItem = hwnd;
    240                 dis.hDC = hdc;
    241                 dis.rcItem = infoPtr->parts[i].bound;
    242                 dis.itemData = (INT)infoPtr->parts[i].text;
    243                 SendMessageA (GetParent (hwnd), WM_DRAWITEM,
    244                         (WPARAM)dis.CtlID, (LPARAM)&dis);
    245             } else
    246                 STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->parts[i], hdc, i);
    247         }
     233            for (i = 0; i < infoPtr->numParts; i++) {
     234                    STATUSBAR_RefreshPart (infoPtr, &infoPtr->parts[i], hdc, i);
     235            }
    248236    }
    249237
     
    251239
    252240    if (infoPtr->clrBk != CLR_DEFAULT)
    253         DeleteObject (hbrBk);
    254 
    255     if (GetWindowLongA(hwnd, GWL_STYLE) & SBARS_SIZEGRIP)
    256         STATUSBAR_DrawSizeGrip (hdc, &rect);
    257 
    258     return TRUE;
     241            DeleteObject (hbrBk);
     242
     243    if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
     244            STATUSBAR_DrawSizeGrip (hdc, &rect);
     245
     246    return 0;
    259247}
    260248
    261249
    262250static void
    263 STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr, HWND hwnd)
     251STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr)
    264252{
    265253    STATUSWINDOWPART *part;
     
    268256
    269257    /* get our window size */
    270     GetClientRect (hwnd, &rect);
     258    GetClientRect (infoPtr->Self, &rect);
    271259    TRACE("client wnd size is %d,%d - %d,%d\n", rect.left, rect.top, rect.right, rect.bottom);
    272260
     
    292280
    293281        if (infoPtr->hwndToolTip) {
    294             TTTOOLINFOA ti;
    295 
    296             ti.cbSize = sizeof(TTTOOLINFOA);
    297             ti.hwnd = hwnd;
     282            TTTOOLINFOW ti;
     283
     284            ti.cbSize = sizeof(TTTOOLINFOW);
     285            ti.hwnd = infoPtr->Self;
    298286            ti.uId = i;
    299287            ti.rect = *r;
    300             SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA,
     288            SendMessageW (infoPtr->hwndToolTip, TTM_NEWTOOLRECTW,
    301289                            0, (LPARAM)&ti);
    302290        }
     
    305293
    306294
    307 static VOID
    308 STATUSBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
    309                       WPARAM wParam, LPARAM lParam)
     295static LRESULT
     296STATUSBAR_Relay2Tip (STATUSWINDOWINFO *infoPtr, UINT uMsg,
     297                     WPARAM wParam, LPARAM lParam)
    310298{
    311299    MSG msg;
    312300
    313     msg.hwnd = hwndMsg;
     301    msg.hwnd = infoPtr->Self;
    314302    msg.message = uMsg;
    315303    msg.wParam = wParam;
     
    319307    msg.pt.y = HIWORD(GetMessagePos ());
    320308
    321     SendMessageA (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
    322 }
    323 
    324 
    325 inline static LRESULT
    326 STATUSBAR_GetBorders (LPARAM lParam)
    327 {
    328     LPINT out = (LPINT) lParam;
    329 
     309    return SendMessageW (infoPtr->hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
     310}
     311
     312
     313static BOOL
     314STATUSBAR_GetBorders (INT out[])
     315{
    330316    TRACE("\n");
    331317    out[0] = HORZ_BORDER; /* horizontal border width */
     
    337323
    338324
    339 static LRESULT
    340 STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
    341 {
    342     INT nPart;
    343 
    344     nPart = (INT)wParam & 0x00ff;
     325static HICON
     326STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart)
     327{
    345328    TRACE("%d\n", nPart);
     329    /* MSDN says: "simple parts are indexed with -1" */
    346330    if ((nPart < -1) || (nPart >= infoPtr->numParts))
    347331        return 0;
     
    354338
    355339
    356 static LRESULT
    357 STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    358 {
    359     LPINT parts;
    360     INT   num_parts;
     340static INT
     341STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, INT num_parts, INT parts[])
     342{
    361343    INT   i;
    362344
    363     num_parts = (INT) wParam;
    364345    TRACE("(%d)\n", num_parts);
    365     parts = (LPINT) lParam;
    366346    if (parts) {
    367347        for (i = 0; i < num_parts; i++) {
     
    369349        }
    370350    }
    371     return (infoPtr->numParts);
    372 }
    373 
    374 
    375 static LRESULT
    376 STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    377 {
    378     int nPart;
    379     LPRECT  rect;
    380 
    381     nPart = ((INT) wParam) & 0x00ff;
     351    return infoPtr->numParts;
     352}
     353
     354
     355static BOOL
     356STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, INT nPart, LPRECT rect)
     357{
    382358    TRACE("part %d\n", nPart);
    383     rect = (LPRECT) lParam;
    384359    if (infoPtr->simple)
    385360        *rect = infoPtr->part0.bound;
     
    391366
    392367static LRESULT
    393 STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
     368STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf)
    394369{
    395370    STATUSWINDOWPART *part;
    396     INT   nPart;
    397371    LRESULT result;
    398372
    399     nPart = ((INT) wParam) & 0x00ff;
    400373    TRACE("part %d\n", nPart);
     374
     375    /* MSDN says: "simple parts use index of 0", so this check is ok. */
     376    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
     377
    401378    if (infoPtr->simple)
    402379        part = &infoPtr->part0;
    403380    else
    404 #ifdef __WIN32OS2__
    405     {
    406         if (nPart >= infoPtr->numParts)
    407             return FALSE;
    408381        part = &infoPtr->parts[nPart];
    409     }
    410 #else
    411         part = &infoPtr->parts[nPart];
    412 #endif
    413382
    414383    if (part->style & SBT_OWNERDRAW)
     
    418387                                                      NULL, 0, NULL, NULL ) - 1 : 0;
    419388        result = MAKELONG( len, part->style );
    420         if (lParam && len)
    421             WideCharToMultiByte( CP_ACP, 0, part->text, -1, (LPSTR)lParam, len+1, NULL, NULL );
     389        if (part->text && buf)
     390            WideCharToMultiByte( CP_ACP, 0, part->text, -1, buf, len+1, NULL, NULL );
    422391    }
    423392    return result;
     
    426395
    427396static LRESULT
    428 STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
     397STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, INT nPart, LPWSTR buf)
    429398{
    430399    STATUSWINDOWPART *part;
    431     INT   nPart;
    432400    LRESULT result;
    433401
    434     nPart = ((INT)wParam) & 0x00ff;
    435402    TRACE("part %d\n", nPart);
     403    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
     404
    436405    if (infoPtr->simple)
    437406        part = &infoPtr->part0;
    438407    else
    439 #ifdef __WIN32OS2__
    440     {
    441         if (nPart >= infoPtr->numParts)
    442             return FALSE;
    443408        part = &infoPtr->parts[nPart];
    444     }
    445 #else
    446         part = &infoPtr->parts[nPart];
    447 #endif
    448409
    449410    if (part->style & SBT_OWNERDRAW)
     
    452413        result = part->text ? strlenW (part->text) : 0;
    453414        result |= (part->style << 16);
    454         if (part->text && lParam)
    455             strcpyW ((LPWSTR)lParam, part->text);
     415        if (part->text && buf)
     416            strcpyW (buf, part->text);
    456417    }
    457418    return result;
     
    460421
    461422static LRESULT
    462 STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
     423STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, INT nPart)
    463424{
    464425    STATUSWINDOWPART *part;
    465     INT nPart;
    466426    DWORD result;
    467427
    468     nPart = ((INT) wParam) & 0x00ff;
    469 
    470428    TRACE("part %d\n", nPart);
     429
     430    /* MSDN says: "simple parts use index of 0", so this check is ok. */
     431    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
    471432
    472433    if (infoPtr->simple)
    473434        part = &infoPtr->part0;
    474435    else
    475 #ifdef __WIN32OS2__
    476     {
    477         if (nPart >= infoPtr->numParts)
    478             return FALSE;
    479         if (infoPtr->simple)
    480         part = &infoPtr->part0;
    481         else
    482         part = &infoPtr->parts[nPart];
    483     }
    484 #else
    485         if (infoPtr->simple)
    486         part = &infoPtr->part0;
    487         else
    488         part = &infoPtr->parts[nPart];
    489 #endif
     436        part = &infoPtr->parts[nPart];
    490437
    491438    if (part->text)
     
    498445}
    499446
    500 
    501 static LRESULT
    502 STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    503 {
    504     LPSTR tip = (LPSTR)lParam;
    505 
     447static LRESULT
     448STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR tip, INT size)
     449{
     450    TRACE("\n");
    506451    if (tip) {
    507452        CHAR buf[INFOTIPSIZE];
     
    511456            TTTOOLINFOA ti;
    512457            ti.cbSize = sizeof(TTTOOLINFOA);
    513             ti.hwnd = hwnd;
    514             ti.uId = LOWORD(wParam);
     458            ti.hwnd = infoPtr->Self;
     459            ti.uId = id;
    515460            ti.lpszText = buf;
    516             SendMessageA(infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti);
     461            SendMessageA (infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti);
    517462        }
    518         lstrcpynA(tip, buf, HIWORD(wParam));
     463        lstrcpynA (tip, buf, size);
    519464    }
    520465    return 0;
     
    523468
    524469static LRESULT
    525 STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    526 {
    527     LPWSTR tip = (LPWSTR)lParam;
    528 
     470STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR tip, INT size)
     471{
    529472    TRACE("\n");
    530473    if (tip) {
     
    535478            TTTOOLINFOW ti;
    536479            ti.cbSize = sizeof(TTTOOLINFOW);
    537             ti.hwnd = hwnd;
    538             ti.uId = LOWORD(wParam);
     480            ti.hwnd = infoPtr->Self;
     481            ti.uId = id;
    539482            ti.lpszText = buf;
    540483            SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti);
    541484        }
    542         lstrcpynW(tip, buf, HIWORD(wParam));
     485        lstrcpynW(tip, buf, size);
    543486    }
    544487
     
    547490
    548491
    549 inline static LRESULT
    550 STATUSBAR_GetUnicodeFormat (STATUSWINDOWINFO *infoPtr, HWND hwnd)
    551 {
    552     return infoPtr->bUnicode;
    553 }
    554 
    555 
    556 inline static LRESULT
    557 STATUSBAR_IsSimple (STATUSWINDOWINFO *infoPtr, HWND hwnd)
    558 {
    559     return infoPtr->simple;
    560 }
    561 
    562 
    563 static LRESULT
    564 STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
     492static COLORREF
     493STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, COLORREF color)
    565494{
    566495    COLORREF oldBkColor;
    567496
    568497    oldBkColor = infoPtr->clrBk;
    569     infoPtr->clrBk = (COLORREF)lParam;
    570     InvalidateRect(hwnd, NULL, FALSE);
     498    infoPtr->clrBk = color;
     499    InvalidateRect(infoPtr->Self, NULL, FALSE);
    571500
    572501    TRACE("CREF: %08lx -> %08lx\n", oldBkColor, infoPtr->clrBk);
     
    575504
    576505
    577 static LRESULT
    578 STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    579 {
    580     INT nPart = (INT)wParam & 0x00ff;
    581 
     506static BOOL
     507STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon)
     508{
    582509    if ((nPart < -1) || (nPart >= infoPtr->numParts))
    583510        return FALSE;
    584511
    585     TRACE("setting part %d, icon %lx\n",nPart,lParam);
    586 
     512    TRACE("setting part %d\n", nPart);
     513
     514    /* FIXME: MSDN says "if nPart is -1, the status bar is assumed simple" */
    587515    if (nPart == -1) {
    588         if (infoPtr->part0.hIcon == (HICON)lParam) /* same as - no redraw */
     516        if (infoPtr->part0.hIcon == hIcon) /* same as - no redraw */
    589517            return TRUE;
    590         infoPtr->part0.hIcon = (HICON)lParam;
     518        infoPtr->part0.hIcon = hIcon;
    591519        if (infoPtr->simple)
    592             InvalidateRect(hwnd, &infoPtr->part0.bound, FALSE);
     520            InvalidateRect(infoPtr->Self, &infoPtr->part0.bound, FALSE);
    593521    } else {
    594         if (infoPtr->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */
     522        if (infoPtr->parts[nPart].hIcon == hIcon) /* same as - no redraw */
    595523            return TRUE;
    596524
    597         infoPtr->parts[nPart].hIcon = (HICON)lParam;
     525        infoPtr->parts[nPart].hIcon = hIcon;
    598526        if (!(infoPtr->simple))
    599             InvalidateRect(hwnd, &infoPtr->parts[nPart].bound, FALSE);
     527            InvalidateRect(infoPtr->Self, &infoPtr->parts[nPart].bound, FALSE);
    600528    }
    601529    return TRUE;
     
    603531
    604532
    605 static LRESULT
    606 STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    607 {
    608 
    609     TRACE("\n");
    610     if (IsWindowVisible (hwnd)) {
    611         HWND parent = GetParent (hwnd);
     533static BOOL
     534STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height)
     535{
     536
     537    TRACE("(height=%d)\n", height);
     538    if (IsWindowVisible (infoPtr->Self)) {
    612539        INT  width, x, y;
    613540        RECT parent_rect;
    614541
    615         GetClientRect (parent, &parent_rect);
    616         infoPtr->height = (INT)wParam + VERT_BORDER;
     542        GetClientRect (GetParent (infoPtr->Self), &parent_rect);
     543        infoPtr->height = height + VERT_BORDER;
    617544        width = parent_rect.right - parent_rect.left;
    618545        x = parent_rect.left;
    619546        y = parent_rect.bottom - infoPtr->height;
    620         MoveWindow (hwnd, parent_rect.left,
     547        MoveWindow (infoPtr->Self, parent_rect.left,
    621548                      parent_rect.bottom - infoPtr->height,
    622549                      width, infoPtr->height, TRUE);
    623         STATUSBAR_SetPartBounds (infoPtr, hwnd);
     550        STATUSBAR_SetPartBounds (infoPtr);
    624551    }
    625552
     
    628555
    629556
    630 static LRESULT
    631 STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
     557static BOOL
     558STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts)
    632559{
    633560    STATUSWINDOWPART *tmp;
    634     LPINT parts;
    635     int i;
    636     int oldNumParts;
    637 
    638     TRACE("(%d,%p)\n",wParam,(LPVOID)lParam);
    639 
    640     /* FIXME: should return FALSE sometimes (maybe when wParam == 0 ?) */
    641     if (infoPtr->simple)
    642         infoPtr->simple = FALSE;
     561    int i, oldNumParts;
     562
     563    TRACE("(%d,%p)\n", count, parts);
    643564
    644565    oldNumParts = infoPtr->numParts;
    645     infoPtr->numParts = (INT) wParam;
    646     parts = (LPINT) lParam;
     566    infoPtr->numParts = count;
    647567    if (oldNumParts > infoPtr->numParts) {
    648568        for (i = infoPtr->numParts ; i < oldNumParts; i++) {
     
    650570                COMCTL32_Free (infoPtr->parts[i].text);
    651571        }
    652     }
    653     if (oldNumParts < infoPtr->numParts) {
     572    } else if (oldNumParts < infoPtr->numParts) {
    654573        tmp = COMCTL32_Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts);
     574        if (!tmp) return FALSE;
    655575        for (i = 0; i < oldNumParts; i++) {
    656576            tmp[i] = infoPtr->parts[i];
     
    661581    }
    662582    if (oldNumParts == infoPtr->numParts) {
    663         for (i=0;i<oldNumParts;i++)
     583        for (i=0; i < oldNumParts; i++)
    664584            if (infoPtr->parts[i].x != parts[i])
    665585                break;
     
    672592
    673593    if (infoPtr->hwndToolTip) {
    674         INT nTipCount =
    675             SendMessageA (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);
    676 
     594        INT nTipCount, i;
     595        TTTOOLINFOW ti;
     596
     597        ZeroMemory (&ti, sizeof(TTTOOLINFOW));
     598        ti.cbSize = sizeof(TTTOOLINFOW);
     599        ti.hwnd = infoPtr->Self;
     600
     601        nTipCount = SendMessageW (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);
    677602        if (nTipCount < infoPtr->numParts) {
    678603            /* add tools */
    679             TTTOOLINFOA ti;
    680             INT i;
    681 
    682             ZeroMemory (&ti, sizeof(TTTOOLINFOA));
    683             ti.cbSize = sizeof(TTTOOLINFOA);
    684             ti.hwnd = hwnd;
    685604            for (i = nTipCount; i < infoPtr->numParts; i++) {
    686605                TRACE("add tool %d\n", i);
    687606                ti.uId = i;
    688                 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA,
     607                SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW,
    689608                                0, (LPARAM)&ti);
    690609            }
     
    692611        else if (nTipCount > infoPtr->numParts) {
    693612            /* delete tools */
    694             INT i;
    695 
    696613            for (i = nTipCount - 1; i >= infoPtr->numParts; i--) {
    697                 FIXME("delete tool %d\n", i);
     614                TRACE("delete tool %d\n", i);
     615                ti.uId = i;
     616                SendMessageW (infoPtr->hwndToolTip, TTM_DELTOOLW,
     617                                0, (LPARAM)&ti);
    698618            }
    699619        }
    700620    }
    701     STATUSBAR_SetPartBounds (infoPtr, hwnd);
    702     InvalidateRect(hwnd, NULL, FALSE);
     621    STATUSBAR_SetPartBounds (infoPtr);
     622    InvalidateRect(infoPtr->Self, NULL, FALSE);
    703623    return TRUE;
    704624}
    705625
    706626
    707 static LRESULT
    708 STATUSBAR_SetTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
     627static BOOL
     628STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
     629                    LPCWSTR text, BOOL isW)
    709630{
    710631    STATUSWINDOWPART *part=NULL;
    711     int nPart;
    712     int style;
    713     LPSTR text;
    714     BOOL        changed = FALSE;
    715 
    716     text = (LPSTR) lParam;
    717     nPart = ((INT) wParam) & 0x00ff;
    718     style = ((INT) wParam) & 0xff00;
    719 
    720 #ifdef __WIN32OS2__
     632    BOOL changed = FALSE;
     633
    721634    if (style & SBT_OWNERDRAW) {   
    722635         TRACE("part %d, text %x\n",nPart,text);
    723636    }
    724     else TRACE("part %d, text %s\n",nPart,debugstr_a(text));
    725 #else
    726     TRACE("part %d, text %s\n",nPart,debugstr_a(text));
    727 #endif
    728 
    729     if (nPart==255)
     637    else TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW));
     638
     639    /* MSDN says: "If the parameter is set to SB_SIMPLEID (255), the status
     640     * window is assumed to be a simple window */
     641
     642    if (nPart == 0x00ff) {
    730643        part = &infoPtr->part0;
    731     else if (!infoPtr->simple && infoPtr->parts!=NULL)
    732 #ifdef __WIN32OS2__
    733     {
    734         if (nPart >= infoPtr->numParts)
    735             return FALSE;
    736         part = &infoPtr->parts[nPart];
    737     }
    738 #else
    739         part = &infoPtr->parts[nPart];
    740 #endif
     644    } else {
     645        if (infoPtr->parts && nPart >= 0 && nPart < infoPtr->numParts) {
     646            part = &infoPtr->parts[nPart];
     647        }
     648    }
    741649    if (!part) return FALSE;
    742650
     
    746654    part->style = style;
    747655    if (style & SBT_OWNERDRAW) {
    748         if (part->text == (LPWSTR)text)
     656        if (part->text == text)
    749657            return TRUE;
    750658        part->text = (LPWSTR)text;
     
    752660        LPWSTR ntext;
    753661
     662        if (text && !isW) {
     663            LPCSTR atxt = (LPCSTR)text;
     664            DWORD len = MultiByteToWideChar( CP_ACP, 0, atxt, -1, NULL, 0 );
     665            ntext = COMCTL32_Alloc( (len + 1)*sizeof(WCHAR) );
     666            if (!ntext) return FALSE;
     667            MultiByteToWideChar( CP_ACP, 0, atxt, -1, ntext, len );
     668        } else if (text) {
     669            ntext = COMCTL32_Alloc( (strlenW(text) + 1)*sizeof(WCHAR) );
     670            if (!ntext) return FALSE;
     671            strcpyW (ntext, text);
     672        } else ntext = 0;
     673
    754674        /* check if text is unchanged -> no need to redraw */
    755675        if (text) {
    756             DWORD len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 );
    757             LPWSTR tmptext = COMCTL32_Alloc(len*sizeof(WCHAR));
    758             MultiByteToWideChar( CP_ACP, 0, text, -1, tmptext, len );
    759 
    760             if (!changed && part->text && !lstrcmpW(tmptext,part->text)) {
    761                 COMCTL32_Free(tmptext);
     676            if (!changed && part->text && !lstrcmpW(ntext, part->text)) {
     677                if (!isW) COMCTL32_Free(ntext);
    762678                return TRUE;
    763679            }
    764             ntext = tmptext;
    765680        } else {
    766681            if (!changed && !part->text)
    767682                return TRUE;
    768             ntext = 0;
    769683        }
    770684
     
    773687        part->text = ntext;
    774688    }
    775     InvalidateRect(hwnd, &part->bound, FALSE);
     689    InvalidateRect(infoPtr->Self, &part->bound, FALSE);
    776690
    777691    return TRUE;
     
    780694
    781695static LRESULT
    782 STATUSBAR_SetTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    783 {
    784     STATUSWINDOWPART *part;
    785     INT  nPart, style, len;
    786     LPWSTR text;
    787     BOOL bRedraw = FALSE;
    788 
    789     text = (LPWSTR) lParam;
    790     nPart = ((INT) wParam) & 0x00ff;
    791     style = ((INT) wParam) & 0xff00;
    792 
    793     TRACE("part %d -> '%s' with style %04x\n", nPart, debugstr_w(text), style);
    794     if ((infoPtr->simple) || (infoPtr->parts==NULL) || (nPart==255))
    795         part = &infoPtr->part0;
    796     else
    797 #ifdef __WIN32OS2__
    798     {
    799         if (nPart >= infoPtr->numParts)
    800             return FALSE;
    801         part = &infoPtr->parts[nPart];
    802     }
    803 #else
    804         part = &infoPtr->parts[nPart];
    805 #endif
    806     if (!part) return FALSE;
    807 
    808     if(part->style != style)
    809         bRedraw = TRUE;
    810 
    811     part->style = style;
    812 
    813     /* FIXME: not sure how/if we can check for change in string with ownerdraw(remove this if we can't)... */
    814     if (style & SBT_OWNERDRAW)
    815     {
    816         part->text = text;
    817         bRedraw = TRUE;
    818     } else if(!text)
    819     {
    820         if(part->text)
    821         {
    822             COMCTL32_Free(part->text);
    823             bRedraw = TRUE;
    824         }
    825         part->text = 0;
    826     } else if(!part->text || strcmpW(part->text, text)) /* see if the new string differs from the existing string */
    827     {
    828         if(part->text) COMCTL32_Free(part->text);
    829 
    830         len = strlenW(text);
    831         part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
    832         strcpyW(part->text, text);
    833         bRedraw = TRUE;
    834     }
    835 
    836     if(bRedraw)
    837         InvalidateRect(hwnd, &part->bound, FALSE);
    838 
    839     return TRUE;
    840 }
    841 
    842 
    843 static LRESULT
    844 STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    845 {
    846     TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam);
     696STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR text)
     697{
     698    TRACE("part %d: \"%s\"\n", id, text);
    847699    if (infoPtr->hwndToolTip) {
    848700        TTTOOLINFOA ti;
    849701        ti.cbSize = sizeof(TTTOOLINFOA);
    850         ti.hwnd = hwnd;
    851         ti.uId = (INT)wParam;
     702        ti.hwnd = infoPtr->Self;
     703        ti.uId = id;
    852704        ti.hinst = 0;
    853         ti.lpszText = (LPSTR)lParam;
     705        ti.lpszText = text;
    854706        SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA,
    855707                        0, (LPARAM)&ti);
     
    861713
    862714static LRESULT
    863 STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    864 {
    865     TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam);
     715STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR text)
     716{
     717    TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
    866718    if (infoPtr->hwndToolTip) {
    867719        TTTOOLINFOW ti;
    868720        ti.cbSize = sizeof(TTTOOLINFOW);
    869         ti.hwnd = hwnd;
    870         ti.uId = (INT)wParam;
     721        ti.hwnd = infoPtr->Self;
     722        ti.uId = id;
    871723        ti.hinst = 0;
    872         ti.lpszText = (LPWSTR)lParam;
     724        ti.lpszText = text;
    873725        SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW,
    874726                        0, (LPARAM)&ti);
     
    880732
    881733inline static LRESULT
    882 STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
     734STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, BOOL bUnicode)
    883735{
    884736    BOOL bOld = infoPtr->bUnicode;
    885737
    886     TRACE("(0x%x)\n", (BOOL)wParam);
    887     infoPtr->bUnicode = (BOOL)wParam;
     738    TRACE("(0x%x)\n", bUnicode);
     739    infoPtr->bUnicode = bUnicode;
    888740
    889741    return bOld;
     
    891743
    892744
    893 static LRESULT
    894 STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
     745static BOOL
     746STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple)
    895747{
    896748    NMHDR  nmhdr;
    897749
    898     TRACE("(is simple: %d)\n", wParam);
    899     if (infoPtr->simple == wParam) /* no need to change */
     750    TRACE("(simple=%d)\n", simple);
     751    if (infoPtr->simple == simple) /* no need to change */
    900752        return TRUE;
    901753
    902     infoPtr->simple = (BOOL)wParam;
     754    infoPtr->simple = simple;
    903755
    904756    /* send notification */
    905     nmhdr.hwndFrom = hwnd;
    906     nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
     757    nmhdr.hwndFrom = infoPtr->Self;
     758    nmhdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
    907759    nmhdr.code = SBN_SIMPLEMODECHANGE;
    908     SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
    909     InvalidateRect(hwnd, NULL, FALSE);
     760    SendMessageW (GetParent (infoPtr->Self), WM_NOTIFY, 0, (LPARAM)&nmhdr);
     761    InvalidateRect(infoPtr->Self, NULL, FALSE);
    910762    return TRUE;
    911763}
     
    913765
    914766static LRESULT
    915 STATUSBAR_WMCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
    916 {
    917     LPCREATESTRUCTA lpCreate = (LPCREATESTRUCTA)lParam;
    918     NONCLIENTMETRICSA nclm;
     767STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr)
     768{
     769    int i;
     770
     771    TRACE("\n");
     772    for (i = 0; i < infoPtr->numParts; i++) {
     773        if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))
     774            COMCTL32_Free (infoPtr->parts[i].text);
     775    }
     776    if (infoPtr->part0.text && !(infoPtr->part0.style & SBT_OWNERDRAW))
     777        COMCTL32_Free (infoPtr->part0.text);
     778    COMCTL32_Free (infoPtr->parts);
     779
     780    /* delete default font */
     781    if (infoPtr->hDefaultFont)
     782        DeleteObject (infoPtr->hDefaultFont);
     783
     784    /* delete tool tip control */
     785    if (infoPtr->hwndToolTip)
     786        DestroyWindow (infoPtr->hwndToolTip);
     787
     788    COMCTL32_Free (infoPtr);
     789    SetWindowLongW(infoPtr->Self, 0, 0);
     790    return 0;
     791}
     792
     793
     794static LRESULT
     795STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
     796{
     797    STATUSWINDOWINFO *infoPtr;
     798    NONCLIENTMETRICSW nclm;
    919799    DWORD dwStyle;
    920     RECT        rect;
    921     int         width, len;
     800    RECT rect;
     801    int i, width, len, textHeight = 0;
    922802    HDC hdc;
    923     STATUSWINDOWINFO *infoPtr;
    924803
    925804    TRACE("\n");
    926 #ifdef __WIN32OS2__
    927     infoPtr = (STATUSWINDOWINFO*)initControl(hwnd,sizeof(STATUSWINDOWINFO));
    928 #else
    929805    infoPtr = (STATUSWINDOWINFO*)COMCTL32_Alloc (sizeof(STATUSWINDOWINFO));
    930 #endif
    931     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
    932 
    933     infoPtr->hwndParent = lpCreate->hwndParent;
     806    if (!infoPtr) goto create_fail;
     807    SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
     808
     809    infoPtr->Self = hwnd;
    934810    infoPtr->numParts = 1;
    935811    infoPtr->parts = 0;
     
    938814    infoPtr->hFont = 0;
    939815
    940     /* TODO: send unicode parent notification query (WM_QUERYFORMAT) here */
     816    i = SendMessageW(GetParent (hwnd), WM_NOTIFYFORMAT, hwnd, NF_QUERY);
     817    infoPtr->NtfUnicode = (i == NFR_UNICODE);
    941818
    942819    GetClientRect (hwnd, &rect);
     
    944821    UpdateWindow(hwnd);
    945822
    946     nclm.cbSize = sizeof(NONCLIENTMETRICSA);
    947     SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0);
    948     infoPtr->hDefaultFont = CreateFontIndirectA (&nclm.lfStatusFont);
     823    ZeroMemory (&nclm, sizeof(nclm));
     824    nclm.cbSize = sizeof(nclm);
     825    SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0);
     826    infoPtr->hDefaultFont = CreateFontIndirectW (&nclm.lfStatusFont);
    949827
    950828    /* initialize simple case */
     
    957835    /* initialize first part */
    958836    infoPtr->parts = COMCTL32_Alloc (sizeof(STATUSWINDOWPART));
     837    if (!infoPtr->parts) goto create_fail;
    959838    infoPtr->parts[0].bound = rect;
    960839    infoPtr->parts[0].text = 0;
     
    968847            (len = strlenW ((LPCWSTR)lpCreate->lpszName))) {
    969848            infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     849            if (!infoPtr->parts[0].text) goto create_fail;
    970850            strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
    971851        }
     
    976856            DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 );
    977857            infoPtr->parts[0].text = COMCTL32_Alloc (lenW*sizeof(WCHAR));
     858            if (!infoPtr->parts[0].text) goto create_fail;
    978859            MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1,
    979860                                 infoPtr->parts[0].text, lenW );
     
    981862    }
    982863
    983     dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     864    dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
    984865
    985866#ifndef __WIN32OS2__
    986867    /* statusbars on managed windows should not have SIZEGRIP style */
    987868    if ((dwStyle & SBARS_SIZEGRIP) && lpCreate->hwndParent)
    988         if (GetWindowLongA(lpCreate->hwndParent, GWL_EXSTYLE) & WS_EX_MANAGED)
    989             SetWindowLongA (hwnd, GWL_STYLE, dwStyle & ~SBARS_SIZEGRIP);
     869        if (GetWindowLongW (lpCreate->hwndParent, GWL_EXSTYLE) & WS_EX_MANAGED)
     870            SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~SBARS_SIZEGRIP);
    990871#endif
     872
    991873    if ((hdc = GetDC (0))) {
    992         TEXTMETRICA tm;
     874        TEXTMETRICW tm;
    993875        HFONT hOldFont;
    994876
    995         hOldFont = SelectObject (hdc,infoPtr->hDefaultFont);
    996         GetTextMetricsA(hdc, &tm);
    997         infoPtr->textHeight = tm.tmHeight;
     877        hOldFont = SelectObject (hdc, infoPtr->hDefaultFont);
     878        GetTextMetricsW (hdc, &tm);
     879        textHeight = tm.tmHeight;
    998880        SelectObject (hdc, hOldFont);
    999         ReleaseDC(0, hdc);
    1000     }
     881        ReleaseDC (0, hdc);
     882    }
     883    TRACE("    textHeight=%d\n", textHeight);
    1001884
    1002885    if (dwStyle & SBT_TOOLTIPS) {
    1003886        infoPtr->hwndToolTip =
    1004             CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
     887            CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0,
    1005888                               CW_USEDEFAULT, CW_USEDEFAULT,
    1006889                               CW_USEDEFAULT, CW_USEDEFAULT,
    1007890                             hwnd, 0,
    1008                              GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
     891                             GetWindowLongW (hwnd, GWL_HINSTANCE), NULL);
    1009892
    1010893        if (infoPtr->hwndToolTip) {
     
    1012895
    1013896            nmttc.hdr.hwndFrom = hwnd;
    1014             nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
     897            nmttc.hdr.idFrom = GetWindowLongW (hwnd, GWL_ID);
    1015898            nmttc.hdr.code = NM_TOOLTIPSCREATED;
    1016899            nmttc.hwndToolTips = infoPtr->hwndToolTip;
    1017900
    1018             SendMessageA (lpCreate->hwndParent, WM_NOTIFY,
     901            SendMessageW (lpCreate->hwndParent, WM_NOTIFY,
    1019902                            (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc);
    1020         }
    1021     }
    1022 
    1023     if (!dwStyle & CCS_NORESIZE) /* don't resize wnd if it doesn't want it ! */
    1024     {
     903        }
     904    }
     905
     906    if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */
    1025907        GetClientRect (GetParent (hwnd), &rect);
    1026908        width = rect.right - rect.left;
    1027         infoPtr->height = infoPtr->textHeight + 4 + VERT_BORDER;
     909        infoPtr->height = textHeight + 4 + VERT_BORDER;
    1028910        SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1,
    1029911                        width, infoPtr->height, SWP_NOZORDER);
    1030         STATUSBAR_SetPartBounds (infoPtr, hwnd);
     912        STATUSBAR_SetPartBounds (infoPtr);
    1031913    }
    1032914
    1033915    return 0;
    1034 }
    1035 
    1036 
    1037 static LRESULT
    1038 STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr, HWND hwnd)
    1039 {
    1040     int i;
    1041 
    1042     TRACE("\n");
    1043     for (i = 0; i < infoPtr->numParts; i++) {
    1044         if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))
    1045             COMCTL32_Free (infoPtr->parts[i].text);
    1046     }
    1047     if (infoPtr->part0.text && !(infoPtr->part0.style & SBT_OWNERDRAW))
    1048         COMCTL32_Free (infoPtr->part0.text);
    1049     COMCTL32_Free (infoPtr->parts);
    1050 
    1051     /* delete default font */
    1052     if (infoPtr->hDefaultFont)
    1053         DeleteObject (infoPtr->hDefaultFont);
    1054 
    1055     /* delete tool tip control */
    1056     if (infoPtr->hwndToolTip)
    1057         DestroyWindow (infoPtr->hwndToolTip);
    1058 
    1059     COMCTL32_Free (infoPtr);
    1060     SetWindowLongA(hwnd, 0, 0);
    1061     return 0;
    1062 }
    1063 
    1064 
    1065 static inline LRESULT
    1066 STATUSBAR_WMGetFont (STATUSWINDOWINFO *infoPtr, HWND hwnd)
    1067 {
    1068     TRACE("\n");
    1069     return infoPtr->hFont? infoPtr->hFont : infoPtr->hDefaultFont;
     916   
     917create_fail:
     918    TRACE("    failed!\n");
     919    if (infoPtr) STATUSBAR_WMDestroy(infoPtr);
     920    return -1;
    1070921}
    1071922
     
    1073924/* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
    1074925 * of the first part only (usual behaviour) */
    1075 static LRESULT
    1076 STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
     926static INT
     927STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, INT size, LPWSTR buf)
    1077928{
    1078929    INT len;
     
    1086937        len = WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, NULL, 0, NULL, NULL )-1;
    1087938
    1088     if (wParam > len) {
     939    if (size > len) {
    1089940        if (infoPtr->bUnicode)
    1090             strcpyW ((LPWSTR)lParam, infoPtr->parts[0].text);
     941            strcpyW (buf, infoPtr->parts[0].text);
    1091942        else
    1092943            WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1,
    1093                                  (LPSTR)lParam, len+1, NULL, NULL );
     944                                 (LPSTR)buf, len+1, NULL, NULL );
    1094945        return len;
    1095946    }
     
    1099950
    1100951
    1101 inline static LRESULT
    1102 STATUSBAR_WMMouseMove (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    1103 {
    1104     if (infoPtr->hwndToolTip)
    1105         STATUSBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
    1106                               WM_MOUSEMOVE, wParam, lParam);
    1107     return 0;
    1108 }
    1109 
    1110 
    1111 static LRESULT
    1112 STATUSBAR_WMNCHitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
    1113 {
    1114     if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) {
     952static BOOL
     953STATUSBAR_WMNCHitTest (STATUSWINDOWINFO *infoPtr, INT x, INT y)
     954{
     955    if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
    1115956        RECT  rect;
    1116957        POINT pt;
    1117958
    1118         GetClientRect (hwnd, &rect);
    1119 
    1120         pt.x = (INT)LOWORD(lParam);
    1121         pt.y = (INT)HIWORD(lParam);
    1122         ScreenToClient (hwnd, &pt);
     959        GetClientRect (infoPtr->Self, &rect);
     960
     961        pt.x = x;
     962        pt.y = y;
     963        ScreenToClient (infoPtr->Self, &pt);
    1123964
    1124965        rect.left = rect.right - 13;
     
    1129970    }
    1130971
    1131     /* FIXME: instead check result in StatusWindowProc and call if needed ? */
    1132     return DefWindowProcA (hwnd, WM_NCHITTEST, wParam, lParam);
    1133 }
    1134 
    1135 
    1136 static inline LRESULT
    1137 STATUSBAR_WMNCLButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
    1138 {
     972    return HTERROR;
     973}
     974
     975
     976static LRESULT
     977STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HDC hdc)
     978{
     979    PAINTSTRUCT ps;
     980
    1139981    TRACE("\n");
    1140     PostMessageA (GetParent (hwnd), WM_NCLBUTTONDOWN, wParam, lParam);
     982    if (hdc) return STATUSBAR_Refresh (infoPtr, hdc);
     983    hdc = BeginPaint (infoPtr->Self, &ps);
     984    STATUSBAR_Refresh (infoPtr, hdc);
     985    EndPaint (infoPtr->Self, &ps);
     986
    1141987    return 0;
    1142988}
    1143989
    1144990
    1145 static inline LRESULT
    1146 STATUSBAR_WMNCLButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
    1147 {
    1148     TRACE("\n");
    1149     PostMessageA (GetParent (hwnd), WM_NCLBUTTONUP, wParam, lParam);
     991static LRESULT
     992STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HFONT font, BOOL redraw)
     993{
     994    infoPtr->hFont = font;
     995    TRACE("%04x\n", infoPtr->hFont);
     996    if (redraw)
     997        InvalidateRect(infoPtr->Self, NULL, FALSE);
     998
    1150999    return 0;
    11511000}
    11521001
    11531002
    1154 static LRESULT
    1155 STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
    1156 {
    1157     HDC hdc;
    1158     PAINTSTRUCT ps;
    1159 
    1160     TRACE("\n");
    1161     hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
    1162     STATUSBAR_Refresh (infoPtr, hwnd, hdc);
    1163     if (!wParam)
    1164         EndPaint (hwnd, &ps);
    1165 
    1166     return 0;
    1167 }
    1168 
    1169 
    1170 static LRESULT
    1171 STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    1172 {
    1173     infoPtr->hFont = (HFONT)wParam;
    1174     TRACE("%04x\n", infoPtr->hFont);
    1175 #ifdef __WIN32OS2__
    1176     if (LOWORD(lParam) == TRUE)
    1177     {
    1178       HDC hdc = GetDC (hwnd);
    1179       TEXTMETRICA tm;
    1180       HFONT hOldFont;
    1181 
    1182       hOldFont = SelectObject(hdc,infoPtr->hFont);
    1183       GetTextMetricsA(hdc,&tm);
    1184       infoPtr->textHeight = tm.tmHeight+tm.tmExternalLeading;
    1185       SelectObject(hdc,hOldFont);
    1186 
    1187       //CB: todo: move window
    1188 
    1189       STATUSBAR_Refresh (infoPtr, hwnd, hdc);
    1190       ReleaseDC (hwnd, hdc);
    1191     }
    1192 #else
    1193     if (LOWORD(lParam) == TRUE)
    1194         InvalidateRect(hwnd, NULL, FALSE);
    1195 #endif
    1196 
    1197     return 0;
    1198 }
    1199 
    1200 
    1201 static LRESULT
    1202 STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
     1003static BOOL
     1004STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, LPCSTR text)
    12031005{
    12041006    STATUSWINDOWPART *part;
     
    12151017    part->text = 0;
    12161018    if (infoPtr->bUnicode) {
    1217         if (lParam && (len = strlenW((LPCWSTR)lParam))) {
     1019        if (text && (len = strlenW((LPCWSTR)text))) {
    12181020            part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
    1219             strcpyW (part->text, (LPCWSTR)lParam);
     1021            if (!part->text) return FALSE;
     1022            strcpyW (part->text, (LPCWSTR)text);
    12201023        }
    12211024    }
    12221025    else {
    1223         if (lParam && (len = lstrlenA((LPCSTR)lParam))) {
    1224             DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, NULL, 0 );
     1026        if (text && (len = lstrlenA(text))) {
     1027            DWORD lenW = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 );
    12251028            part->text = COMCTL32_Alloc (lenW*sizeof(WCHAR));
    1226             MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, part->text, lenW );
     1029            if (!part->text) return FALSE;
     1030            MultiByteToWideChar( CP_ACP, 0, text, -1, part->text, lenW );
    12271031        }
    12281032    }
    12291033
    1230     InvalidateRect(hwnd, &part->bound, FALSE);
     1034    InvalidateRect(infoPtr->Self, &part->bound, FALSE);
    12311035
    12321036    return TRUE;
     
    12341038
    12351039
    1236 static LRESULT
    1237 STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
    1238 {
    1239     INT  width, x, y, flags;
     1040static BOOL
     1041STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
     1042{
     1043    INT  width, x, y;
    12401044    RECT parent_rect;
    1241     DWORD dwStyle;
    12421045
    12431046    /* Need to resize width to match parent */
    1244     flags = (INT) wParam;
    1245 
    12461047    TRACE("flags %04x\n", flags);
    1247     /* FIXME for flags =
    1248      * SIZE_MAXIMIZED, SIZE_MAXSHOW, SIZE_MINIMIZED, SIZE_RESTORED
    1249      */
    1250 
    1251     dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
    1252     if (!dwStyle & CCS_NORESIZE) /* don't resize wnd if it doesn't want it ! */
    1253     {
    1254         if (flags == SIZE_RESTORED) {
    1255             /* width and height don't apply */
    1256             GetClientRect (infoPtr->hwndParent, &parent_rect);
    1257             width = parent_rect.right - parent_rect.left;
    1258             x = parent_rect.left;
    1259             y = parent_rect.bottom - infoPtr->height;
    1260             MoveWindow (hwnd, parent_rect.left,
    1261                       parent_rect.bottom - infoPtr->height,
    1262                       width, infoPtr->height, TRUE);
    1263             STATUSBAR_SetPartBounds (infoPtr, hwnd);
    1264         }
    1265         return 0; /* FIXME: ok to return here ? */
    1266     }
    1267 
    1268     /* FIXME: instead check result in StatusWindowProc and call if needed ? */
    1269     return DefWindowProcA (hwnd, WM_SIZE, wParam, lParam);
     1048
     1049    if (flags != SIZE_RESTORED) {
     1050        WARN("flags MUST be SIZE_RESTORED\n");
     1051        return FALSE;
     1052    }
     1053    if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE;
     1054   
     1055    /* width and height don't apply */
     1056    GetClientRect (GetParent(infoPtr->Self), &parent_rect);
     1057    width = parent_rect.right - parent_rect.left;
     1058    x = parent_rect.left;
     1059    y = parent_rect.bottom - infoPtr->height;
     1060    MoveWindow (infoPtr->Self, parent_rect.left,
     1061                parent_rect.bottom - infoPtr->height,
     1062                width, infoPtr->height, TRUE);
     1063    STATUSBAR_SetPartBounds (infoPtr);
     1064    return TRUE;
     1065}
     1066
     1067
     1068static LRESULT
     1069STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd)
     1070{
     1071    if (cmd == NF_REQUERY) {
     1072        INT i = SendMessageW(from, WM_NOTIFYFORMAT, infoPtr->Self, NF_QUERY);
     1073        infoPtr->NtfUnicode = (i == NFR_UNICODE);
     1074    }
     1075    return infoPtr->NtfUnicode ? NFR_UNICODE : NFR_ANSI;
    12701076}
    12711077
     
    12781084    TRACE("code %04x\n", code);
    12791085    nmhdr.hwndFrom = hwnd;
    1280     nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
     1086    nmhdr.idFrom = GetWindowLongW (hwnd, GWL_ID);
    12811087    nmhdr.code = code;
    1282     SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
     1088    SendMessageW (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
    12831089    return 0;
    12841090}
     
    12901096{
    12911097    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
     1098    INT nPart = ((INT) wParam) & 0x00ff;
     1099    LRESULT res;
    12921100
    12931101    TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hwnd, msg, wParam, lParam);
    1294     if (!(infoPtr) && (msg != WM_CREATE))
    1295         return DefWindowProcA (hwnd, msg, wParam, lParam);
     1102    if (!infoPtr && msg != WM_CREATE)
     1103        return DefWindowProcW (hwnd, msg, wParam, lParam);
    12961104
    12971105    switch (msg) {
    12981106        case SB_GETBORDERS:
    1299             return STATUSBAR_GetBorders (lParam);
     1107            return STATUSBAR_GetBorders ((INT *)lParam);
    13001108
    13011109        case SB_GETICON:
    1302             return STATUSBAR_GetIcon (infoPtr, hwnd, wParam);
     1110            return STATUSBAR_GetIcon (infoPtr, nPart);
    13031111
    13041112        case SB_GETPARTS:
    1305             return STATUSBAR_GetParts (infoPtr, hwnd, wParam, lParam);
     1113            return STATUSBAR_GetParts (infoPtr, (INT)wParam, (INT *)lParam);
    13061114
    13071115        case SB_GETRECT:
    1308             return STATUSBAR_GetRect (infoPtr, hwnd, wParam, lParam);
     1116            return STATUSBAR_GetRect (infoPtr, nPart, (LPRECT)lParam);
    13091117
    13101118        case SB_GETTEXTA:
    1311             return STATUSBAR_GetTextA (infoPtr, hwnd, wParam, lParam);
     1119            return STATUSBAR_GetTextA (infoPtr, nPart, (LPSTR)lParam);
    13121120
    13131121        case SB_GETTEXTW:
    1314             return STATUSBAR_GetTextW (infoPtr, hwnd, wParam, lParam);
     1122            return STATUSBAR_GetTextW (infoPtr, nPart, (LPWSTR)lParam);
    13151123
    13161124        case SB_GETTEXTLENGTHA:
    13171125        case SB_GETTEXTLENGTHW:
    1318             return STATUSBAR_GetTextLength (infoPtr, hwnd, wParam);
     1126            return STATUSBAR_GetTextLength (infoPtr, nPart);
    13191127
    13201128        case SB_GETTIPTEXTA:
    1321             return STATUSBAR_GetTipTextA (infoPtr, hwnd, wParam, lParam);
     1129            return STATUSBAR_GetTipTextA (infoPtr,  LOWORD(wParam), (LPSTR)lParam,  HIWORD(wParam));
    13221130
    13231131        case SB_GETTIPTEXTW:
    1324             return STATUSBAR_GetTipTextW (infoPtr, hwnd, wParam, lParam);
     1132            return STATUSBAR_GetTipTextW (infoPtr,  LOWORD(wParam), (LPWSTR)lParam,  HIWORD(wParam));
    13251133
    13261134        case SB_GETUNICODEFORMAT:
    1327             return STATUSBAR_GetUnicodeFormat (infoPtr, hwnd);
     1135            return infoPtr->bUnicode;
    13281136
    13291137        case SB_ISSIMPLE:
    1330             return STATUSBAR_IsSimple (infoPtr, hwnd);
     1138            return infoPtr->simple;
    13311139
    13321140        case SB_SETBKCOLOR:
    1333             return STATUSBAR_SetBkColor (infoPtr, hwnd, wParam, lParam);
     1141            return STATUSBAR_SetBkColor (infoPtr, (COLORREF)lParam);
    13341142
    13351143        case SB_SETICON:
    1336             return STATUSBAR_SetIcon (infoPtr, hwnd, wParam, lParam);
     1144            return STATUSBAR_SetIcon (infoPtr, nPart, (HICON)lParam);
    13371145
    13381146        case SB_SETMINHEIGHT:
    1339             return STATUSBAR_SetMinHeight (infoPtr, hwnd, wParam, lParam);
     1147            return STATUSBAR_SetMinHeight (infoPtr, (INT)wParam);
    13401148
    13411149        case SB_SETPARTS:       
    1342             return STATUSBAR_SetParts (infoPtr, hwnd, wParam, lParam);
     1150            return STATUSBAR_SetParts (infoPtr, (INT)wParam, (LPINT)lParam);
    13431151
    13441152        case SB_SETTEXTA:
    1345             return STATUSBAR_SetTextA (infoPtr, hwnd, wParam, lParam);
     1153            return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPCWSTR)lParam, FALSE);
    13461154
    13471155        case SB_SETTEXTW:
    1348             return STATUSBAR_SetTextW (infoPtr, hwnd, wParam, lParam);
     1156            return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPCWSTR)lParam, TRUE);
    13491157
    13501158        case SB_SETTIPTEXTA:
    1351             return STATUSBAR_SetTipTextA (infoPtr, hwnd, wParam, lParam);
     1159            return STATUSBAR_SetTipTextA (infoPtr, (INT)wParam, (LPSTR)lParam);
    13521160
    13531161        case SB_SETTIPTEXTW:
    1354             return STATUSBAR_SetTipTextW (infoPtr, hwnd, wParam, lParam);
     1162            return STATUSBAR_SetTipTextW (infoPtr, (INT)wParam, (LPWSTR)lParam);
    13551163
    13561164        case SB_SETUNICODEFORMAT:
    1357             return STATUSBAR_SetUnicodeFormat (infoPtr, hwnd, wParam);
     1165            return STATUSBAR_SetUnicodeFormat (infoPtr, (BOOL)wParam);
    13581166
    13591167        case SB_SIMPLE:
    1360             return STATUSBAR_Simple (infoPtr, hwnd, wParam, lParam);
    1361 
     1168            return STATUSBAR_Simple (infoPtr, (BOOL)wParam);
    13621169
    13631170        case WM_CREATE:
    1364             return STATUSBAR_WMCreate (hwnd, wParam, lParam);
     1171            return STATUSBAR_WMCreate (hwnd, (LPCREATESTRUCTA)lParam);
    13651172
    13661173        case WM_DESTROY:
    1367             return STATUSBAR_WMDestroy (infoPtr, hwnd);
     1174            return STATUSBAR_WMDestroy (infoPtr);
    13681175
    13691176        case WM_GETFONT:
    1370             return STATUSBAR_WMGetFont (infoPtr, hwnd);
     1177            return infoPtr->hFont? infoPtr->hFont : infoPtr->hDefaultFont;
    13711178
    13721179        case WM_GETTEXT:
    1373             return STATUSBAR_WMGetText (infoPtr, hwnd, wParam, lParam);
     1180            return STATUSBAR_WMGetText (infoPtr, (INT)wParam, (LPWSTR)lParam);
    13741181
    13751182        case WM_GETTEXTLENGTH:
    1376             return STATUSBAR_GetTextLength (infoPtr, hwnd, 0);
     1183            return STATUSBAR_GetTextLength (infoPtr, 0);
    13771184
    13781185        case WM_LBUTTONDBLCLK:
     
    13831190
    13841191        case WM_MOUSEMOVE:
    1385             return STATUSBAR_WMMouseMove (infoPtr, hwnd, wParam, lParam);
     1192            return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
    13861193
    13871194        case WM_NCHITTEST:
    1388             return STATUSBAR_WMNCHitTest (hwnd, wParam, lParam);
    1389 
     1195            res = STATUSBAR_WMNCHitTest(infoPtr, (INT)LOWORD(lParam),
     1196                                        (INT)HIWORD(lParam));
     1197            if (res != HTERROR) return res;
     1198            return DefWindowProcW (hwnd, msg, wParam, lParam);
     1199
     1200        case WM_NCLBUTTONUP:
    13901201        case WM_NCLBUTTONDOWN:
    1391             return STATUSBAR_WMNCLButtonDown (hwnd, wParam, lParam);
    1392 
    1393         case WM_NCLBUTTONUP:
    1394             return STATUSBAR_WMNCLButtonUp (hwnd, wParam, lParam);
    1395 
     1202            PostMessageW (GetParent (hwnd), msg, wParam, lParam);
     1203            return 0;
     1204
     1205        case WM_NOTIFYFORMAT:
     1206            return STATUSBAR_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam);
     1207           
    13961208        case WM_PAINT:
    1397             return STATUSBAR_WMPaint (infoPtr, hwnd, wParam);
     1209            return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
    13981210
    13991211        case WM_RBUTTONDBLCLK:
     
    14041216
    14051217        case WM_SETFONT:
    1406             return STATUSBAR_WMSetFont (infoPtr, hwnd, wParam, lParam);
     1218            return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
    14071219
    14081220        case WM_SETTEXT:
    1409             return STATUSBAR_WMSetText (infoPtr, hwnd, wParam, lParam);
     1221            return STATUSBAR_WMSetText (infoPtr, (LPCSTR)lParam);
    14101222
    14111223        case WM_SIZE:
    1412             return STATUSBAR_WMSize (infoPtr, hwnd, wParam, lParam);
     1224            if (STATUSBAR_WMSize (infoPtr, (WORD)wParam)) return 0;
     1225            return DefWindowProcW (hwnd, msg, wParam, lParam);
    14131226
    14141227        default:
     
    14161229                ERR("unknown msg %04x wp=%04x lp=%08lx\n",
    14171230                     msg, wParam, lParam);
    1418 #ifdef __WIN32OS2__
    1419             return defComCtl32ProcA (hwnd, msg, wParam, lParam);
    1420 #else
    1421             return DefWindowProcA (hwnd, msg, wParam, lParam);
    1422 #endif
     1231            return DefWindowProcW (hwnd, msg, wParam, lParam);
    14231232    }
    14241233    return 0;
     
    14321241 */
    14331242
    1434 VOID
     1243void
    14351244STATUS_Register (void)
    14361245{
    1437     WNDCLASSA wndClass;
    1438 
    1439     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
     1246    WNDCLASSW wndClass;
     1247
     1248    ZeroMemory (&wndClass, sizeof(WNDCLASSW));
    14401249    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
    14411250    wndClass.lpfnWndProc   = (WNDPROC)StatusWindowProc;
    14421251    wndClass.cbClsExtra    = 0;
    14431252    wndClass.cbWndExtra    = sizeof(STATUSWINDOWINFO *);
    1444     wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
     1253    wndClass.hCursor       = LoadCursorW (0, IDC_ARROWW);
    14451254    wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
    1446     wndClass.lpszClassName = STATUSCLASSNAMEA;
     1255    wndClass.lpszClassName = STATUSCLASSNAMEW;
    14471256 
    1448     RegisterClassA (&wndClass);
     1257    RegisterClassW (&wndClass);
    14491258}
    14501259
     
    14561265 */
    14571266
    1458 VOID
     1267void
    14591268STATUS_Unregister (void)
    14601269{
    1461     UnregisterClassA (STATUSCLASSNAMEA, (HINSTANCE)NULL);
    1462 }
    1463 
     1270    UnregisterClassW (STATUSCLASSNAMEW, (HINSTANCE)NULL);
     1271}
     1272
Note: See TracChangeset for help on using the changeset viewer.