| 1 | /*
|
|---|
| 2 | * Interface code to StatusWindow widget/control
|
|---|
| 3 | *
|
|---|
| 4 | * Copyright 1996 Bruce Milner
|
|---|
| 5 | * Copyright 1998, 1999 Eric Kohl
|
|---|
| 6 | */
|
|---|
| 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 | */
|
|---|
| 14 |
|
|---|
| 15 | #include <string.h>
|
|---|
| 16 | #include "winbase.h"
|
|---|
| 17 | #include "wine/unicode.h"
|
|---|
| 18 | #include "commctrl.h"
|
|---|
| 19 | #include "debugtools.h"
|
|---|
| 20 | #ifdef __WIN32OS2__
|
|---|
| 21 | #include "ccbase.h"
|
|---|
| 22 | #endif
|
|---|
| 23 |
|
|---|
| 24 | DEFAULT_DEBUG_CHANNEL(statusbar);
|
|---|
| 25 |
|
|---|
| 26 | typedef struct
|
|---|
| 27 | {
|
|---|
| 28 | INT x;
|
|---|
| 29 | INT style;
|
|---|
| 30 | RECT bound;
|
|---|
| 31 | LPWSTR text;
|
|---|
| 32 | HICON hIcon;
|
|---|
| 33 | } STATUSWINDOWPART;
|
|---|
| 34 |
|
|---|
| 35 | typedef struct
|
|---|
| 36 | {
|
|---|
| 37 | #ifdef __WIN32OS2__
|
|---|
| 38 | COMCTL32_HEADER header;
|
|---|
| 39 | #endif
|
|---|
| 40 | HWND hwndParent;
|
|---|
| 41 | WORD numParts;
|
|---|
| 42 | WORD textHeight;
|
|---|
| 43 | UINT height;
|
|---|
| 44 | BOOL simple;
|
|---|
| 45 | HWND hwndToolTip;
|
|---|
| 46 | HFONT hFont;
|
|---|
| 47 | HFONT hDefaultFont;
|
|---|
| 48 | COLORREF clrBk; /* background color */
|
|---|
| 49 | BOOL bUnicode; /* unicode flag */
|
|---|
| 50 | STATUSWINDOWPART part0; /* simple window */
|
|---|
| 51 | STATUSWINDOWPART *parts;
|
|---|
| 52 | } STATUSWINDOWINFO;
|
|---|
| 53 |
|
|---|
| 54 | /*
|
|---|
| 55 | * Run tests using Waite Group Windows95 API Bible Vol. 1&2
|
|---|
| 56 | * The second cdrom contains executables drawstat.exe, gettext.exe,
|
|---|
| 57 | * simple.exe, getparts.exe, setparts.exe, statwnd.exe
|
|---|
| 58 | */
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 | #define _MAX(a,b) (((a)>(b))?(a):(b))
|
|---|
| 62 | #define _MIN(a,b) (((a)>(b))?(b):(a))
|
|---|
| 63 |
|
|---|
| 64 | #define HORZ_BORDER 0
|
|---|
| 65 | #define VERT_BORDER 2
|
|---|
| 66 | #define HORZ_GAP 2
|
|---|
| 67 |
|
|---|
| 68 | #define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongA (hwnd, 0))
|
|---|
| 69 |
|
|---|
| 70 | /* prototype */
|
|---|
| 71 | static void
|
|---|
| 72 | STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr, HWND hwnd);
|
|---|
| 73 |
|
|---|
| 74 | static void
|
|---|
| 75 | STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
|
|---|
| 76 | {
|
|---|
| 77 | HPEN hOldPen;
|
|---|
| 78 | POINT pt;
|
|---|
| 79 | INT i;
|
|---|
| 80 |
|
|---|
| 81 | TRACE("draw size grip %d,%d - %d,%d\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
|---|
| 82 | pt.x = lpRect->right - 1;
|
|---|
| 83 | pt.y = lpRect->bottom - 1;
|
|---|
| 84 |
|
|---|
| 85 | hOldPen = SelectObject (hdc, GetSysColorPen (COLOR_3DFACE));
|
|---|
| 86 | MoveToEx (hdc, pt.x - 12, pt.y, NULL);
|
|---|
| 87 | LineTo (hdc, pt.x, pt.y);
|
|---|
| 88 | LineTo (hdc, pt.x, pt.y - 12);
|
|---|
| 89 |
|
|---|
| 90 | pt.x--;
|
|---|
| 91 | pt.y--;
|
|---|
| 92 |
|
|---|
| 93 | SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW));
|
|---|
| 94 | for (i = 1; i < 11; i += 4) {
|
|---|
| 95 | 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));
|
|---|
| 103 | for (i = 3; i < 13; i += 4) {
|
|---|
| 104 | MoveToEx (hdc, pt.x - i, pt.y, NULL);
|
|---|
| 105 | LineTo (hdc, pt.x, pt.y - i);
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | SelectObject (hdc, hOldPen);
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 | static void
|
|---|
| 113 | STATUSBAR_DrawPart (HDC hdc, STATUSWINDOWPART *part)
|
|---|
| 114 | {
|
|---|
| 115 | RECT r = part->bound;
|
|---|
| 116 | UINT border = BDR_SUNKENOUTER;
|
|---|
| 117 |
|
|---|
| 118 | TRACE("part bound %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom);
|
|---|
| 119 | if (part->style & SBT_POPOUT)
|
|---|
| 120 | border = BDR_RAISEDOUTER;
|
|---|
| 121 | else if (part->style & SBT_NOBORDERS)
|
|---|
| 122 | border = 0;
|
|---|
| 123 |
|
|---|
| 124 | 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)
|
|---|
| 160 | {
|
|---|
| 161 | HBRUSH hbrBk;
|
|---|
| 162 | HFONT hOldFont;
|
|---|
| 163 |
|
|---|
| 164 | TRACE("item %d\n", itemID);
|
|---|
| 165 | if (!IsWindowVisible (hwnd))
|
|---|
| 166 | return;
|
|---|
| 167 |
|
|---|
| 168 | if (part->bound.right < part->bound.left) return;
|
|---|
| 169 |
|
|---|
| 170 | if (infoPtr->clrBk != CLR_DEFAULT)
|
|---|
| 171 | hbrBk = CreateSolidBrush (infoPtr->clrBk);
|
|---|
| 172 | else
|
|---|
| 173 | hbrBk = GetSysColorBrush (COLOR_3DFACE);
|
|---|
| 174 | FillRect(hdc, &part->bound, hbrBk);
|
|---|
| 175 |
|
|---|
| 176 | hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
|
|---|
| 177 |
|
|---|
| 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);
|
|---|
| 191 |
|
|---|
| 192 | SelectObject (hdc, hOldFont);
|
|---|
| 193 |
|
|---|
| 194 | 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)
|
|---|
| 208 | {
|
|---|
| 209 | int i;
|
|---|
| 210 | RECT rect;
|
|---|
| 211 | HBRUSH hbrBk;
|
|---|
| 212 | HFONT hOldFont;
|
|---|
| 213 |
|
|---|
| 214 | TRACE("\n");
|
|---|
| 215 | if (!IsWindowVisible(hwnd))
|
|---|
| 216 | return (TRUE);
|
|---|
| 217 |
|
|---|
| 218 | STATUSBAR_SetPartBounds(infoPtr, hwnd);
|
|---|
| 219 |
|
|---|
| 220 | GetClientRect (hwnd, &rect);
|
|---|
| 221 |
|
|---|
| 222 | if (infoPtr->clrBk != CLR_DEFAULT)
|
|---|
| 223 | hbrBk = CreateSolidBrush (infoPtr->clrBk);
|
|---|
| 224 | else
|
|---|
| 225 | hbrBk = GetSysColorBrush (COLOR_3DFACE);
|
|---|
| 226 | FillRect(hdc, &rect, hbrBk);
|
|---|
| 227 |
|
|---|
| 228 | hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
|
|---|
| 229 |
|
|---|
| 230 | if (infoPtr->simple) {
|
|---|
| 231 | STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->part0, hdc, 0);
|
|---|
| 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 | }
|
|---|
| 248 | }
|
|---|
| 249 |
|
|---|
| 250 | SelectObject (hdc, hOldFont);
|
|---|
| 251 |
|
|---|
| 252 | 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;
|
|---|
| 259 | }
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 | static void
|
|---|
| 263 | STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
|---|
| 264 | {
|
|---|
| 265 | STATUSWINDOWPART *part;
|
|---|
| 266 | RECT rect, *r;
|
|---|
| 267 | int i;
|
|---|
| 268 |
|
|---|
| 269 | /* get our window size */
|
|---|
| 270 | GetClientRect (hwnd, &rect);
|
|---|
| 271 | TRACE("client wnd size is %d,%d - %d,%d\n", rect.left, rect.top, rect.right, rect.bottom);
|
|---|
| 272 |
|
|---|
| 273 | rect.top += VERT_BORDER;
|
|---|
| 274 |
|
|---|
| 275 | /* set bounds for simple rectangle */
|
|---|
| 276 | infoPtr->part0.bound = rect;
|
|---|
| 277 |
|
|---|
| 278 | /* set bounds for non-simple rectangles */
|
|---|
| 279 | for (i = 0; i < infoPtr->numParts; i++) {
|
|---|
| 280 | part = &infoPtr->parts[i];
|
|---|
| 281 | r = &infoPtr->parts[i].bound;
|
|---|
| 282 | r->top = rect.top;
|
|---|
| 283 | r->bottom = rect.bottom;
|
|---|
| 284 | if (i == 0)
|
|---|
| 285 | r->left = 0;
|
|---|
| 286 | else
|
|---|
| 287 | r->left = infoPtr->parts[i-1].bound.right + HORZ_GAP;
|
|---|
| 288 | if (part->x == -1)
|
|---|
| 289 | r->right = rect.right;
|
|---|
| 290 | else
|
|---|
| 291 | r->right = part->x;
|
|---|
| 292 |
|
|---|
| 293 | if (infoPtr->hwndToolTip) {
|
|---|
| 294 | TTTOOLINFOA ti;
|
|---|
| 295 |
|
|---|
| 296 | ti.cbSize = sizeof(TTTOOLINFOA);
|
|---|
| 297 | ti.hwnd = hwnd;
|
|---|
| 298 | ti.uId = i;
|
|---|
| 299 | ti.rect = *r;
|
|---|
| 300 | SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA,
|
|---|
| 301 | 0, (LPARAM)&ti);
|
|---|
| 302 | }
|
|---|
| 303 | }
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 |
|
|---|
| 307 | static VOID
|
|---|
| 308 | STATUSBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
|
|---|
| 309 | WPARAM wParam, LPARAM lParam)
|
|---|
| 310 | {
|
|---|
| 311 | MSG msg;
|
|---|
| 312 |
|
|---|
| 313 | msg.hwnd = hwndMsg;
|
|---|
| 314 | msg.message = uMsg;
|
|---|
| 315 | msg.wParam = wParam;
|
|---|
| 316 | msg.lParam = lParam;
|
|---|
| 317 | msg.time = GetMessageTime ();
|
|---|
| 318 | msg.pt.x = LOWORD(GetMessagePos ());
|
|---|
| 319 | msg.pt.y = HIWORD(GetMessagePos ());
|
|---|
| 320 |
|
|---|
| 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 |
|
|---|
| 330 | TRACE("\n");
|
|---|
| 331 | out[0] = HORZ_BORDER; /* horizontal border width */
|
|---|
| 332 | out[1] = VERT_BORDER; /* vertical border width */
|
|---|
| 333 | out[2] = HORZ_GAP; /* width of border between rectangles */
|
|---|
| 334 |
|
|---|
| 335 | return TRUE;
|
|---|
| 336 | }
|
|---|
| 337 |
|
|---|
| 338 |
|
|---|
| 339 | static LRESULT
|
|---|
| 340 | STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
|
|---|
| 341 | {
|
|---|
| 342 | INT nPart;
|
|---|
| 343 |
|
|---|
| 344 | nPart = (INT)wParam & 0x00ff;
|
|---|
| 345 | TRACE("%d\n", nPart);
|
|---|
| 346 | if ((nPart < -1) || (nPart >= infoPtr->numParts))
|
|---|
| 347 | return 0;
|
|---|
| 348 |
|
|---|
| 349 | if (nPart == -1)
|
|---|
| 350 | return (infoPtr->part0.hIcon);
|
|---|
| 351 | else
|
|---|
| 352 | return (infoPtr->parts[nPart].hIcon);
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 | static LRESULT
|
|---|
| 357 | STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 358 | {
|
|---|
| 359 | LPINT parts;
|
|---|
| 360 | INT num_parts;
|
|---|
| 361 | INT i;
|
|---|
| 362 |
|
|---|
| 363 | num_parts = (INT) wParam;
|
|---|
| 364 | TRACE("(%d)\n", num_parts);
|
|---|
| 365 | parts = (LPINT) lParam;
|
|---|
| 366 | if (parts) {
|
|---|
| 367 | for (i = 0; i < num_parts; i++) {
|
|---|
| 368 | parts[i] = infoPtr->parts[i].x;
|
|---|
| 369 | }
|
|---|
| 370 | }
|
|---|
| 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;
|
|---|
| 382 | TRACE("part %d\n", nPart);
|
|---|
| 383 | rect = (LPRECT) lParam;
|
|---|
| 384 | if (infoPtr->simple)
|
|---|
| 385 | *rect = infoPtr->part0.bound;
|
|---|
| 386 | else
|
|---|
| 387 | *rect = infoPtr->parts[nPart].bound;
|
|---|
| 388 | return TRUE;
|
|---|
| 389 | }
|
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 | static LRESULT
|
|---|
| 393 | STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 394 | {
|
|---|
| 395 | STATUSWINDOWPART *part;
|
|---|
| 396 | INT nPart;
|
|---|
| 397 | LRESULT result;
|
|---|
| 398 |
|
|---|
| 399 | nPart = ((INT) wParam) & 0x00ff;
|
|---|
| 400 | TRACE("part %d\n", nPart);
|
|---|
| 401 | if (infoPtr->simple)
|
|---|
| 402 | part = &infoPtr->part0;
|
|---|
| 403 | else
|
|---|
| 404 | part = &infoPtr->parts[nPart];
|
|---|
| 405 |
|
|---|
| 406 | if (part->style & SBT_OWNERDRAW)
|
|---|
| 407 | result = (LRESULT)part->text;
|
|---|
| 408 | else {
|
|---|
| 409 | DWORD len = part->text ? WideCharToMultiByte( CP_ACP, 0, part->text, -1,
|
|---|
| 410 | NULL, 0, NULL, NULL ) - 1 : 0;
|
|---|
| 411 | result = MAKELONG( len, part->style );
|
|---|
| 412 | if (lParam && len)
|
|---|
| 413 | WideCharToMultiByte( CP_ACP, 0, part->text, -1, (LPSTR)lParam, len+1, NULL, NULL );
|
|---|
| 414 | }
|
|---|
| 415 | return result;
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 | static LRESULT
|
|---|
| 420 | STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 421 | {
|
|---|
| 422 | STATUSWINDOWPART *part;
|
|---|
| 423 | INT nPart;
|
|---|
| 424 | LRESULT result;
|
|---|
| 425 |
|
|---|
| 426 | nPart = ((INT)wParam) & 0x00ff;
|
|---|
| 427 | TRACE("part %d\n", nPart);
|
|---|
| 428 | if (infoPtr->simple)
|
|---|
| 429 | part = &infoPtr->part0;
|
|---|
| 430 | else
|
|---|
| 431 | part = &infoPtr->parts[nPart];
|
|---|
| 432 |
|
|---|
| 433 | if (part->style & SBT_OWNERDRAW)
|
|---|
| 434 | result = (LRESULT)part->text;
|
|---|
| 435 | else {
|
|---|
| 436 | result = part->text ? strlenW (part->text) : 0;
|
|---|
| 437 | result |= (part->style << 16);
|
|---|
| 438 | if (part->text && lParam)
|
|---|
| 439 | strcpyW ((LPWSTR)lParam, part->text);
|
|---|
| 440 | }
|
|---|
| 441 | return result;
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 | static LRESULT
|
|---|
| 446 | STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
|
|---|
| 447 | {
|
|---|
| 448 | STATUSWINDOWPART *part;
|
|---|
| 449 | INT nPart;
|
|---|
| 450 | DWORD result;
|
|---|
| 451 |
|
|---|
| 452 | nPart = ((INT) wParam) & 0x00ff;
|
|---|
| 453 |
|
|---|
| 454 | TRACE("part %d\n", nPart);
|
|---|
| 455 | if (infoPtr->simple)
|
|---|
| 456 | part = &infoPtr->part0;
|
|---|
| 457 | else
|
|---|
| 458 | part = &infoPtr->parts[nPart];
|
|---|
| 459 |
|
|---|
| 460 | if (part->text)
|
|---|
| 461 | result = strlenW(part->text);
|
|---|
| 462 | else
|
|---|
| 463 | result = 0;
|
|---|
| 464 |
|
|---|
| 465 | result |= (part->style << 16);
|
|---|
| 466 | return result;
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 |
|
|---|
| 470 | static LRESULT
|
|---|
| 471 | STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 472 | {
|
|---|
| 473 | LPSTR tip = (LPSTR)lParam;
|
|---|
| 474 |
|
|---|
| 475 | if (tip) {
|
|---|
| 476 | CHAR buf[INFOTIPSIZE];
|
|---|
| 477 | buf[0]='\0';
|
|---|
| 478 |
|
|---|
| 479 | if (infoPtr->hwndToolTip) {
|
|---|
| 480 | TTTOOLINFOA ti;
|
|---|
| 481 | ti.cbSize = sizeof(TTTOOLINFOA);
|
|---|
| 482 | ti.hwnd = hwnd;
|
|---|
| 483 | ti.uId = LOWORD(wParam);
|
|---|
| 484 | ti.lpszText = buf;
|
|---|
| 485 | SendMessageA(infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti);
|
|---|
| 486 | }
|
|---|
| 487 | lstrcpynA(tip, buf, HIWORD(wParam));
|
|---|
| 488 | }
|
|---|
| 489 | return 0;
|
|---|
| 490 | }
|
|---|
| 491 |
|
|---|
| 492 |
|
|---|
| 493 | static LRESULT
|
|---|
| 494 | STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 495 | {
|
|---|
| 496 | LPWSTR tip = (LPWSTR)lParam;
|
|---|
| 497 |
|
|---|
| 498 | TRACE("\n");
|
|---|
| 499 | if (tip) {
|
|---|
| 500 | WCHAR buf[INFOTIPSIZE];
|
|---|
| 501 | buf[0]=0;
|
|---|
| 502 |
|
|---|
| 503 | if (infoPtr->hwndToolTip) {
|
|---|
| 504 | TTTOOLINFOW ti;
|
|---|
| 505 | ti.cbSize = sizeof(TTTOOLINFOW);
|
|---|
| 506 | ti.hwnd = hwnd;
|
|---|
| 507 | ti.uId = LOWORD(wParam);
|
|---|
| 508 | ti.lpszText = buf;
|
|---|
| 509 | SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti);
|
|---|
| 510 | }
|
|---|
| 511 | lstrcpynW(tip, buf, HIWORD(wParam));
|
|---|
| 512 | }
|
|---|
| 513 |
|
|---|
| 514 | return 0;
|
|---|
| 515 | }
|
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 | inline static LRESULT
|
|---|
| 519 | STATUSBAR_GetUnicodeFormat (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
|---|
| 520 | {
|
|---|
| 521 | return infoPtr->bUnicode;
|
|---|
| 522 | }
|
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 | inline static LRESULT
|
|---|
| 526 | STATUSBAR_IsSimple (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
|---|
| 527 | {
|
|---|
| 528 | return infoPtr->simple;
|
|---|
| 529 | }
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 | static LRESULT
|
|---|
| 533 | STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 534 | {
|
|---|
| 535 | COLORREF oldBkColor;
|
|---|
| 536 |
|
|---|
| 537 | oldBkColor = infoPtr->clrBk;
|
|---|
| 538 | infoPtr->clrBk = (COLORREF)lParam;
|
|---|
| 539 | InvalidateRect(hwnd, NULL, FALSE);
|
|---|
| 540 |
|
|---|
| 541 | TRACE("CREF: %08lx -> %08lx\n", oldBkColor, infoPtr->clrBk);
|
|---|
| 542 | return oldBkColor;
|
|---|
| 543 | }
|
|---|
| 544 |
|
|---|
| 545 |
|
|---|
| 546 | static LRESULT
|
|---|
| 547 | STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 548 | {
|
|---|
| 549 | INT nPart = (INT)wParam & 0x00ff;
|
|---|
| 550 |
|
|---|
| 551 | if ((nPart < -1) || (nPart >= infoPtr->numParts))
|
|---|
| 552 | return FALSE;
|
|---|
| 553 |
|
|---|
| 554 | TRACE("setting part %d, icon %lx\n",nPart,lParam);
|
|---|
| 555 |
|
|---|
| 556 | if (nPart == -1) {
|
|---|
| 557 | if (infoPtr->part0.hIcon == (HICON)lParam) /* same as - no redraw */
|
|---|
| 558 | return TRUE;
|
|---|
| 559 | infoPtr->part0.hIcon = (HICON)lParam;
|
|---|
| 560 | if (infoPtr->simple)
|
|---|
| 561 | InvalidateRect(hwnd, &infoPtr->part0.bound, FALSE);
|
|---|
| 562 | } else {
|
|---|
| 563 | if (infoPtr->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */
|
|---|
| 564 | return TRUE;
|
|---|
| 565 |
|
|---|
| 566 | infoPtr->parts[nPart].hIcon = (HICON)lParam;
|
|---|
| 567 | if (!(infoPtr->simple))
|
|---|
| 568 | InvalidateRect(hwnd, &infoPtr->parts[nPart].bound, FALSE);
|
|---|
| 569 | }
|
|---|
| 570 | return TRUE;
|
|---|
| 571 | }
|
|---|
| 572 |
|
|---|
| 573 |
|
|---|
| 574 | static LRESULT
|
|---|
| 575 | STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 576 | {
|
|---|
| 577 |
|
|---|
| 578 | TRACE("\n");
|
|---|
| 579 | if (IsWindowVisible (hwnd)) {
|
|---|
| 580 | HWND parent = GetParent (hwnd);
|
|---|
| 581 | INT width, x, y;
|
|---|
| 582 | RECT parent_rect;
|
|---|
| 583 |
|
|---|
| 584 | GetClientRect (parent, &parent_rect);
|
|---|
| 585 | infoPtr->height = (INT)wParam + VERT_BORDER;
|
|---|
| 586 | width = parent_rect.right - parent_rect.left;
|
|---|
| 587 | x = parent_rect.left;
|
|---|
| 588 | y = parent_rect.bottom - infoPtr->height;
|
|---|
| 589 | MoveWindow (hwnd, parent_rect.left,
|
|---|
| 590 | parent_rect.bottom - infoPtr->height,
|
|---|
| 591 | width, infoPtr->height, TRUE);
|
|---|
| 592 | STATUSBAR_SetPartBounds (infoPtr, hwnd);
|
|---|
| 593 | }
|
|---|
| 594 |
|
|---|
| 595 | return TRUE;
|
|---|
| 596 | }
|
|---|
| 597 |
|
|---|
| 598 |
|
|---|
| 599 | static LRESULT
|
|---|
| 600 | STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 601 | {
|
|---|
| 602 | STATUSWINDOWPART *tmp;
|
|---|
| 603 | LPINT parts;
|
|---|
| 604 | int i;
|
|---|
| 605 | int oldNumParts;
|
|---|
| 606 |
|
|---|
| 607 | TRACE("(%d,%p)\n",wParam,(LPVOID)lParam);
|
|---|
| 608 |
|
|---|
| 609 | /* FIXME: should return FALSE sometimes (maybe when wParam == 0 ?) */
|
|---|
| 610 | if (infoPtr->simple)
|
|---|
| 611 | infoPtr->simple = FALSE;
|
|---|
| 612 |
|
|---|
| 613 | oldNumParts = infoPtr->numParts;
|
|---|
| 614 | infoPtr->numParts = (INT) wParam;
|
|---|
| 615 | parts = (LPINT) lParam;
|
|---|
| 616 | if (oldNumParts > infoPtr->numParts) {
|
|---|
| 617 | for (i = infoPtr->numParts ; i < oldNumParts; i++) {
|
|---|
| 618 | if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))
|
|---|
| 619 | COMCTL32_Free (infoPtr->parts[i].text);
|
|---|
| 620 | }
|
|---|
| 621 | }
|
|---|
| 622 | if (oldNumParts < infoPtr->numParts) {
|
|---|
| 623 | tmp = COMCTL32_Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts);
|
|---|
| 624 | for (i = 0; i < oldNumParts; i++) {
|
|---|
| 625 | tmp[i] = infoPtr->parts[i];
|
|---|
| 626 | }
|
|---|
| 627 | if (infoPtr->parts)
|
|---|
| 628 | COMCTL32_Free (infoPtr->parts);
|
|---|
| 629 | infoPtr->parts = tmp;
|
|---|
| 630 | }
|
|---|
| 631 | if (oldNumParts == infoPtr->numParts) {
|
|---|
| 632 | for (i=0;i<oldNumParts;i++)
|
|---|
| 633 | if (infoPtr->parts[i].x != parts[i])
|
|---|
| 634 | break;
|
|---|
| 635 | if (i==oldNumParts) /* Unchanged? no need to redraw! */
|
|---|
| 636 | return TRUE;
|
|---|
| 637 | }
|
|---|
| 638 |
|
|---|
| 639 | for (i = 0; i < infoPtr->numParts; i++)
|
|---|
| 640 | infoPtr->parts[i].x = parts[i];
|
|---|
| 641 |
|
|---|
| 642 | if (infoPtr->hwndToolTip) {
|
|---|
| 643 | INT nTipCount =
|
|---|
| 644 | SendMessageA (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);
|
|---|
| 645 |
|
|---|
| 646 | if (nTipCount < infoPtr->numParts) {
|
|---|
| 647 | /* add tools */
|
|---|
| 648 | TTTOOLINFOA ti;
|
|---|
| 649 | INT i;
|
|---|
| 650 |
|
|---|
| 651 | ZeroMemory (&ti, sizeof(TTTOOLINFOA));
|
|---|
| 652 | ti.cbSize = sizeof(TTTOOLINFOA);
|
|---|
| 653 | ti.hwnd = hwnd;
|
|---|
| 654 | for (i = nTipCount; i < infoPtr->numParts; i++) {
|
|---|
| 655 | TRACE("add tool %d\n", i);
|
|---|
| 656 | ti.uId = i;
|
|---|
| 657 | SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA,
|
|---|
| 658 | 0, (LPARAM)&ti);
|
|---|
| 659 | }
|
|---|
| 660 | }
|
|---|
| 661 | else if (nTipCount > infoPtr->numParts) {
|
|---|
| 662 | /* delete tools */
|
|---|
| 663 | INT i;
|
|---|
| 664 |
|
|---|
| 665 | for (i = nTipCount - 1; i >= infoPtr->numParts; i--) {
|
|---|
| 666 | FIXME("delete tool %d\n", i);
|
|---|
| 667 | }
|
|---|
| 668 | }
|
|---|
| 669 | }
|
|---|
| 670 | STATUSBAR_SetPartBounds (infoPtr, hwnd);
|
|---|
| 671 | InvalidateRect(hwnd, NULL, FALSE);
|
|---|
| 672 | return TRUE;
|
|---|
| 673 | }
|
|---|
| 674 |
|
|---|
| 675 |
|
|---|
| 676 | static LRESULT
|
|---|
| 677 | STATUSBAR_SetTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 678 | {
|
|---|
| 679 | STATUSWINDOWPART *part=NULL;
|
|---|
| 680 | int nPart;
|
|---|
| 681 | int style;
|
|---|
| 682 | LPSTR text;
|
|---|
| 683 | BOOL changed = FALSE;
|
|---|
| 684 |
|
|---|
| 685 | text = (LPSTR) lParam;
|
|---|
| 686 | nPart = ((INT) wParam) & 0x00ff;
|
|---|
| 687 | style = ((INT) wParam) & 0xff00;
|
|---|
| 688 |
|
|---|
| 689 | TRACE("part %d, text %s\n",nPart,debugstr_a(text));
|
|---|
| 690 |
|
|---|
| 691 | if (nPart==255)
|
|---|
| 692 | part = &infoPtr->part0;
|
|---|
| 693 | else if (!infoPtr->simple && infoPtr->parts!=NULL)
|
|---|
| 694 | part = &infoPtr->parts[nPart];
|
|---|
| 695 | if (!part) return FALSE;
|
|---|
| 696 |
|
|---|
| 697 | if (part->style != style)
|
|---|
| 698 | changed = TRUE;
|
|---|
| 699 |
|
|---|
| 700 | part->style = style;
|
|---|
| 701 | if (style & SBT_OWNERDRAW) {
|
|---|
| 702 | if (part->text == (LPWSTR)text)
|
|---|
| 703 | return TRUE;
|
|---|
| 704 | part->text = (LPWSTR)text;
|
|---|
| 705 | } else {
|
|---|
| 706 | LPWSTR ntext;
|
|---|
| 707 |
|
|---|
| 708 | /* check if text is unchanged -> no need to redraw */
|
|---|
| 709 | if (text) {
|
|---|
| 710 | DWORD len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 );
|
|---|
| 711 | LPWSTR tmptext = COMCTL32_Alloc(len*sizeof(WCHAR));
|
|---|
| 712 | MultiByteToWideChar( CP_ACP, 0, text, -1, tmptext, len );
|
|---|
| 713 |
|
|---|
| 714 | if (!changed && part->text && !lstrcmpW(tmptext,part->text)) {
|
|---|
| 715 | COMCTL32_Free(tmptext);
|
|---|
| 716 | return TRUE;
|
|---|
| 717 | }
|
|---|
| 718 | ntext = tmptext;
|
|---|
| 719 | } else {
|
|---|
| 720 | if (!changed && !part->text)
|
|---|
| 721 | return TRUE;
|
|---|
| 722 | ntext = 0;
|
|---|
| 723 | }
|
|---|
| 724 |
|
|---|
| 725 | if (part->text)
|
|---|
| 726 | COMCTL32_Free (part->text);
|
|---|
| 727 | part->text = ntext;
|
|---|
| 728 | }
|
|---|
| 729 | InvalidateRect(hwnd, &part->bound, FALSE);
|
|---|
| 730 |
|
|---|
| 731 | return TRUE;
|
|---|
| 732 | }
|
|---|
| 733 |
|
|---|
| 734 |
|
|---|
| 735 | static LRESULT
|
|---|
| 736 | STATUSBAR_SetTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 737 | {
|
|---|
| 738 | STATUSWINDOWPART *part;
|
|---|
| 739 | INT nPart, style, len;
|
|---|
| 740 | LPWSTR text;
|
|---|
| 741 | BOOL bRedraw = FALSE;
|
|---|
| 742 |
|
|---|
| 743 | text = (LPWSTR) lParam;
|
|---|
| 744 | nPart = ((INT) wParam) & 0x00ff;
|
|---|
| 745 | style = ((INT) wParam) & 0xff00;
|
|---|
| 746 |
|
|---|
| 747 | TRACE("part %d -> '%s' with style %04x\n", nPart, debugstr_w(text), style);
|
|---|
| 748 | if ((infoPtr->simple) || (infoPtr->parts==NULL) || (nPart==255))
|
|---|
| 749 | part = &infoPtr->part0;
|
|---|
| 750 | else
|
|---|
| 751 | part = &infoPtr->parts[nPart];
|
|---|
| 752 | if (!part) return FALSE;
|
|---|
| 753 |
|
|---|
| 754 | if(part->style != style)
|
|---|
| 755 | bRedraw = TRUE;
|
|---|
| 756 |
|
|---|
| 757 | part->style = style;
|
|---|
| 758 |
|
|---|
| 759 | /* FIXME: not sure how/if we can check for change in string with ownerdraw(remove this if we can't)... */
|
|---|
| 760 | if (style & SBT_OWNERDRAW)
|
|---|
| 761 | {
|
|---|
| 762 | part->text = text;
|
|---|
| 763 | bRedraw = TRUE;
|
|---|
| 764 | } else if(!text)
|
|---|
| 765 | {
|
|---|
| 766 | if(part->text)
|
|---|
| 767 | {
|
|---|
| 768 | COMCTL32_Free(part->text);
|
|---|
| 769 | bRedraw = TRUE;
|
|---|
| 770 | }
|
|---|
| 771 | part->text = 0;
|
|---|
| 772 | } else if(!part->text || strcmpW(part->text, text)) /* see if the new string differs from the existing string */
|
|---|
| 773 | {
|
|---|
| 774 | if(part->text) COMCTL32_Free(part->text);
|
|---|
| 775 |
|
|---|
| 776 | len = strlenW(text);
|
|---|
| 777 | part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
|
|---|
| 778 | strcpyW(part->text, text);
|
|---|
| 779 | bRedraw = TRUE;
|
|---|
| 780 | }
|
|---|
| 781 |
|
|---|
| 782 | if(bRedraw)
|
|---|
| 783 | InvalidateRect(hwnd, &part->bound, FALSE);
|
|---|
| 784 |
|
|---|
| 785 | return TRUE;
|
|---|
| 786 | }
|
|---|
| 787 |
|
|---|
| 788 |
|
|---|
| 789 | static LRESULT
|
|---|
| 790 | STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 791 | {
|
|---|
| 792 | TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam);
|
|---|
| 793 | if (infoPtr->hwndToolTip) {
|
|---|
| 794 | TTTOOLINFOA ti;
|
|---|
| 795 | ti.cbSize = sizeof(TTTOOLINFOA);
|
|---|
| 796 | ti.hwnd = hwnd;
|
|---|
| 797 | ti.uId = (INT)wParam;
|
|---|
| 798 | ti.hinst = 0;
|
|---|
| 799 | ti.lpszText = (LPSTR)lParam;
|
|---|
| 800 | SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA,
|
|---|
| 801 | 0, (LPARAM)&ti);
|
|---|
| 802 | }
|
|---|
| 803 |
|
|---|
| 804 | return 0;
|
|---|
| 805 | }
|
|---|
| 806 |
|
|---|
| 807 |
|
|---|
| 808 | static LRESULT
|
|---|
| 809 | STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 810 | {
|
|---|
| 811 | TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam);
|
|---|
| 812 | if (infoPtr->hwndToolTip) {
|
|---|
| 813 | TTTOOLINFOW ti;
|
|---|
| 814 | ti.cbSize = sizeof(TTTOOLINFOW);
|
|---|
| 815 | ti.hwnd = hwnd;
|
|---|
| 816 | ti.uId = (INT)wParam;
|
|---|
| 817 | ti.hinst = 0;
|
|---|
| 818 | ti.lpszText = (LPWSTR)lParam;
|
|---|
| 819 | SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW,
|
|---|
| 820 | 0, (LPARAM)&ti);
|
|---|
| 821 | }
|
|---|
| 822 |
|
|---|
| 823 | return 0;
|
|---|
| 824 | }
|
|---|
| 825 |
|
|---|
| 826 |
|
|---|
| 827 | inline static LRESULT
|
|---|
| 828 | STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
|
|---|
| 829 | {
|
|---|
| 830 | BOOL bOld = infoPtr->bUnicode;
|
|---|
| 831 |
|
|---|
| 832 | TRACE("(0x%x)\n", (BOOL)wParam);
|
|---|
| 833 | infoPtr->bUnicode = (BOOL)wParam;
|
|---|
| 834 |
|
|---|
| 835 | return bOld;
|
|---|
| 836 | }
|
|---|
| 837 |
|
|---|
| 838 |
|
|---|
| 839 | static LRESULT
|
|---|
| 840 | STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 841 | {
|
|---|
| 842 | NMHDR nmhdr;
|
|---|
| 843 |
|
|---|
| 844 | TRACE("(is simple: %d)\n", wParam);
|
|---|
| 845 | if (infoPtr->simple == wParam) /* no need to change */
|
|---|
| 846 | return TRUE;
|
|---|
| 847 |
|
|---|
| 848 | infoPtr->simple = (BOOL)wParam;
|
|---|
| 849 |
|
|---|
| 850 | /* send notification */
|
|---|
| 851 | nmhdr.hwndFrom = hwnd;
|
|---|
| 852 | nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
|
|---|
| 853 | nmhdr.code = SBN_SIMPLEMODECHANGE;
|
|---|
| 854 | SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
|
|---|
| 855 | InvalidateRect(hwnd, NULL, FALSE);
|
|---|
| 856 | return TRUE;
|
|---|
| 857 | }
|
|---|
| 858 |
|
|---|
| 859 |
|
|---|
| 860 | static LRESULT
|
|---|
| 861 | STATUSBAR_WMCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 862 | {
|
|---|
| 863 | LPCREATESTRUCTA lpCreate = (LPCREATESTRUCTA)lParam;
|
|---|
| 864 | NONCLIENTMETRICSA nclm;
|
|---|
| 865 | DWORD dwStyle;
|
|---|
| 866 | RECT rect;
|
|---|
| 867 | int width, len;
|
|---|
| 868 | HDC hdc;
|
|---|
| 869 | STATUSWINDOWINFO *infoPtr;
|
|---|
| 870 |
|
|---|
| 871 | TRACE("\n");
|
|---|
| 872 | #ifdef __WIN32OS2__
|
|---|
| 873 | infoPtr = (STATUSWINDOWINFO*)initControl(hwnd,sizeof(STATUSWINDOWINFO));
|
|---|
| 874 | #else
|
|---|
| 875 | infoPtr = (STATUSWINDOWINFO*)COMCTL32_Alloc (sizeof(STATUSWINDOWINFO));
|
|---|
| 876 | #endif
|
|---|
| 877 | SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
|
|---|
| 878 |
|
|---|
| 879 | infoPtr->hwndParent = lpCreate->hwndParent;
|
|---|
| 880 | infoPtr->numParts = 1;
|
|---|
| 881 | infoPtr->parts = 0;
|
|---|
| 882 | infoPtr->simple = FALSE;
|
|---|
| 883 | infoPtr->clrBk = CLR_DEFAULT;
|
|---|
| 884 | infoPtr->hFont = 0;
|
|---|
| 885 |
|
|---|
| 886 | /* TODO: send unicode parent notification query (WM_QUERYFORMAT) here */
|
|---|
| 887 |
|
|---|
| 888 | GetClientRect (hwnd, &rect);
|
|---|
| 889 | InvalidateRect (hwnd, &rect, 0);
|
|---|
| 890 | UpdateWindow(hwnd);
|
|---|
| 891 |
|
|---|
| 892 | nclm.cbSize = sizeof(NONCLIENTMETRICSA);
|
|---|
| 893 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0);
|
|---|
| 894 | infoPtr->hDefaultFont = CreateFontIndirectA (&nclm.lfStatusFont);
|
|---|
| 895 |
|
|---|
| 896 | /* initialize simple case */
|
|---|
| 897 | infoPtr->part0.bound = rect;
|
|---|
| 898 | infoPtr->part0.text = 0;
|
|---|
| 899 | infoPtr->part0.x = 0;
|
|---|
| 900 | infoPtr->part0.style = 0;
|
|---|
| 901 | infoPtr->part0.hIcon = 0;
|
|---|
| 902 |
|
|---|
| 903 | /* initialize first part */
|
|---|
| 904 | infoPtr->parts = COMCTL32_Alloc (sizeof(STATUSWINDOWPART));
|
|---|
| 905 | infoPtr->parts[0].bound = rect;
|
|---|
| 906 | infoPtr->parts[0].text = 0;
|
|---|
| 907 | infoPtr->parts[0].x = -1;
|
|---|
| 908 | infoPtr->parts[0].style = 0;
|
|---|
| 909 | infoPtr->parts[0].hIcon = 0;
|
|---|
| 910 |
|
|---|
| 911 | if (IsWindowUnicode (hwnd)) {
|
|---|
| 912 | infoPtr->bUnicode = TRUE;
|
|---|
| 913 | if (lpCreate->lpszName &&
|
|---|
| 914 | (len = strlenW ((LPCWSTR)lpCreate->lpszName))) {
|
|---|
| 915 | infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
|
|---|
| 916 | strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
|
|---|
| 917 | }
|
|---|
| 918 | }
|
|---|
| 919 | else {
|
|---|
| 920 | if (lpCreate->lpszName &&
|
|---|
| 921 | (len = strlen((LPCSTR)lpCreate->lpszName))) {
|
|---|
| 922 | DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 );
|
|---|
| 923 | infoPtr->parts[0].text = COMCTL32_Alloc (lenW*sizeof(WCHAR));
|
|---|
| 924 | MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1,
|
|---|
| 925 | infoPtr->parts[0].text, lenW );
|
|---|
| 926 | }
|
|---|
| 927 | }
|
|---|
| 928 |
|
|---|
| 929 | dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
|
|---|
| 930 |
|
|---|
| 931 | #ifndef __WIN32OS2__
|
|---|
| 932 | /* statusbars on managed windows should not have SIZEGRIP style */
|
|---|
| 933 | if ((dwStyle & SBARS_SIZEGRIP) && lpCreate->hwndParent)
|
|---|
| 934 | if (GetWindowLongA(lpCreate->hwndParent, GWL_EXSTYLE) & WS_EX_MANAGED)
|
|---|
| 935 | SetWindowLongA (hwnd, GWL_STYLE, dwStyle & ~SBARS_SIZEGRIP);
|
|---|
| 936 | #endif
|
|---|
| 937 | if ((hdc = GetDC (0))) {
|
|---|
| 938 | TEXTMETRICA tm;
|
|---|
| 939 | HFONT hOldFont;
|
|---|
| 940 |
|
|---|
| 941 | hOldFont = SelectObject (hdc,infoPtr->hDefaultFont);
|
|---|
| 942 | GetTextMetricsA(hdc, &tm);
|
|---|
| 943 | infoPtr->textHeight = tm.tmHeight;
|
|---|
| 944 | SelectObject (hdc, hOldFont);
|
|---|
| 945 | ReleaseDC(0, hdc);
|
|---|
| 946 | }
|
|---|
| 947 |
|
|---|
| 948 | if (dwStyle & SBT_TOOLTIPS) {
|
|---|
| 949 | infoPtr->hwndToolTip =
|
|---|
| 950 | CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
|
|---|
| 951 | CW_USEDEFAULT, CW_USEDEFAULT,
|
|---|
| 952 | CW_USEDEFAULT, CW_USEDEFAULT,
|
|---|
| 953 | hwnd, 0,
|
|---|
| 954 | GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
|
|---|
| 955 |
|
|---|
| 956 | if (infoPtr->hwndToolTip) {
|
|---|
| 957 | NMTOOLTIPSCREATED nmttc;
|
|---|
| 958 |
|
|---|
| 959 | nmttc.hdr.hwndFrom = hwnd;
|
|---|
| 960 | nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
|
|---|
| 961 | nmttc.hdr.code = NM_TOOLTIPSCREATED;
|
|---|
| 962 | nmttc.hwndToolTips = infoPtr->hwndToolTip;
|
|---|
| 963 |
|
|---|
| 964 | SendMessageA (lpCreate->hwndParent, WM_NOTIFY,
|
|---|
| 965 | (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc);
|
|---|
| 966 | }
|
|---|
| 967 | }
|
|---|
| 968 |
|
|---|
| 969 | if (!dwStyle & CCS_NORESIZE) /* don't resize wnd if it doesn't want it ! */
|
|---|
| 970 | {
|
|---|
| 971 | GetClientRect (GetParent (hwnd), &rect);
|
|---|
| 972 | width = rect.right - rect.left;
|
|---|
| 973 | infoPtr->height = infoPtr->textHeight + 4 + VERT_BORDER;
|
|---|
| 974 | SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1,
|
|---|
| 975 | width, infoPtr->height, SWP_NOZORDER);
|
|---|
| 976 | STATUSBAR_SetPartBounds (infoPtr, hwnd);
|
|---|
| 977 | }
|
|---|
| 978 |
|
|---|
| 979 | return 0;
|
|---|
| 980 | }
|
|---|
| 981 |
|
|---|
| 982 |
|
|---|
| 983 | static LRESULT
|
|---|
| 984 | STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
|---|
| 985 | {
|
|---|
| 986 | int i;
|
|---|
| 987 |
|
|---|
| 988 | TRACE("\n");
|
|---|
| 989 | for (i = 0; i < infoPtr->numParts; i++) {
|
|---|
| 990 | if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))
|
|---|
| 991 | COMCTL32_Free (infoPtr->parts[i].text);
|
|---|
| 992 | }
|
|---|
| 993 | if (infoPtr->part0.text && !(infoPtr->part0.style & SBT_OWNERDRAW))
|
|---|
| 994 | COMCTL32_Free (infoPtr->part0.text);
|
|---|
| 995 | COMCTL32_Free (infoPtr->parts);
|
|---|
| 996 |
|
|---|
| 997 | /* delete default font */
|
|---|
| 998 | if (infoPtr->hDefaultFont)
|
|---|
| 999 | DeleteObject (infoPtr->hDefaultFont);
|
|---|
| 1000 |
|
|---|
| 1001 | /* delete tool tip control */
|
|---|
| 1002 | if (infoPtr->hwndToolTip)
|
|---|
| 1003 | DestroyWindow (infoPtr->hwndToolTip);
|
|---|
| 1004 |
|
|---|
| 1005 | COMCTL32_Free (infoPtr);
|
|---|
| 1006 | SetWindowLongA(hwnd, 0, 0);
|
|---|
| 1007 | return 0;
|
|---|
| 1008 | }
|
|---|
| 1009 |
|
|---|
| 1010 |
|
|---|
| 1011 | static inline LRESULT
|
|---|
| 1012 | STATUSBAR_WMGetFont (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
|---|
| 1013 | {
|
|---|
| 1014 | TRACE("\n");
|
|---|
| 1015 | return infoPtr->hFont? infoPtr->hFont : infoPtr->hDefaultFont;
|
|---|
| 1016 | }
|
|---|
| 1017 |
|
|---|
| 1018 |
|
|---|
| 1019 | /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
|
|---|
| 1020 | * of the first part only (usual behaviour) */
|
|---|
| 1021 | static LRESULT
|
|---|
| 1022 | STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 1023 | {
|
|---|
| 1024 | INT len;
|
|---|
| 1025 |
|
|---|
| 1026 | TRACE("\n");
|
|---|
| 1027 | if (!(infoPtr->parts[0].text))
|
|---|
| 1028 | return 0;
|
|---|
| 1029 | if (infoPtr->bUnicode)
|
|---|
| 1030 | len = strlenW (infoPtr->parts[0].text);
|
|---|
| 1031 | else
|
|---|
| 1032 | len = WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, NULL, 0, NULL, NULL )-1;
|
|---|
| 1033 |
|
|---|
| 1034 | if (wParam > len) {
|
|---|
| 1035 | if (infoPtr->bUnicode)
|
|---|
| 1036 | strcpyW ((LPWSTR)lParam, infoPtr->parts[0].text);
|
|---|
| 1037 | else
|
|---|
| 1038 | WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1,
|
|---|
| 1039 | (LPSTR)lParam, len+1, NULL, NULL );
|
|---|
| 1040 | return len;
|
|---|
| 1041 | }
|
|---|
| 1042 |
|
|---|
| 1043 | return -1;
|
|---|
| 1044 | }
|
|---|
| 1045 |
|
|---|
| 1046 |
|
|---|
| 1047 | inline static LRESULT
|
|---|
| 1048 | STATUSBAR_WMMouseMove (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 1049 | {
|
|---|
| 1050 | if (infoPtr->hwndToolTip)
|
|---|
| 1051 | STATUSBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
|
|---|
| 1052 | WM_MOUSEMOVE, wParam, lParam);
|
|---|
| 1053 | return 0;
|
|---|
| 1054 | }
|
|---|
| 1055 |
|
|---|
| 1056 |
|
|---|
| 1057 | static LRESULT
|
|---|
| 1058 | STATUSBAR_WMNCHitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 1059 | {
|
|---|
| 1060 | if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) {
|
|---|
| 1061 | RECT rect;
|
|---|
| 1062 | POINT pt;
|
|---|
| 1063 |
|
|---|
| 1064 | GetClientRect (hwnd, &rect);
|
|---|
| 1065 |
|
|---|
| 1066 | pt.x = (INT)LOWORD(lParam);
|
|---|
| 1067 | pt.y = (INT)HIWORD(lParam);
|
|---|
| 1068 | ScreenToClient (hwnd, &pt);
|
|---|
| 1069 |
|
|---|
| 1070 | rect.left = rect.right - 13;
|
|---|
| 1071 | rect.top += 2;
|
|---|
| 1072 |
|
|---|
| 1073 | if (PtInRect (&rect, pt))
|
|---|
| 1074 | return HTBOTTOMRIGHT;
|
|---|
| 1075 | }
|
|---|
| 1076 |
|
|---|
| 1077 | /* FIXME: instead check result in StatusWindowProc and call if needed ? */
|
|---|
| 1078 | return DefWindowProcA (hwnd, WM_NCHITTEST, wParam, lParam);
|
|---|
| 1079 | }
|
|---|
| 1080 |
|
|---|
| 1081 |
|
|---|
| 1082 | static inline LRESULT
|
|---|
| 1083 | STATUSBAR_WMNCLButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 1084 | {
|
|---|
| 1085 | TRACE("\n");
|
|---|
| 1086 | PostMessageA (GetParent (hwnd), WM_NCLBUTTONDOWN, wParam, lParam);
|
|---|
| 1087 | return 0;
|
|---|
| 1088 | }
|
|---|
| 1089 |
|
|---|
| 1090 |
|
|---|
| 1091 | static inline LRESULT
|
|---|
| 1092 | STATUSBAR_WMNCLButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 1093 | {
|
|---|
| 1094 | TRACE("\n");
|
|---|
| 1095 | PostMessageA (GetParent (hwnd), WM_NCLBUTTONUP, wParam, lParam);
|
|---|
| 1096 | return 0;
|
|---|
| 1097 | }
|
|---|
| 1098 |
|
|---|
| 1099 |
|
|---|
| 1100 | static LRESULT
|
|---|
| 1101 | STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
|
|---|
| 1102 | {
|
|---|
| 1103 | HDC hdc;
|
|---|
| 1104 | PAINTSTRUCT ps;
|
|---|
| 1105 |
|
|---|
| 1106 | TRACE("\n");
|
|---|
| 1107 | hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
|
|---|
| 1108 | STATUSBAR_Refresh (infoPtr, hwnd, hdc);
|
|---|
| 1109 | if (!wParam)
|
|---|
| 1110 | EndPaint (hwnd, &ps);
|
|---|
| 1111 |
|
|---|
| 1112 | return 0;
|
|---|
| 1113 | }
|
|---|
| 1114 |
|
|---|
| 1115 |
|
|---|
| 1116 | static LRESULT
|
|---|
| 1117 | STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 1118 | {
|
|---|
| 1119 | infoPtr->hFont = (HFONT)wParam;
|
|---|
| 1120 | TRACE("%04x\n", infoPtr->hFont);
|
|---|
| 1121 | #ifdef __WIN32OS2__
|
|---|
| 1122 | if (LOWORD(lParam) == TRUE)
|
|---|
| 1123 | {
|
|---|
| 1124 | HDC hdc = GetDC (hwnd);
|
|---|
| 1125 | TEXTMETRICA tm;
|
|---|
| 1126 | HFONT hOldFont;
|
|---|
| 1127 |
|
|---|
| 1128 | hOldFont = SelectObject(hdc,infoPtr->hFont);
|
|---|
| 1129 | GetTextMetricsA(hdc,&tm);
|
|---|
| 1130 | infoPtr->textHeight = tm.tmHeight+tm.tmExternalLeading;
|
|---|
| 1131 | SelectObject(hdc,hOldFont);
|
|---|
| 1132 |
|
|---|
| 1133 | //CB: todo: move window
|
|---|
| 1134 |
|
|---|
| 1135 | STATUSBAR_Refresh (infoPtr, hwnd, hdc);
|
|---|
| 1136 | ReleaseDC (hwnd, hdc);
|
|---|
| 1137 | }
|
|---|
| 1138 | #else
|
|---|
| 1139 | if (LOWORD(lParam) == TRUE)
|
|---|
| 1140 | InvalidateRect(hwnd, NULL, FALSE);
|
|---|
| 1141 | #endif
|
|---|
| 1142 |
|
|---|
| 1143 | return 0;
|
|---|
| 1144 | }
|
|---|
| 1145 |
|
|---|
| 1146 |
|
|---|
| 1147 | static LRESULT
|
|---|
| 1148 | STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 1149 | {
|
|---|
| 1150 | STATUSWINDOWPART *part;
|
|---|
| 1151 | int len;
|
|---|
| 1152 |
|
|---|
| 1153 | TRACE("\n");
|
|---|
| 1154 | if (infoPtr->numParts == 0)
|
|---|
| 1155 | return FALSE;
|
|---|
| 1156 |
|
|---|
| 1157 | part = &infoPtr->parts[0];
|
|---|
| 1158 | /* duplicate string */
|
|---|
| 1159 | if (part->text)
|
|---|
| 1160 | COMCTL32_Free (part->text);
|
|---|
| 1161 | part->text = 0;
|
|---|
| 1162 | if (infoPtr->bUnicode) {
|
|---|
| 1163 | if (lParam && (len = strlenW((LPCWSTR)lParam))) {
|
|---|
| 1164 | part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
|
|---|
| 1165 | strcpyW (part->text, (LPCWSTR)lParam);
|
|---|
| 1166 | }
|
|---|
| 1167 | }
|
|---|
| 1168 | else {
|
|---|
| 1169 | if (lParam && (len = lstrlenA((LPCSTR)lParam))) {
|
|---|
| 1170 | DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, NULL, 0 );
|
|---|
| 1171 | part->text = COMCTL32_Alloc (lenW*sizeof(WCHAR));
|
|---|
| 1172 | MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, part->text, lenW );
|
|---|
| 1173 | }
|
|---|
| 1174 | }
|
|---|
| 1175 |
|
|---|
| 1176 | InvalidateRect(hwnd, &part->bound, FALSE);
|
|---|
| 1177 |
|
|---|
| 1178 | return TRUE;
|
|---|
| 1179 | }
|
|---|
| 1180 |
|
|---|
| 1181 |
|
|---|
| 1182 | static LRESULT
|
|---|
| 1183 | STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 1184 | {
|
|---|
| 1185 | INT width, x, y, flags;
|
|---|
| 1186 | RECT parent_rect;
|
|---|
| 1187 | DWORD dwStyle;
|
|---|
| 1188 |
|
|---|
| 1189 | /* Need to resize width to match parent */
|
|---|
| 1190 | flags = (INT) wParam;
|
|---|
| 1191 |
|
|---|
| 1192 | TRACE("flags %04x\n", flags);
|
|---|
| 1193 | /* FIXME for flags =
|
|---|
| 1194 | * SIZE_MAXIMIZED, SIZE_MAXSHOW, SIZE_MINIMIZED, SIZE_RESTORED
|
|---|
| 1195 | */
|
|---|
| 1196 |
|
|---|
| 1197 | dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
|
|---|
| 1198 | if (!dwStyle & CCS_NORESIZE) /* don't resize wnd if it doesn't want it ! */
|
|---|
| 1199 | {
|
|---|
| 1200 | if (flags == SIZE_RESTORED) {
|
|---|
| 1201 | /* width and height don't apply */
|
|---|
| 1202 | GetClientRect (infoPtr->hwndParent, &parent_rect);
|
|---|
| 1203 | width = parent_rect.right - parent_rect.left;
|
|---|
| 1204 | x = parent_rect.left;
|
|---|
| 1205 | y = parent_rect.bottom - infoPtr->height;
|
|---|
| 1206 | MoveWindow (hwnd, parent_rect.left,
|
|---|
| 1207 | parent_rect.bottom - infoPtr->height,
|
|---|
| 1208 | width, infoPtr->height, TRUE);
|
|---|
| 1209 | STATUSBAR_SetPartBounds (infoPtr, hwnd);
|
|---|
| 1210 | }
|
|---|
| 1211 | return 0; /* FIXME: ok to return here ? */
|
|---|
| 1212 | }
|
|---|
| 1213 |
|
|---|
| 1214 | /* FIXME: instead check result in StatusWindowProc and call if needed ? */
|
|---|
| 1215 | return DefWindowProcA (hwnd, WM_SIZE, wParam, lParam);
|
|---|
| 1216 | }
|
|---|
| 1217 |
|
|---|
| 1218 |
|
|---|
| 1219 | static LRESULT
|
|---|
| 1220 | STATUSBAR_SendNotify (HWND hwnd, UINT code)
|
|---|
| 1221 | {
|
|---|
| 1222 | NMHDR nmhdr;
|
|---|
| 1223 |
|
|---|
| 1224 | TRACE("code %04x\n", code);
|
|---|
| 1225 | nmhdr.hwndFrom = hwnd;
|
|---|
| 1226 | nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
|
|---|
| 1227 | nmhdr.code = code;
|
|---|
| 1228 | SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
|
|---|
| 1229 | return 0;
|
|---|
| 1230 | }
|
|---|
| 1231 |
|
|---|
| 1232 |
|
|---|
| 1233 |
|
|---|
| 1234 | static LRESULT WINAPI
|
|---|
| 1235 | StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|---|
| 1236 | {
|
|---|
| 1237 | STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
|
|---|
| 1238 |
|
|---|
| 1239 | TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hwnd, msg, wParam, lParam);
|
|---|
| 1240 | if (!(infoPtr) && (msg != WM_CREATE))
|
|---|
| 1241 | return DefWindowProcA (hwnd, msg, wParam, lParam);
|
|---|
| 1242 |
|
|---|
| 1243 | switch (msg) {
|
|---|
| 1244 | case SB_GETBORDERS:
|
|---|
| 1245 | return STATUSBAR_GetBorders (lParam);
|
|---|
| 1246 |
|
|---|
| 1247 | case SB_GETICON:
|
|---|
| 1248 | return STATUSBAR_GetIcon (infoPtr, hwnd, wParam);
|
|---|
| 1249 |
|
|---|
| 1250 | case SB_GETPARTS:
|
|---|
| 1251 | return STATUSBAR_GetParts (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1252 |
|
|---|
| 1253 | case SB_GETRECT:
|
|---|
| 1254 | return STATUSBAR_GetRect (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1255 |
|
|---|
| 1256 | case SB_GETTEXTA:
|
|---|
| 1257 | return STATUSBAR_GetTextA (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1258 |
|
|---|
| 1259 | case SB_GETTEXTW:
|
|---|
| 1260 | return STATUSBAR_GetTextW (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1261 |
|
|---|
| 1262 | case SB_GETTEXTLENGTHA:
|
|---|
| 1263 | case SB_GETTEXTLENGTHW:
|
|---|
| 1264 | return STATUSBAR_GetTextLength (infoPtr, hwnd, wParam);
|
|---|
| 1265 |
|
|---|
| 1266 | case SB_GETTIPTEXTA:
|
|---|
| 1267 | return STATUSBAR_GetTipTextA (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1268 |
|
|---|
| 1269 | case SB_GETTIPTEXTW:
|
|---|
| 1270 | return STATUSBAR_GetTipTextW (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1271 |
|
|---|
| 1272 | case SB_GETUNICODEFORMAT:
|
|---|
| 1273 | return STATUSBAR_GetUnicodeFormat (infoPtr, hwnd);
|
|---|
| 1274 |
|
|---|
| 1275 | case SB_ISSIMPLE:
|
|---|
| 1276 | return STATUSBAR_IsSimple (infoPtr, hwnd);
|
|---|
| 1277 |
|
|---|
| 1278 | case SB_SETBKCOLOR:
|
|---|
| 1279 | return STATUSBAR_SetBkColor (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1280 |
|
|---|
| 1281 | case SB_SETICON:
|
|---|
| 1282 | return STATUSBAR_SetIcon (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1283 |
|
|---|
| 1284 | case SB_SETMINHEIGHT:
|
|---|
| 1285 | return STATUSBAR_SetMinHeight (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1286 |
|
|---|
| 1287 | case SB_SETPARTS:
|
|---|
| 1288 | return STATUSBAR_SetParts (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1289 |
|
|---|
| 1290 | case SB_SETTEXTA:
|
|---|
| 1291 | return STATUSBAR_SetTextA (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1292 |
|
|---|
| 1293 | case SB_SETTEXTW:
|
|---|
| 1294 | return STATUSBAR_SetTextW (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1295 |
|
|---|
| 1296 | case SB_SETTIPTEXTA:
|
|---|
| 1297 | return STATUSBAR_SetTipTextA (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1298 |
|
|---|
| 1299 | case SB_SETTIPTEXTW:
|
|---|
| 1300 | return STATUSBAR_SetTipTextW (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1301 |
|
|---|
| 1302 | case SB_SETUNICODEFORMAT:
|
|---|
| 1303 | return STATUSBAR_SetUnicodeFormat (infoPtr, hwnd, wParam);
|
|---|
| 1304 |
|
|---|
| 1305 | case SB_SIMPLE:
|
|---|
| 1306 | return STATUSBAR_Simple (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1307 |
|
|---|
| 1308 |
|
|---|
| 1309 | case WM_CREATE:
|
|---|
| 1310 | return STATUSBAR_WMCreate (hwnd, wParam, lParam);
|
|---|
| 1311 |
|
|---|
| 1312 | case WM_DESTROY:
|
|---|
| 1313 | return STATUSBAR_WMDestroy (infoPtr, hwnd);
|
|---|
| 1314 |
|
|---|
| 1315 | case WM_GETFONT:
|
|---|
| 1316 | return STATUSBAR_WMGetFont (infoPtr, hwnd);
|
|---|
| 1317 |
|
|---|
| 1318 | case WM_GETTEXT:
|
|---|
| 1319 | return STATUSBAR_WMGetText (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1320 |
|
|---|
| 1321 | case WM_GETTEXTLENGTH:
|
|---|
| 1322 | return STATUSBAR_GetTextLength (infoPtr, hwnd, 0);
|
|---|
| 1323 |
|
|---|
| 1324 | case WM_LBUTTONDBLCLK:
|
|---|
| 1325 | return STATUSBAR_SendNotify (hwnd, NM_DBLCLK);
|
|---|
| 1326 |
|
|---|
| 1327 | case WM_LBUTTONUP:
|
|---|
| 1328 | return STATUSBAR_SendNotify (hwnd, NM_CLICK);
|
|---|
| 1329 |
|
|---|
| 1330 | case WM_MOUSEMOVE:
|
|---|
| 1331 | return STATUSBAR_WMMouseMove (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1332 |
|
|---|
| 1333 | case WM_NCHITTEST:
|
|---|
| 1334 | return STATUSBAR_WMNCHitTest (hwnd, wParam, lParam);
|
|---|
| 1335 |
|
|---|
| 1336 | case WM_NCLBUTTONDOWN:
|
|---|
| 1337 | return STATUSBAR_WMNCLButtonDown (hwnd, wParam, lParam);
|
|---|
| 1338 |
|
|---|
| 1339 | case WM_NCLBUTTONUP:
|
|---|
| 1340 | return STATUSBAR_WMNCLButtonUp (hwnd, wParam, lParam);
|
|---|
| 1341 |
|
|---|
| 1342 | case WM_PAINT:
|
|---|
| 1343 | return STATUSBAR_WMPaint (infoPtr, hwnd, wParam);
|
|---|
| 1344 |
|
|---|
| 1345 | case WM_RBUTTONDBLCLK:
|
|---|
| 1346 | return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK);
|
|---|
| 1347 |
|
|---|
| 1348 | case WM_RBUTTONUP:
|
|---|
| 1349 | return STATUSBAR_SendNotify (hwnd, NM_RCLICK);
|
|---|
| 1350 |
|
|---|
| 1351 | case WM_SETFONT:
|
|---|
| 1352 | return STATUSBAR_WMSetFont (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1353 |
|
|---|
| 1354 | case WM_SETTEXT:
|
|---|
| 1355 | return STATUSBAR_WMSetText (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1356 |
|
|---|
| 1357 | case WM_SIZE:
|
|---|
| 1358 | return STATUSBAR_WMSize (infoPtr, hwnd, wParam, lParam);
|
|---|
| 1359 |
|
|---|
| 1360 | default:
|
|---|
| 1361 | if (msg >= WM_USER)
|
|---|
| 1362 | ERR("unknown msg %04x wp=%04x lp=%08lx\n",
|
|---|
| 1363 | msg, wParam, lParam);
|
|---|
| 1364 | #ifdef __WIN32OS2__
|
|---|
| 1365 | return defComCtl32ProcA (hwnd, msg, wParam, lParam);
|
|---|
| 1366 | #else
|
|---|
| 1367 | return DefWindowProcA (hwnd, msg, wParam, lParam);
|
|---|
| 1368 | #endif
|
|---|
| 1369 | }
|
|---|
| 1370 | return 0;
|
|---|
| 1371 | }
|
|---|
| 1372 |
|
|---|
| 1373 |
|
|---|
| 1374 | /***********************************************************************
|
|---|
| 1375 | * STATUS_Register [Internal]
|
|---|
| 1376 | *
|
|---|
| 1377 | * Registers the status window class.
|
|---|
| 1378 | */
|
|---|
| 1379 |
|
|---|
| 1380 | VOID
|
|---|
| 1381 | STATUS_Register (void)
|
|---|
| 1382 | {
|
|---|
| 1383 | WNDCLASSA wndClass;
|
|---|
| 1384 |
|
|---|
| 1385 | ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
|---|
| 1386 | wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
|
|---|
| 1387 | wndClass.lpfnWndProc = (WNDPROC)StatusWindowProc;
|
|---|
| 1388 | wndClass.cbClsExtra = 0;
|
|---|
| 1389 | wndClass.cbWndExtra = sizeof(STATUSWINDOWINFO *);
|
|---|
| 1390 | wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
|---|
| 1391 | wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
|
|---|
| 1392 | wndClass.lpszClassName = STATUSCLASSNAMEA;
|
|---|
| 1393 |
|
|---|
| 1394 | RegisterClassA (&wndClass);
|
|---|
| 1395 | }
|
|---|
| 1396 |
|
|---|
| 1397 |
|
|---|
| 1398 | /***********************************************************************
|
|---|
| 1399 | * STATUS_Unregister [Internal]
|
|---|
| 1400 | *
|
|---|
| 1401 | * Unregisters the status window class.
|
|---|
| 1402 | */
|
|---|
| 1403 |
|
|---|
| 1404 | VOID
|
|---|
| 1405 | STATUS_Unregister (void)
|
|---|
| 1406 | {
|
|---|
| 1407 | UnregisterClassA (STATUSCLASSNAMEA, (HINSTANCE)NULL);
|
|---|
| 1408 | }
|
|---|
| 1409 |
|
|---|