Changeset 19075
- Timestamp:
- May 29, 2002, 6:05:40 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tags/trunk/src/comctl32/status.c ¶
r18084 r19075 4 4 * Copyright 1996 Bruce Milner 5 5 * Copyright 1998, 1999 Eric Kohl 6 * Copyright 2002 Dimitrie O. Paun 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * 22 * FIXME: 23 * 1) Implement all CCS_* styles. 24 * 2) Should we hide grip if the parent window is maximized? 6 25 */ 7 /*8 * FIXME/TODO9 * 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_QUERYFORMAT13 */14 26 15 27 #include <string.h> 28 16 29 #include "winbase.h" 17 30 #include "wine/unicode.h" 18 31 #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 34 WINE_DEFAULT_DEBUG_CHANNEL(statusbar); 25 35 26 36 typedef struct 27 37 { 28 INT x;29 INT style;38 INT x; 39 INT style; 30 40 RECT bound; 31 41 LPWSTR text; 32 HICON hIcon;42 HICON hIcon; 33 43 } STATUSWINDOWPART; 34 44 35 45 typedef struct 36 46 { 37 #ifdef __WIN32OS2__ 38 COMCTL32_HEADER header; 39 #endif 40 HWND hwndParent; 47 HWND Self; 41 48 WORD numParts; 42 WORD textHeight;43 49 UINT height; 44 50 BOOL simple; … … 46 52 HFONT hFont; 47 53 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; 52 59 } STATUSWINDOWINFO; 53 60 … … 58 65 */ 59 66 60 61 #define _MAX(a,b) (((a)>(b))?(a):(b))62 #define _MIN(a,b) (((a)>(b))?(b):(a))63 64 67 #define HORZ_BORDER 0 65 68 #define VERT_BORDER 2 66 69 #define HORZ_GAP 2 67 70 68 #define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLong A(hwnd, 0))71 #define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongW (hwnd, 0)) 69 72 70 73 /* prototype */ 71 74 static void 72 STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr, HWND hwnd); 75 STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr); 76 77 static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW) 78 { 79 return isW ? debugstr_w(text) : debugstr_a((LPCSTR)text); 80 } 73 81 74 82 static void 75 83 STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect) 76 84 { 77 HPEN h OldPen;85 HPEN hPenFace, hPenShadow, hPenHighlight, hOldPen; 78 86 POINT pt; 79 87 INT i; 80 88 81 89 TRACE("draw size grip %d,%d - %d,%d\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); 90 82 91 pt.x = lpRect->right - 1; 83 92 pt.y = lpRect->bottom - 1; 84 93 85 hOldPen = SelectObject (hdc, GetSysColorPen (COLOR_3DFACE)); 94 hPenFace = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DFACE )); 95 hOldPen = SelectObject( hdc, hPenFace ); 86 96 MoveToEx (hdc, pt.x - 12, pt.y, NULL); 87 97 LineTo (hdc, pt.x, pt.y); 88 LineTo (hdc, pt.x, pt.y - 1 2);98 LineTo (hdc, pt.x, pt.y - 13); 89 99 90 100 pt.x--; 91 101 pt.y--; 92 102 93 SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW)); 103 hPenShadow = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_3DSHADOW )); 104 SelectObject( hdc, hPenShadow ); 94 105 for (i = 1; i < 11; i += 4) { 95 106 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 ); 103 115 for (i = 3; i < 13; i += 4) { 104 116 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); 106 118 } 107 119 108 120 SelectObject (hdc, hOldPen); 121 DeleteObject( hPenFace ); 122 DeleteObject( hPenShadow ); 123 DeleteObject( hPenHighlight ); 109 124 } 110 125 111 126 112 127 static void 113 STATUSBAR_DrawPart (HDC hdc, STATUSWINDOWPART *part)128 STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINFO *infoPtr, int itemID) 114 129 { 115 130 RECT r = part->bound; … … 118 133 TRACE("part bound %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom); 119 134 if (part->style & SBT_POPOUT) 120 border = BDR_RAISEDOUTER;135 border = BDR_RAISEDOUTER; 121 136 else if (part->style & SBT_NOBORDERS) 122 border = 0;137 border = 0; 123 138 124 139 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 169 static void 170 STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *part, HDC hdc, int itemID) 160 171 { 161 172 HBRUSH hbrBk; … … 163 174 164 175 TRACE("item %d\n", itemID); 165 if (!IsWindowVisible ( hwnd))176 if (!IsWindowVisible (infoPtr->Self)) 166 177 return; 167 178 … … 169 180 170 181 if (infoPtr->clrBk != CLR_DEFAULT) 171 hbrBk = CreateSolidBrush (infoPtr->clrBk);182 hbrBk = CreateSolidBrush (infoPtr->clrBk); 172 183 else 173 hbrBk = GetSysColorBrush (COLOR_3DFACE);184 hbrBk = GetSysColorBrush (COLOR_3DFACE); 174 185 FillRect(hdc, &part->bound, hbrBk); 175 186 176 187 hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont); 177 188 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); 191 190 192 191 SelectObject (hdc, hOldFont); 193 192 194 193 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 206 static LRESULT 207 STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc) 208 208 { 209 209 int i; … … 213 213 214 214 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); 221 221 222 222 if (infoPtr->clrBk != CLR_DEFAULT) 223 hbrBk = CreateSolidBrush (infoPtr->clrBk);223 hbrBk = CreateSolidBrush (infoPtr->clrBk); 224 224 else 225 hbrBk = GetSysColorBrush (COLOR_3DFACE);225 hbrBk = GetSysColorBrush (COLOR_3DFACE); 226 226 FillRect(hdc, &rect, hbrBk); 227 227 … … 229 229 230 230 if (infoPtr->simple) { 231 STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->part0, hdc, 0);231 STATUSBAR_RefreshPart (infoPtr, &infoPtr->part0, hdc, 0); 232 232 } 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 } 248 236 } 249 237 … … 251 239 252 240 if (infoPtr->clrBk != CLR_DEFAULT) 253 DeleteObject (hbrBk);254 255 if (GetWindowLong A(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; 259 247 } 260 248 261 249 262 250 static void 263 STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr , HWND hwnd)251 STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr) 264 252 { 265 253 STATUSWINDOWPART *part; … … 268 256 269 257 /* get our window size */ 270 GetClientRect ( hwnd, &rect);258 GetClientRect (infoPtr->Self, &rect); 271 259 TRACE("client wnd size is %d,%d - %d,%d\n", rect.left, rect.top, rect.right, rect.bottom); 272 260 … … 292 280 293 281 if (infoPtr->hwndToolTip) { 294 TTTOOLINFO Ati;295 296 ti.cbSize = sizeof(TTTOOLINFO A);297 ti.hwnd = hwnd;282 TTTOOLINFOW ti; 283 284 ti.cbSize = sizeof(TTTOOLINFOW); 285 ti.hwnd = infoPtr->Self; 298 286 ti.uId = i; 299 287 ti.rect = *r; 300 SendMessage A (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA,288 SendMessageW (infoPtr->hwndToolTip, TTM_NEWTOOLRECTW, 301 289 0, (LPARAM)&ti); 302 290 } … … 305 293 306 294 307 static VOID308 STATUSBAR_Relay Event (HWND hwndTip, HWND hwndMsg, UINT uMsg,309 295 static LRESULT 296 STATUSBAR_Relay2Tip (STATUSWINDOWINFO *infoPtr, UINT uMsg, 297 WPARAM wParam, LPARAM lParam) 310 298 { 311 299 MSG msg; 312 300 313 msg.hwnd = hwndMsg;301 msg.hwnd = infoPtr->Self; 314 302 msg.message = uMsg; 315 303 msg.wParam = wParam; … … 319 307 msg.pt.y = HIWORD(GetMessagePos ()); 320 308 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 313 static BOOL 314 STATUSBAR_GetBorders (INT out[]) 315 { 330 316 TRACE("\n"); 331 317 out[0] = HORZ_BORDER; /* horizontal border width */ … … 337 323 338 324 339 static LRESULT 340 STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam) 341 { 342 INT nPart; 343 344 nPart = (INT)wParam & 0x00ff; 325 static HICON 326 STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart) 327 { 345 328 TRACE("%d\n", nPart); 329 /* MSDN says: "simple parts are indexed with -1" */ 346 330 if ((nPart < -1) || (nPart >= infoPtr->numParts)) 347 331 return 0; … … 354 338 355 339 356 static LRESULT 357 STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam) 358 { 359 LPINT parts; 360 INT num_parts; 340 static INT 341 STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, INT num_parts, INT parts[]) 342 { 361 343 INT i; 362 344 363 num_parts = (INT) wParam;364 345 TRACE("(%d)\n", num_parts); 365 parts = (LPINT) lParam;366 346 if (parts) { 367 347 for (i = 0; i < num_parts; i++) { … … 369 349 } 370 350 } 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 355 static BOOL 356 STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, INT nPart, LPRECT rect) 357 { 382 358 TRACE("part %d\n", nPart); 383 rect = (LPRECT) lParam;384 359 if (infoPtr->simple) 385 360 *rect = infoPtr->part0.bound; … … 391 366 392 367 static LRESULT 393 STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)368 STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf) 394 369 { 395 370 STATUSWINDOWPART *part; 396 INT nPart;397 371 LRESULT result; 398 372 399 nPart = ((INT) wParam) & 0x00ff;400 373 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 401 378 if (infoPtr->simple) 402 379 part = &infoPtr->part0; 403 380 else 404 #ifdef __WIN32OS2__405 {406 if (nPart >= infoPtr->numParts)407 return FALSE;408 381 part = &infoPtr->parts[nPart]; 409 }410 #else411 part = &infoPtr->parts[nPart];412 #endif413 382 414 383 if (part->style & SBT_OWNERDRAW) … … 418 387 NULL, 0, NULL, NULL ) - 1 : 0; 419 388 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 ); 422 391 } 423 392 return result; … … 426 395 427 396 static LRESULT 428 STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)397 STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, INT nPart, LPWSTR buf) 429 398 { 430 399 STATUSWINDOWPART *part; 431 INT nPart;432 400 LRESULT result; 433 401 434 nPart = ((INT)wParam) & 0x00ff;435 402 TRACE("part %d\n", nPart); 403 if (nPart < 0 || nPart >= infoPtr->numParts) return 0; 404 436 405 if (infoPtr->simple) 437 406 part = &infoPtr->part0; 438 407 else 439 #ifdef __WIN32OS2__440 {441 if (nPart >= infoPtr->numParts)442 return FALSE;443 408 part = &infoPtr->parts[nPart]; 444 }445 #else446 part = &infoPtr->parts[nPart];447 #endif448 409 449 410 if (part->style & SBT_OWNERDRAW) … … 452 413 result = part->text ? strlenW (part->text) : 0; 453 414 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); 456 417 } 457 418 return result; … … 460 421 461 422 static LRESULT 462 STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)423 STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, INT nPart) 463 424 { 464 425 STATUSWINDOWPART *part; 465 INT nPart;466 426 DWORD result; 467 427 468 nPart = ((INT) wParam) & 0x00ff;469 470 428 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; 471 432 472 433 if (infoPtr->simple) 473 434 part = &infoPtr->part0; 474 435 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]; 490 437 491 438 if (part->text) … … 498 445 } 499 446 500 501 static LRESULT 502 STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam) 503 { 504 LPSTR tip = (LPSTR)lParam; 505 447 static LRESULT 448 STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR tip, INT size) 449 { 450 TRACE("\n"); 506 451 if (tip) { 507 452 CHAR buf[INFOTIPSIZE]; … … 511 456 TTTOOLINFOA ti; 512 457 ti.cbSize = sizeof(TTTOOLINFOA); 513 ti.hwnd = hwnd;514 ti.uId = LOWORD(wParam);458 ti.hwnd = infoPtr->Self; 459 ti.uId = id; 515 460 ti.lpszText = buf; 516 SendMessageA (infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti);461 SendMessageA (infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti); 517 462 } 518 lstrcpynA (tip, buf, HIWORD(wParam));463 lstrcpynA (tip, buf, size); 519 464 } 520 465 return 0; … … 523 468 524 469 static LRESULT 525 STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam) 526 { 527 LPWSTR tip = (LPWSTR)lParam; 528 470 STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR tip, INT size) 471 { 529 472 TRACE("\n"); 530 473 if (tip) { … … 535 478 TTTOOLINFOW ti; 536 479 ti.cbSize = sizeof(TTTOOLINFOW); 537 ti.hwnd = hwnd;538 ti.uId = LOWORD(wParam);480 ti.hwnd = infoPtr->Self; 481 ti.uId = id; 539 482 ti.lpszText = buf; 540 483 SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti); 541 484 } 542 lstrcpynW(tip, buf, HIWORD(wParam));485 lstrcpynW(tip, buf, size); 543 486 } 544 487 … … 547 490 548 491 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) 492 static COLORREF 493 STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, COLORREF color) 565 494 { 566 495 COLORREF oldBkColor; 567 496 568 497 oldBkColor = infoPtr->clrBk; 569 infoPtr->clrBk = (COLORREF)lParam;570 InvalidateRect( hwnd, NULL, FALSE);498 infoPtr->clrBk = color; 499 InvalidateRect(infoPtr->Self, NULL, FALSE); 571 500 572 501 TRACE("CREF: %08lx -> %08lx\n", oldBkColor, infoPtr->clrBk); … … 575 504 576 505 577 static LRESULT 578 STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam) 579 { 580 INT nPart = (INT)wParam & 0x00ff; 581 506 static BOOL 507 STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon) 508 { 582 509 if ((nPart < -1) || (nPart >= infoPtr->numParts)) 583 510 return FALSE; 584 511 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" */ 587 515 if (nPart == -1) { 588 if (infoPtr->part0.hIcon == (HICON)lParam) /* same as - no redraw */516 if (infoPtr->part0.hIcon == hIcon) /* same as - no redraw */ 589 517 return TRUE; 590 infoPtr->part0.hIcon = (HICON)lParam;518 infoPtr->part0.hIcon = hIcon; 591 519 if (infoPtr->simple) 592 InvalidateRect( hwnd, &infoPtr->part0.bound, FALSE);520 InvalidateRect(infoPtr->Self, &infoPtr->part0.bound, FALSE); 593 521 } else { 594 if (infoPtr->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */522 if (infoPtr->parts[nPart].hIcon == hIcon) /* same as - no redraw */ 595 523 return TRUE; 596 524 597 infoPtr->parts[nPart].hIcon = (HICON)lParam;525 infoPtr->parts[nPart].hIcon = hIcon; 598 526 if (!(infoPtr->simple)) 599 InvalidateRect( hwnd, &infoPtr->parts[nPart].bound, FALSE);527 InvalidateRect(infoPtr->Self, &infoPtr->parts[nPart].bound, FALSE); 600 528 } 601 529 return TRUE; … … 603 531 604 532 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); 533 static BOOL 534 STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height) 535 { 536 537 TRACE("(height=%d)\n", height); 538 if (IsWindowVisible (infoPtr->Self)) { 612 539 INT width, x, y; 613 540 RECT parent_rect; 614 541 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; 617 544 width = parent_rect.right - parent_rect.left; 618 545 x = parent_rect.left; 619 546 y = parent_rect.bottom - infoPtr->height; 620 MoveWindow ( hwnd, parent_rect.left,547 MoveWindow (infoPtr->Self, parent_rect.left, 621 548 parent_rect.bottom - infoPtr->height, 622 549 width, infoPtr->height, TRUE); 623 STATUSBAR_SetPartBounds (infoPtr , hwnd);550 STATUSBAR_SetPartBounds (infoPtr); 624 551 } 625 552 … … 628 555 629 556 630 static LRESULT631 STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)557 static BOOL 558 STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts) 632 559 { 633 560 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); 643 564 644 565 oldNumParts = infoPtr->numParts; 645 infoPtr->numParts = (INT) wParam; 646 parts = (LPINT) lParam; 566 infoPtr->numParts = count; 647 567 if (oldNumParts > infoPtr->numParts) { 648 568 for (i = infoPtr->numParts ; i < oldNumParts; i++) { … … 650 570 COMCTL32_Free (infoPtr->parts[i].text); 651 571 } 652 } 653 if (oldNumParts < infoPtr->numParts) { 572 } else if (oldNumParts < infoPtr->numParts) { 654 573 tmp = COMCTL32_Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts); 574 if (!tmp) return FALSE; 655 575 for (i = 0; i < oldNumParts; i++) { 656 576 tmp[i] = infoPtr->parts[i]; … … 661 581 } 662 582 if (oldNumParts == infoPtr->numParts) { 663 for (i=0; i<oldNumParts;i++)583 for (i=0; i < oldNumParts; i++) 664 584 if (infoPtr->parts[i].x != parts[i]) 665 585 break; … … 672 592 673 593 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); 677 602 if (nTipCount < infoPtr->numParts) { 678 603 /* add tools */ 679 TTTOOLINFOA ti;680 INT i;681 682 ZeroMemory (&ti, sizeof(TTTOOLINFOA));683 ti.cbSize = sizeof(TTTOOLINFOA);684 ti.hwnd = hwnd;685 604 for (i = nTipCount; i < infoPtr->numParts; i++) { 686 605 TRACE("add tool %d\n", i); 687 606 ti.uId = i; 688 SendMessage A (infoPtr->hwndToolTip, TTM_ADDTOOLA,607 SendMessageW (infoPtr->hwndToolTip, TTM_ADDTOOLW, 689 608 0, (LPARAM)&ti); 690 609 } … … 692 611 else if (nTipCount > infoPtr->numParts) { 693 612 /* delete tools */ 694 INT i;695 696 613 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); 698 618 } 699 619 } 700 620 } 701 STATUSBAR_SetPartBounds (infoPtr , hwnd);702 InvalidateRect( hwnd, NULL, FALSE);621 STATUSBAR_SetPartBounds (infoPtr); 622 InvalidateRect(infoPtr->Self, NULL, FALSE); 703 623 return TRUE; 704 624 } 705 625 706 626 707 static LRESULT 708 STATUSBAR_SetTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam) 627 static BOOL 628 STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style, 629 LPCWSTR text, BOOL isW) 709 630 { 710 631 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 721 634 if (style & SBT_OWNERDRAW) { 722 635 TRACE("part %d, text %x\n",nPart,text); 723 636 } 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) { 730 643 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 } 741 649 if (!part) return FALSE; 742 650 … … 746 654 part->style = style; 747 655 if (style & SBT_OWNERDRAW) { 748 if (part->text == (LPWSTR)text)656 if (part->text == text) 749 657 return TRUE; 750 658 part->text = (LPWSTR)text; … … 752 660 LPWSTR ntext; 753 661 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 754 674 /* check if text is unchanged -> no need to redraw */ 755 675 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); 762 678 return TRUE; 763 679 } 764 ntext = tmptext;765 680 } else { 766 681 if (!changed && !part->text) 767 682 return TRUE; 768 ntext = 0;769 683 } 770 684 … … 773 687 part->text = ntext; 774 688 } 775 InvalidateRect( hwnd, &part->bound, FALSE);689 InvalidateRect(infoPtr->Self, &part->bound, FALSE); 776 690 777 691 return TRUE; … … 780 694 781 695 static 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); 696 STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR text) 697 { 698 TRACE("part %d: \"%s\"\n", id, text); 847 699 if (infoPtr->hwndToolTip) { 848 700 TTTOOLINFOA ti; 849 701 ti.cbSize = sizeof(TTTOOLINFOA); 850 ti.hwnd = hwnd;851 ti.uId = (INT)wParam;702 ti.hwnd = infoPtr->Self; 703 ti.uId = id; 852 704 ti.hinst = 0; 853 ti.lpszText = (LPSTR)lParam;705 ti.lpszText = text; 854 706 SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, 855 707 0, (LPARAM)&ti); … … 861 713 862 714 static LRESULT 863 STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)864 { 865 TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam);715 STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR text) 716 { 717 TRACE("part %d: \"%s\"\n", id, debugstr_w(text)); 866 718 if (infoPtr->hwndToolTip) { 867 719 TTTOOLINFOW ti; 868 720 ti.cbSize = sizeof(TTTOOLINFOW); 869 ti.hwnd = hwnd;870 ti.uId = (INT)wParam;721 ti.hwnd = infoPtr->Self; 722 ti.uId = id; 871 723 ti.hinst = 0; 872 ti.lpszText = (LPWSTR)lParam;724 ti.lpszText = text; 873 725 SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 874 726 0, (LPARAM)&ti); … … 880 732 881 733 inline static LRESULT 882 STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)734 STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, BOOL bUnicode) 883 735 { 884 736 BOOL bOld = infoPtr->bUnicode; 885 737 886 TRACE("(0x%x)\n", (BOOL)wParam);887 infoPtr->bUnicode = (BOOL)wParam;738 TRACE("(0x%x)\n", bUnicode); 739 infoPtr->bUnicode = bUnicode; 888 740 889 741 return bOld; … … 891 743 892 744 893 static LRESULT894 STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)745 static BOOL 746 STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple) 895 747 { 896 748 NMHDR nmhdr; 897 749 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 */ 900 752 return TRUE; 901 753 902 infoPtr->simple = (BOOL)wParam;754 infoPtr->simple = simple; 903 755 904 756 /* send notification */ 905 nmhdr.hwndFrom = hwnd;906 nmhdr.idFrom = GetWindowLong A (hwnd, GWL_ID);757 nmhdr.hwndFrom = infoPtr->Self; 758 nmhdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); 907 759 nmhdr.code = SBN_SIMPLEMODECHANGE; 908 SendMessage A (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); 910 762 return TRUE; 911 763 } … … 913 765 914 766 static LRESULT 915 STATUSBAR_WMCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) 916 { 917 LPCREATESTRUCTA lpCreate = (LPCREATESTRUCTA)lParam; 918 NONCLIENTMETRICSA nclm; 767 STATUSBAR_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 794 static LRESULT 795 STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate) 796 { 797 STATUSWINDOWINFO *infoPtr; 798 NONCLIENTMETRICSW nclm; 919 799 DWORD dwStyle; 920 RECT 921 int width, len;800 RECT rect; 801 int i, width, len, textHeight = 0; 922 802 HDC hdc; 923 STATUSWINDOWINFO *infoPtr;924 803 925 804 TRACE("\n"); 926 #ifdef __WIN32OS2__927 infoPtr = (STATUSWINDOWINFO*)initControl(hwnd,sizeof(STATUSWINDOWINFO));928 #else929 805 infoPtr = (STATUSWINDOWINFO*)COMCTL32_Alloc (sizeof(STATUSWINDOWINFO)); 930 #endif 931 SetWindowLong A(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; 934 810 infoPtr->numParts = 1; 935 811 infoPtr->parts = 0; … … 938 814 infoPtr->hFont = 0; 939 815 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); 941 818 942 819 GetClientRect (hwnd, &rect); … … 944 821 UpdateWindow(hwnd); 945 822 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); 949 827 950 828 /* initialize simple case */ … … 957 835 /* initialize first part */ 958 836 infoPtr->parts = COMCTL32_Alloc (sizeof(STATUSWINDOWPART)); 837 if (!infoPtr->parts) goto create_fail; 959 838 infoPtr->parts[0].bound = rect; 960 839 infoPtr->parts[0].text = 0; … … 968 847 (len = strlenW ((LPCWSTR)lpCreate->lpszName))) { 969 848 infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 849 if (!infoPtr->parts[0].text) goto create_fail; 970 850 strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName); 971 851 } … … 976 856 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 ); 977 857 infoPtr->parts[0].text = COMCTL32_Alloc (lenW*sizeof(WCHAR)); 858 if (!infoPtr->parts[0].text) goto create_fail; 978 859 MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, 979 860 infoPtr->parts[0].text, lenW ); … … 981 862 } 982 863 983 dwStyle = GetWindowLong A(hwnd, GWL_STYLE);864 dwStyle = GetWindowLongW (hwnd, GWL_STYLE); 984 865 985 866 #ifndef __WIN32OS2__ 986 867 /* statusbars on managed windows should not have SIZEGRIP style */ 987 868 if ((dwStyle & SBARS_SIZEGRIP) && lpCreate->hwndParent) 988 if (GetWindowLong A(lpCreate->hwndParent, GWL_EXSTYLE) & WS_EX_MANAGED)989 SetWindowLong A(hwnd, GWL_STYLE, dwStyle & ~SBARS_SIZEGRIP);869 if (GetWindowLongW (lpCreate->hwndParent, GWL_EXSTYLE) & WS_EX_MANAGED) 870 SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~SBARS_SIZEGRIP); 990 871 #endif 872 991 873 if ((hdc = GetDC (0))) { 992 TEXTMETRIC Atm;874 TEXTMETRICW tm; 993 875 HFONT hOldFont; 994 876 995 hOldFont = SelectObject (hdc, infoPtr->hDefaultFont);996 GetTextMetrics A(hdc, &tm);997 infoPtr->textHeight = tm.tmHeight;877 hOldFont = SelectObject (hdc, infoPtr->hDefaultFont); 878 GetTextMetricsW (hdc, &tm); 879 textHeight = tm.tmHeight; 998 880 SelectObject (hdc, hOldFont); 999 ReleaseDC(0, hdc); 1000 } 881 ReleaseDC (0, hdc); 882 } 883 TRACE(" textHeight=%d\n", textHeight); 1001 884 1002 885 if (dwStyle & SBT_TOOLTIPS) { 1003 886 infoPtr->hwndToolTip = 1004 CreateWindowEx A (0, TOOLTIPS_CLASSA, NULL, 0,887 CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0, 1005 888 CW_USEDEFAULT, CW_USEDEFAULT, 1006 889 CW_USEDEFAULT, CW_USEDEFAULT, 1007 890 hwnd, 0, 1008 GetWindowLong A(hwnd, GWL_HINSTANCE), NULL);891 GetWindowLongW (hwnd, GWL_HINSTANCE), NULL); 1009 892 1010 893 if (infoPtr->hwndToolTip) { … … 1012 895 1013 896 nmttc.hdr.hwndFrom = hwnd; 1014 nmttc.hdr.idFrom = GetWindowLong A(hwnd, GWL_ID);897 nmttc.hdr.idFrom = GetWindowLongW (hwnd, GWL_ID); 1015 898 nmttc.hdr.code = NM_TOOLTIPSCREATED; 1016 899 nmttc.hwndToolTips = infoPtr->hwndToolTip; 1017 900 1018 SendMessage A(lpCreate->hwndParent, WM_NOTIFY,901 SendMessageW (lpCreate->hwndParent, WM_NOTIFY, 1019 902 (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 ! */ 1025 907 GetClientRect (GetParent (hwnd), &rect); 1026 908 width = rect.right - rect.left; 1027 infoPtr->height = infoPtr->textHeight + 4 + VERT_BORDER;909 infoPtr->height = textHeight + 4 + VERT_BORDER; 1028 910 SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1, 1029 911 width, infoPtr->height, SWP_NOZORDER); 1030 STATUSBAR_SetPartBounds (infoPtr , hwnd);912 STATUSBAR_SetPartBounds (infoPtr); 1031 913 } 1032 914 1033 915 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 917 create_fail: 918 TRACE(" failed!\n"); 919 if (infoPtr) STATUSBAR_WMDestroy(infoPtr); 920 return -1; 1070 921 } 1071 922 … … 1073 924 /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text 1074 925 * of the first part only (usual behaviour) */ 1075 static LRESULT1076 STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)926 static INT 927 STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, INT size, LPWSTR buf) 1077 928 { 1078 929 INT len; … … 1086 937 len = WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, NULL, 0, NULL, NULL )-1; 1087 938 1088 if ( wParam> len) {939 if (size > len) { 1089 940 if (infoPtr->bUnicode) 1090 strcpyW ( (LPWSTR)lParam, infoPtr->parts[0].text);941 strcpyW (buf, infoPtr->parts[0].text); 1091 942 else 1092 943 WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, 1093 (LPSTR) lParam, len+1, NULL, NULL );944 (LPSTR)buf, len+1, NULL, NULL ); 1094 945 return len; 1095 946 } … … 1099 950 1100 951 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) { 952 static BOOL 953 STATUSBAR_WMNCHitTest (STATUSWINDOWINFO *infoPtr, INT x, INT y) 954 { 955 if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) { 1115 956 RECT rect; 1116 957 POINT pt; 1117 958 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); 1123 964 1124 965 rect.left = rect.right - 13; … … 1129 970 } 1130 971 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 976 static LRESULT 977 STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HDC hdc) 978 { 979 PAINTSTRUCT ps; 980 1139 981 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 1141 987 return 0; 1142 988 } 1143 989 1144 990 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); 991 static LRESULT 992 STATUSBAR_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 1150 999 return 0; 1151 1000 } 1152 1001 1153 1002 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) 1003 static BOOL 1004 STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, LPCSTR text) 1203 1005 { 1204 1006 STATUSWINDOWPART *part; … … 1215 1017 part->text = 0; 1216 1018 if (infoPtr->bUnicode) { 1217 if ( lParam && (len = strlenW((LPCWSTR)lParam))) {1019 if (text && (len = strlenW((LPCWSTR)text))) { 1218 1020 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); 1220 1023 } 1221 1024 } 1222 1025 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 ); 1225 1028 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 ); 1227 1031 } 1228 1032 } 1229 1033 1230 InvalidateRect( hwnd, &part->bound, FALSE);1034 InvalidateRect(infoPtr->Self, &part->bound, FALSE); 1231 1035 1232 1036 return TRUE; … … 1234 1038 1235 1039 1236 static LRESULT1237 STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)1238 { 1239 INT width, x, y , flags;1040 static BOOL 1041 STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags) 1042 { 1043 INT width, x, y; 1240 1044 RECT parent_rect; 1241 DWORD dwStyle;1242 1045 1243 1046 /* Need to resize width to match parent */ 1244 flags = (INT) wParam;1245 1246 1047 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 1068 static LRESULT 1069 STATUSBAR_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; 1270 1076 } 1271 1077 … … 1278 1084 TRACE("code %04x\n", code); 1279 1085 nmhdr.hwndFrom = hwnd; 1280 nmhdr.idFrom = GetWindowLong A(hwnd, GWL_ID);1086 nmhdr.idFrom = GetWindowLongW (hwnd, GWL_ID); 1281 1087 nmhdr.code = code; 1282 SendMessage A(GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);1088 SendMessageW (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr); 1283 1089 return 0; 1284 1090 } … … 1290 1096 { 1291 1097 STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd); 1098 INT nPart = ((INT) wParam) & 0x00ff; 1099 LRESULT res; 1292 1100 1293 1101 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hwnd, msg, wParam, lParam); 1294 if (! (infoPtr) && (msg != WM_CREATE))1295 return DefWindowProc A(hwnd, msg, wParam, lParam);1102 if (!infoPtr && msg != WM_CREATE) 1103 return DefWindowProcW (hwnd, msg, wParam, lParam); 1296 1104 1297 1105 switch (msg) { 1298 1106 case SB_GETBORDERS: 1299 return STATUSBAR_GetBorders ( lParam);1107 return STATUSBAR_GetBorders ((INT *)lParam); 1300 1108 1301 1109 case SB_GETICON: 1302 return STATUSBAR_GetIcon (infoPtr, hwnd, wParam);1110 return STATUSBAR_GetIcon (infoPtr, nPart); 1303 1111 1304 1112 case SB_GETPARTS: 1305 return STATUSBAR_GetParts (infoPtr, hwnd, wParam,lParam);1113 return STATUSBAR_GetParts (infoPtr, (INT)wParam, (INT *)lParam); 1306 1114 1307 1115 case SB_GETRECT: 1308 return STATUSBAR_GetRect (infoPtr, hwnd, wParam,lParam);1116 return STATUSBAR_GetRect (infoPtr, nPart, (LPRECT)lParam); 1309 1117 1310 1118 case SB_GETTEXTA: 1311 return STATUSBAR_GetTextA (infoPtr, hwnd, wParam,lParam);1119 return STATUSBAR_GetTextA (infoPtr, nPart, (LPSTR)lParam); 1312 1120 1313 1121 case SB_GETTEXTW: 1314 return STATUSBAR_GetTextW (infoPtr, hwnd, wParam,lParam);1122 return STATUSBAR_GetTextW (infoPtr, nPart, (LPWSTR)lParam); 1315 1123 1316 1124 case SB_GETTEXTLENGTHA: 1317 1125 case SB_GETTEXTLENGTHW: 1318 return STATUSBAR_GetTextLength (infoPtr, hwnd, wParam);1126 return STATUSBAR_GetTextLength (infoPtr, nPart); 1319 1127 1320 1128 case SB_GETTIPTEXTA: 1321 return STATUSBAR_GetTipTextA (infoPtr, hwnd, wParam, lParam);1129 return STATUSBAR_GetTipTextA (infoPtr, LOWORD(wParam), (LPSTR)lParam, HIWORD(wParam)); 1322 1130 1323 1131 case SB_GETTIPTEXTW: 1324 return STATUSBAR_GetTipTextW (infoPtr, hwnd, wParam, lParam);1132 return STATUSBAR_GetTipTextW (infoPtr, LOWORD(wParam), (LPWSTR)lParam, HIWORD(wParam)); 1325 1133 1326 1134 case SB_GETUNICODEFORMAT: 1327 return STATUSBAR_GetUnicodeFormat (infoPtr, hwnd);1135 return infoPtr->bUnicode; 1328 1136 1329 1137 case SB_ISSIMPLE: 1330 return STATUSBAR_IsSimple (infoPtr, hwnd);1138 return infoPtr->simple; 1331 1139 1332 1140 case SB_SETBKCOLOR: 1333 return STATUSBAR_SetBkColor (infoPtr, hwnd, wParam,lParam);1141 return STATUSBAR_SetBkColor (infoPtr, (COLORREF)lParam); 1334 1142 1335 1143 case SB_SETICON: 1336 return STATUSBAR_SetIcon (infoPtr, hwnd, wParam,lParam);1144 return STATUSBAR_SetIcon (infoPtr, nPart, (HICON)lParam); 1337 1145 1338 1146 case SB_SETMINHEIGHT: 1339 return STATUSBAR_SetMinHeight (infoPtr, hwnd, wParam, lParam);1147 return STATUSBAR_SetMinHeight (infoPtr, (INT)wParam); 1340 1148 1341 1149 case SB_SETPARTS: 1342 return STATUSBAR_SetParts (infoPtr, hwnd, wParam,lParam);1150 return STATUSBAR_SetParts (infoPtr, (INT)wParam, (LPINT)lParam); 1343 1151 1344 1152 case SB_SETTEXTA: 1345 return STATUSBAR_SetText A (infoPtr, hwnd, wParam, lParam);1153 return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPCWSTR)lParam, FALSE); 1346 1154 1347 1155 case SB_SETTEXTW: 1348 return STATUSBAR_SetText W (infoPtr, hwnd, wParam, lParam);1156 return STATUSBAR_SetTextT (infoPtr, nPart, wParam & 0xff00, (LPCWSTR)lParam, TRUE); 1349 1157 1350 1158 case SB_SETTIPTEXTA: 1351 return STATUSBAR_SetTipTextA (infoPtr, hwnd, wParam,lParam);1159 return STATUSBAR_SetTipTextA (infoPtr, (INT)wParam, (LPSTR)lParam); 1352 1160 1353 1161 case SB_SETTIPTEXTW: 1354 return STATUSBAR_SetTipTextW (infoPtr, hwnd, wParam,lParam);1162 return STATUSBAR_SetTipTextW (infoPtr, (INT)wParam, (LPWSTR)lParam); 1355 1163 1356 1164 case SB_SETUNICODEFORMAT: 1357 return STATUSBAR_SetUnicodeFormat (infoPtr, hwnd,wParam);1165 return STATUSBAR_SetUnicodeFormat (infoPtr, (BOOL)wParam); 1358 1166 1359 1167 case SB_SIMPLE: 1360 return STATUSBAR_Simple (infoPtr, hwnd, wParam, lParam); 1361 1168 return STATUSBAR_Simple (infoPtr, (BOOL)wParam); 1362 1169 1363 1170 case WM_CREATE: 1364 return STATUSBAR_WMCreate (hwnd, wParam,lParam);1171 return STATUSBAR_WMCreate (hwnd, (LPCREATESTRUCTA)lParam); 1365 1172 1366 1173 case WM_DESTROY: 1367 return STATUSBAR_WMDestroy (infoPtr , hwnd);1174 return STATUSBAR_WMDestroy (infoPtr); 1368 1175 1369 1176 case WM_GETFONT: 1370 return STATUSBAR_WMGetFont (infoPtr, hwnd);1177 return infoPtr->hFont? infoPtr->hFont : infoPtr->hDefaultFont; 1371 1178 1372 1179 case WM_GETTEXT: 1373 return STATUSBAR_WMGetText (infoPtr, hwnd, wParam,lParam);1180 return STATUSBAR_WMGetText (infoPtr, (INT)wParam, (LPWSTR)lParam); 1374 1181 1375 1182 case WM_GETTEXTLENGTH: 1376 return STATUSBAR_GetTextLength (infoPtr, hwnd,0);1183 return STATUSBAR_GetTextLength (infoPtr, 0); 1377 1184 1378 1185 case WM_LBUTTONDBLCLK: … … 1383 1190 1384 1191 case WM_MOUSEMOVE: 1385 return STATUSBAR_WMMouseMove (infoPtr, hwnd, wParam, lParam);1192 return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam); 1386 1193 1387 1194 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: 1390 1201 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 1396 1208 case WM_PAINT: 1397 return STATUSBAR_WMPaint (infoPtr, hwnd,wParam);1209 return STATUSBAR_WMPaint (infoPtr, (HDC)wParam); 1398 1210 1399 1211 case WM_RBUTTONDBLCLK: … … 1404 1216 1405 1217 case WM_SETFONT: 1406 return STATUSBAR_WMSetFont (infoPtr, hwnd, wParam, lParam);1218 return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam)); 1407 1219 1408 1220 case WM_SETTEXT: 1409 return STATUSBAR_WMSetText (infoPtr, hwnd, wParam,lParam);1221 return STATUSBAR_WMSetText (infoPtr, (LPCSTR)lParam); 1410 1222 1411 1223 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); 1413 1226 1414 1227 default: … … 1416 1229 ERR("unknown msg %04x wp=%04x lp=%08lx\n", 1417 1230 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); 1423 1232 } 1424 1233 return 0; … … 1432 1241 */ 1433 1242 1434 VOID 1243 void 1435 1244 STATUS_Register (void) 1436 1245 { 1437 WNDCLASS AwndClass;1438 1439 ZeroMemory (&wndClass, sizeof(WNDCLASS A));1246 WNDCLASSW wndClass; 1247 1248 ZeroMemory (&wndClass, sizeof(WNDCLASSW)); 1440 1249 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW; 1441 1250 wndClass.lpfnWndProc = (WNDPROC)StatusWindowProc; 1442 1251 wndClass.cbClsExtra = 0; 1443 1252 wndClass.cbWndExtra = sizeof(STATUSWINDOWINFO *); 1444 wndClass.hCursor = LoadCursor A (0, IDC_ARROWA);1253 wndClass.hCursor = LoadCursorW (0, IDC_ARROWW); 1445 1254 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); 1446 wndClass.lpszClassName = STATUSCLASSNAME A;1255 wndClass.lpszClassName = STATUSCLASSNAMEW; 1447 1256 1448 RegisterClass A(&wndClass);1257 RegisterClassW (&wndClass); 1449 1258 } 1450 1259 … … 1456 1265 */ 1457 1266 1458 VOID 1267 void 1459 1268 STATUS_Unregister (void) 1460 1269 { 1461 UnregisterClass A (STATUSCLASSNAMEA, (HINSTANCE)NULL);1462 } 1463 1270 UnregisterClassW (STATUSCLASSNAMEW, (HINSTANCE)NULL); 1271 } 1272
Note:
See TracChangeset
for help on using the changeset viewer.