Changeset 6644 for trunk/src/comctl32/status.c
- Timestamp:
- Sep 5, 2001, 2:05:03 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/status.c
r6391 r6644 1 /* $Id: status.c,v 1.23 2001-09-05 12:05:02 bird Exp $ */ 1 2 /* 2 3 * Interface code to StatusWindow widget/control … … 26 27 typedef struct 27 28 { 28 INT 29 INT 30 RECT 31 LPWSTR 29 INT x; 30 INT style; 31 RECT bound; 32 LPWSTR text; 32 33 HICON hIcon; 33 34 } STATUSWINDOWPART; … … 48 49 COLORREF clrBk; /* background color */ 49 50 BOOL bUnicode; /* unicode flag */ 50 STATUSWINDOWPART part0;/* simple window */51 STATUSWINDOWPART part0; /* simple window */ 51 52 STATUSWINDOWPART *parts; 52 53 } STATUSWINDOWINFO; … … 93 94 SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW)); 94 95 for (i = 1; i < 11; i += 4) { 95 96 97 98 99 96 MoveToEx (hdc, pt.x - i, pt.y, NULL); 97 LineTo (hdc, pt.x, pt.y - i); 98 99 MoveToEx (hdc, pt.x - i-1, pt.y, NULL); 100 LineTo (hdc, pt.x, pt.y - i-1); 100 101 } 101 102 102 103 SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT)); 103 104 for (i = 3; i < 13; i += 4) { 104 105 105 MoveToEx (hdc, pt.x - i, pt.y, NULL); 106 LineTo (hdc, pt.x, pt.y - i); 106 107 } 107 108 … … 110 111 111 112 112 static void 113 static void 113 114 STATUSBAR_DrawPart (HDC hdc, STATUSWINDOWPART *part) 114 115 { … … 126 127 /* draw the icon */ 127 128 if (part->hIcon) { 128 129 130 131 132 129 INT cy = r.bottom - r.top; 130 131 r.left += 2; 132 DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL); 133 r.left += cy; 133 134 } 134 135 … … 139 140 UINT align = DT_LEFT; 140 141 if (*p == L'\t') { 141 142 143 144 145 146 147 142 p++; 143 align = DT_CENTER; 144 145 if (*p == L'\t') { 146 p++; 147 align = DT_RIGHT; 148 } 148 149 } 149 150 r.left += 3; … … 151 152 DrawTextW (hdc, p, -1, &r, align|DT_VCENTER|DT_SINGLELINE); 152 153 if (oldbkmode != TRANSPARENT) 153 154 SetBkMode(hdc, oldbkmode); 154 155 } 155 156 } … … 169 170 170 171 if (infoPtr->clrBk != CLR_DEFAULT) 171 172 hbrBk = CreateSolidBrush (infoPtr->clrBk); 172 173 else 173 174 hbrBk = GetSysColorBrush (COLOR_3DFACE); 174 175 FillRect(hdc, &part->bound, hbrBk); 175 176 … … 177 178 178 179 if (part->style & SBT_OWNERDRAW) { 179 180 181 182 183 184 185 186 187 188 180 DRAWITEMSTRUCT dis; 181 182 dis.CtlID = GetWindowLongA (hwnd, GWL_ID); 183 dis.itemID = itemID; 184 dis.hwndItem = hwnd; 185 dis.hDC = hdc; 186 dis.rcItem = part->bound; 187 dis.itemData = (INT)part->text; 188 SendMessageA (GetParent (hwnd), WM_DRAWITEM, 189 (WPARAM)dis.CtlID, (LPARAM)&dis); 189 190 } else 190 191 STATUSBAR_DrawPart (hdc, part); 191 192 192 193 SelectObject (hdc, hOldFont); 193 194 194 195 if (infoPtr->clrBk != CLR_DEFAULT) 195 196 DeleteObject (hbrBk); 196 197 197 198 if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) { 198 199 200 201 199 RECT rect; 200 201 GetClientRect (hwnd, &rect); 202 STATUSBAR_DrawSizeGrip (hdc, &rect); 202 203 } 203 204 } … … 221 222 222 223 if (infoPtr->clrBk != CLR_DEFAULT) 223 224 hbrBk = CreateSolidBrush (infoPtr->clrBk); 224 225 else 225 226 hbrBk = GetSysColorBrush (COLOR_3DFACE); 226 227 FillRect(hdc, &rect, hbrBk); 227 228 … … 229 230 230 231 if (infoPtr->simple) { 231 232 STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->part0, hdc, 0); 232 233 } else { 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 234 for (i = 0; i < infoPtr->numParts; i++) { 235 if (infoPtr->parts[i].style & SBT_OWNERDRAW) { 236 DRAWITEMSTRUCT dis; 237 238 dis.CtlID = GetWindowLongA (hwnd, GWL_ID); 239 dis.itemID = i; 240 dis.hwndItem = hwnd; 241 dis.hDC = hdc; 242 dis.rcItem = infoPtr->parts[i].bound; 243 dis.itemData = (INT)infoPtr->parts[i].text; 244 SendMessageA (GetParent (hwnd), WM_DRAWITEM, 245 (WPARAM)dis.CtlID, (LPARAM)&dis); 246 } else 247 STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->parts[i], hdc, i); 248 } 248 249 } 249 250 … … 251 252 252 253 if (infoPtr->clrBk != CLR_DEFAULT) 253 254 DeleteObject (hbrBk); 254 255 255 256 if (GetWindowLongA(hwnd, GWL_STYLE) & SBARS_SIZEGRIP) 256 257 STATUSBAR_DrawSizeGrip (hdc, &rect); 257 258 258 259 return TRUE; … … 265 266 STATUSWINDOWPART *part; 266 267 RECT rect, *r; 267 int 268 int i; 268 269 269 270 /* get our window size */ … … 278 279 /* set bounds for non-simple rectangles */ 279 280 for (i = 0; i < infoPtr->numParts; i++) { 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 281 part = &infoPtr->parts[i]; 282 r = &infoPtr->parts[i].bound; 283 r->top = rect.top; 284 r->bottom = rect.bottom; 285 if (i == 0) 286 r->left = 0; 287 else 288 r->left = infoPtr->parts[i-1].bound.right + HORZ_GAP; 289 if (part->x == -1) 290 r->right = rect.right; 291 else 292 r->right = part->x; 293 294 if (infoPtr->hwndToolTip) { 295 TTTOOLINFOA ti; 296 297 ti.cbSize = sizeof(TTTOOLINFOA); 298 ti.hwnd = hwnd; 299 ti.uId = i; 300 ti.rect = *r; 301 SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA, 302 0, (LPARAM)&ti); 303 } 303 304 } 304 305 } … … 307 308 static VOID 308 309 STATUSBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, 309 310 WPARAM wParam, LPARAM lParam) 310 311 { 311 312 MSG msg; … … 345 346 TRACE("%d\n", nPart); 346 347 if ((nPart < -1) || (nPart >= infoPtr->numParts)) 347 348 return 0; 348 349 349 350 if (nPart == -1) … … 365 366 parts = (LPINT) lParam; 366 367 if (parts) { 367 368 369 368 for (i = 0; i < num_parts; i++) { 369 parts[i] = infoPtr->parts[i].x; 370 } 370 371 } 371 372 return (infoPtr->numParts); … … 376 377 STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam) 377 378 { 378 int 379 int nPart; 379 380 LPRECT rect; 380 381 … … 383 384 rect = (LPRECT) lParam; 384 385 if (infoPtr->simple) 385 386 *rect = infoPtr->part0.bound; 386 387 else 387 388 *rect = infoPtr->parts[nPart].bound; 388 389 return TRUE; 389 390 } … … 400 401 TRACE("part %d\n", nPart); 401 402 if (infoPtr->simple) 402 403 part = &infoPtr->part0; 403 404 else 404 405 #ifdef __WIN32OS2__ 405 406 { 406 407 if (nPart >= infoPtr->numParts) 407 408 408 return FALSE; 409 part = &infoPtr->parts[nPart]; 409 410 } 410 411 #else 411 412 part = &infoPtr->parts[nPart]; 412 413 #endif 413 414 414 415 if (part->style & SBT_OWNERDRAW) 415 416 result = (LRESULT)part->text; 416 417 else { 417 418 DWORD len = part->text ? WideCharToMultiByte( CP_ACP, 0, part->text, -1, … … 435 436 TRACE("part %d\n", nPart); 436 437 if (infoPtr->simple) 437 438 part = &infoPtr->part0; 438 439 else 439 440 #ifdef __WIN32OS2__ 440 441 { 441 442 if (nPart >= infoPtr->numParts) 442 443 443 return FALSE; 444 part = &infoPtr->parts[nPart]; 444 445 } 445 446 #else 446 447 part = &infoPtr->parts[nPart]; 447 448 #endif 448 449 449 450 if (part->style & SBT_OWNERDRAW) 450 451 result = (LRESULT)part->text; 451 452 else { 452 453 454 455 453 result = part->text ? strlenW (part->text) : 0; 454 result |= (part->style << 16); 455 if (part->text && lParam) 456 strcpyW ((LPWSTR)lParam, part->text); 456 457 } 457 458 return result; … … 471 472 472 473 if (infoPtr->simple) 473 474 part = &infoPtr->part0; 474 475 else 475 476 #ifdef __WIN32OS2__ 476 477 { 477 478 if (nPart >= infoPtr->numParts) 478 479 479 return FALSE; 480 part = &infoPtr->parts[nPart]; 480 481 } 481 482 #else 482 483 part = &infoPtr->parts[nPart]; 483 484 #endif 484 485 485 486 if (part->text) 486 487 result = strlenW(part->text); 487 488 else 488 489 result = 0; 489 490 490 491 result |= (part->style << 16); … … 526 527 buf[0]=0; 527 528 528 529 530 531 532 529 if (infoPtr->hwndToolTip) { 530 TTTOOLINFOW ti; 531 ti.cbSize = sizeof(TTTOOLINFOW); 532 ti.hwnd = hwnd; 533 ti.uId = LOWORD(wParam); 533 534 ti.lpszText = buf; 534 535 536 535 SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti); 536 } 537 lstrcpynW(tip, buf, HIWORD(wParam)); 537 538 } 538 539 … … 575 576 576 577 if ((nPart < -1) || (nPart >= infoPtr->numParts)) 577 578 return FALSE; 578 579 579 580 TRACE("setting part %d, icon %lx\n",nPart,lParam); 580 581 581 582 if (nPart == -1) { 582 583 584 585 583 if (infoPtr->part0.hIcon == (HICON)lParam) /* same as - no redraw */ 584 return TRUE; 585 infoPtr->part0.hIcon = (HICON)lParam; 586 if (infoPtr->simple) 586 587 InvalidateRect(hwnd, &infoPtr->part0.bound, FALSE); 587 588 } else { 588 589 590 591 592 589 if (infoPtr->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */ 590 return TRUE; 591 592 infoPtr->parts[nPart].hIcon = (HICON)lParam; 593 if (!(infoPtr->simple)) 593 594 InvalidateRect(hwnd, &infoPtr->parts[nPart].bound, FALSE); 594 595 } … … 603 604 TRACE("\n"); 604 605 if (IsWindowVisible (hwnd)) { 605 606 607 608 609 610 611 612 613 614 615 616 617 606 HWND parent = GetParent (hwnd); 607 INT width, x, y; 608 RECT parent_rect; 609 610 GetClientRect (parent, &parent_rect); 611 infoPtr->height = (INT)wParam + VERT_BORDER; 612 width = parent_rect.right - parent_rect.left; 613 x = parent_rect.left; 614 y = parent_rect.bottom - infoPtr->height; 615 MoveWindow (hwnd, parent_rect.left, 616 parent_rect.bottom - infoPtr->height, 617 width, infoPtr->height, TRUE); 618 STATUSBAR_SetPartBounds (infoPtr, hwnd); 618 619 } 619 620 … … 627 628 STATUSWINDOWPART *tmp; 628 629 LPINT parts; 629 int 630 int 630 int i; 631 int oldNumParts; 631 632 632 633 TRACE("(%d,%p)\n",wParam,(LPVOID)lParam); … … 634 635 /* FIXME: should return FALSE sometimes (maybe when wParam == 0 ?) */ 635 636 if (infoPtr->simple) 636 637 infoPtr->simple = FALSE; 637 638 638 639 oldNumParts = infoPtr->numParts; … … 640 641 parts = (LPINT) lParam; 641 642 if (oldNumParts > infoPtr->numParts) { 642 643 644 645 643 for (i = infoPtr->numParts ; i < oldNumParts; i++) { 644 if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW)) 645 COMCTL32_Free (infoPtr->parts[i].text); 646 } 646 647 } 647 648 if (oldNumParts < infoPtr->numParts) { 648 649 650 651 652 653 654 649 tmp = COMCTL32_Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts); 650 for (i = 0; i < oldNumParts; i++) { 651 tmp[i] = infoPtr->parts[i]; 652 } 653 if (infoPtr->parts) 654 COMCTL32_Free (infoPtr->parts); 655 infoPtr->parts = tmp; 655 656 } 656 657 if (oldNumParts == infoPtr->numParts) { 657 658 659 660 661 662 } 663 658 for (i=0;i<oldNumParts;i++) 659 if (infoPtr->parts[i].x != parts[i]) 660 break; 661 if (i==oldNumParts) /* Unchanged? no need to redraw! */ 662 return TRUE; 663 } 664 664 665 for (i = 0; i < infoPtr->numParts; i++) 665 666 infoPtr->parts[i].x = parts[i]; 666 667 667 668 if (infoPtr->hwndToolTip) { 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 669 INT nTipCount = 670 SendMessageA (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0); 671 672 if (nTipCount < infoPtr->numParts) { 673 /* add tools */ 674 TTTOOLINFOA ti; 675 INT i; 676 677 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 678 ti.cbSize = sizeof(TTTOOLINFOA); 679 ti.hwnd = hwnd; 680 for (i = nTipCount; i < infoPtr->numParts; i++) { 681 TRACE("add tool %d\n", i); 682 ti.uId = i; 683 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA, 684 0, (LPARAM)&ti); 685 } 686 } 687 else if (nTipCount > infoPtr->numParts) { 688 /* delete tools */ 689 INT i; 690 691 for (i = nTipCount - 1; i >= infoPtr->numParts; i--) { 692 FIXME("delete tool %d\n", i); 693 } 694 } 694 695 } 695 696 STATUSBAR_SetPartBounds (infoPtr, hwnd); … … 703 704 { 704 705 STATUSWINDOWPART *part=NULL; 705 int 706 int 706 int nPart; 707 int style; 707 708 LPSTR text; 708 BOOL 709 BOOL changed = FALSE; 709 710 710 711 text = (LPSTR) lParam; … … 715 716 716 717 if (nPart==255) 717 718 part = &infoPtr->part0; 718 719 else if (!infoPtr->simple && infoPtr->parts!=NULL) 719 720 #ifdef __WIN32OS2__ 720 721 { 721 722 if (nPart >= infoPtr->numParts) 722 723 723 return FALSE; 724 part = &infoPtr->parts[nPart]; 724 725 } 725 726 #else 726 727 part = &infoPtr->parts[nPart]; 727 728 #endif 728 729 if (!part) return FALSE; 729 730 730 731 if (part->style != style) 731 732 changed = TRUE; 732 733 733 734 part->style = style; 734 735 if (style & SBT_OWNERDRAW) { 735 736 737 736 if (part->text == (LPWSTR)text) 737 return TRUE; 738 part->text = (LPWSTR)text; 738 739 } else { 739 740 741 742 740 LPWSTR ntext; 741 742 /* check if text is unchanged -> no need to redraw */ 743 if (text) { 743 744 DWORD len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 ); 744 745 LPWSTR tmptext = COMCTL32_Alloc(len*sizeof(WCHAR)); 745 746 MultiByteToWideChar( CP_ACP, 0, text, -1, tmptext, len ); 746 747 747 748 749 750 751 752 753 if (!changed && !part->text) 754 755 756 757 758 759 760 748 if (!changed && part->text && !lstrcmpW(tmptext,part->text)) { 749 COMCTL32_Free(tmptext); 750 return TRUE; 751 } 752 ntext = tmptext; 753 } else { 754 if (!changed && !part->text) 755 return TRUE; 756 ntext = 0; 757 } 758 759 if (part->text) 760 COMCTL32_Free (part->text); 761 part->text = ntext; 761 762 } 762 763 InvalidateRect(hwnd, &part->bound, FALSE); … … 780 781 TRACE("part %d -> '%s' with style %04x\n", nPart, debugstr_w(text), style); 781 782 if ((infoPtr->simple) || (infoPtr->parts==NULL) || (nPart==255)) 782 783 part = &infoPtr->part0; 783 784 else 784 785 #ifdef __WIN32OS2__ 785 786 { 786 787 if (nPart >= infoPtr->numParts) 787 788 788 return FALSE; 789 part = &infoPtr->parts[nPart]; 789 790 } 790 791 #else 791 792 part = &infoPtr->parts[nPart]; 792 793 #endif 793 794 if (!part) return FALSE; … … 801 802 if (style & SBT_OWNERDRAW) 802 803 { 803 804 part->text = text; 804 805 bRedraw = TRUE; 805 806 } else if(!text) … … 813 814 } else if(!part->text || strcmpW(part->text, text)) /* see if the new string differs from the existing string */ 814 815 { 815 816 if(part->text) COMCTL32_Free(part->text); 816 817 817 818 len = strlenW(text); 818 819 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 819 820 strcpyW(part->text, text); 820 821 bRedraw = TRUE; 821 822 } … … 833 834 TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam); 834 835 if (infoPtr->hwndToolTip) { 835 836 837 838 839 840 841 842 836 TTTOOLINFOA ti; 837 ti.cbSize = sizeof(TTTOOLINFOA); 838 ti.hwnd = hwnd; 839 ti.uId = (INT)wParam; 840 ti.hinst = 0; 841 ti.lpszText = (LPSTR)lParam; 842 SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, 843 0, (LPARAM)&ti); 843 844 } 844 845 … … 852 853 TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam); 853 854 if (infoPtr->hwndToolTip) { 854 855 856 857 858 859 860 861 855 TTTOOLINFOW ti; 856 ti.cbSize = sizeof(TTTOOLINFOW); 857 ti.hwnd = hwnd; 858 ti.uId = (INT)wParam; 859 ti.hinst = 0; 860 ti.lpszText = (LPWSTR)lParam; 861 SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 862 0, (LPARAM)&ti); 862 863 } 863 864 … … 885 886 TRACE("(is simple: %d)\n", wParam); 886 887 if (infoPtr->simple == wParam) /* no need to change */ 887 888 return TRUE; 888 889 889 890 infoPtr->simple = (BOOL)wParam; … … 905 906 NONCLIENTMETRICSA nclm; 906 907 DWORD dwStyle; 907 RECT 908 int 909 HDC 908 RECT rect; 909 int width, len; 910 HDC hdc; 910 911 STATUSWINDOWINFO *infoPtr; 911 912 … … 951 952 952 953 if (IsWindowUnicode (hwnd)) { 953 954 955 956 957 958 954 infoPtr->bUnicode = TRUE; 955 if (lpCreate->lpszName && 956 (len = strlenW ((LPCWSTR)lpCreate->lpszName))) { 957 infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 958 strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName); 959 } 959 960 } 960 961 else { 961 962 962 if (lpCreate->lpszName && 963 (len = strlen((LPCSTR)lpCreate->lpszName))) { 963 964 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 ); 964 965 infoPtr->parts[0].text = COMCTL32_Alloc (lenW*sizeof(WCHAR)); 965 966 MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, 966 967 infoPtr->parts[0].text, lenW ); 967 968 } 968 969 } 969 970 … … 977 978 #endif 978 979 if ((hdc = GetDC (0))) { 979 980 981 982 983 984 985 986 980 TEXTMETRICA tm; 981 HFONT hOldFont; 982 983 hOldFont = SelectObject (hdc,infoPtr->hDefaultFont); 984 GetTextMetricsA(hdc, &tm); 985 infoPtr->textHeight = tm.tmHeight; 986 SelectObject (hdc, hOldFont); 987 ReleaseDC(0, hdc); 987 988 } 988 989 989 990 if (dwStyle & SBT_TOOLTIPS) { 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 991 infoPtr->hwndToolTip = 992 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, 993 CW_USEDEFAULT, CW_USEDEFAULT, 994 CW_USEDEFAULT, CW_USEDEFAULT, 995 hwnd, 0, 996 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL); 997 998 if (infoPtr->hwndToolTip) { 999 NMTOOLTIPSCREATED nmttc; 1000 1001 nmttc.hdr.hwndFrom = hwnd; 1002 nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 1003 nmttc.hdr.code = NM_TOOLTIPSCREATED; 1004 nmttc.hwndToolTips = infoPtr->hwndToolTip; 1005 1006 SendMessageA (lpCreate->hwndParent, WM_NOTIFY, 1007 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc); 1008 } 1008 1009 } 1009 1010 … … 1014 1015 infoPtr->height = infoPtr->textHeight + 4 + VERT_BORDER; 1015 1016 SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1, 1016 1017 width, infoPtr->height, SWP_NOZORDER); 1017 1018 STATUSBAR_SetPartBounds (infoPtr, hwnd); 1018 1019 } … … 1025 1026 STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr, HWND hwnd) 1026 1027 { 1027 int 1028 int i; 1028 1029 1029 1030 TRACE("\n"); 1030 1031 for (i = 0; i < infoPtr->numParts; i++) { 1031 1032 1032 if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW)) 1033 COMCTL32_Free (infoPtr->parts[i].text); 1033 1034 } 1034 1035 if (infoPtr->part0.text && !(infoPtr->part0.style & SBT_OWNERDRAW)) 1035 1036 COMCTL32_Free (infoPtr->part0.text); 1036 1037 COMCTL32_Free (infoPtr->parts); 1037 1038 1038 1039 /* delete default font */ 1039 1040 if (infoPtr->hDefaultFont) 1040 1041 DeleteObject (infoPtr->hDefaultFont); 1041 1042 1042 1043 /* delete tool tip control */ 1043 1044 if (infoPtr->hwndToolTip) 1044 1045 DestroyWindow (infoPtr->hwndToolTip); 1045 1046 1046 1047 COMCTL32_Free (infoPtr); … … 1074 1075 1075 1076 if (wParam > len) { 1076 1077 1078 1077 if (infoPtr->bUnicode) 1078 strcpyW ((LPWSTR)lParam, infoPtr->parts[0].text); 1079 else 1079 1080 WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, 1080 1081 (LPSTR)lParam, len+1, NULL, NULL ); 1081 1082 return len; 1082 1083 } 1083 1084 … … 1090 1091 { 1091 1092 if (infoPtr->hwndToolTip) 1092 1093 1093 STATUSBAR_RelayEvent (infoPtr->hwndToolTip, hwnd, 1094 WM_MOUSEMOVE, wParam, lParam); 1094 1095 return 0; 1095 1096 } … … 1100 1101 { 1101 1102 if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) { 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1103 RECT rect; 1104 POINT pt; 1105 1106 GetClientRect (hwnd, &rect); 1107 1108 pt.x = (INT)LOWORD(lParam); 1109 pt.y = (INT)HIWORD(lParam); 1110 ScreenToClient (hwnd, &pt); 1111 1112 rect.left = rect.right - 13; 1113 rect.top += 2; 1114 1115 if (PtInRect (&rect, pt)) 1116 return HTBOTTOMRIGHT; 1116 1117 } 1117 1118 … … 1149 1150 STATUSBAR_Refresh (infoPtr, hwnd, hdc); 1150 1151 if (!wParam) 1151 1152 EndPaint (hwnd, &ps); 1152 1153 1153 1154 return 0; … … 1194 1195 TRACE("\n"); 1195 1196 if (infoPtr->numParts == 0) 1196 1197 return FALSE; 1197 1198 1198 1199 part = &infoPtr->parts[0]; … … 1202 1203 part->text = 0; 1203 1204 if (infoPtr->bUnicode) { 1204 1205 1206 1207 1205 if (lParam && (len = strlenW((LPCWSTR)lParam))) { 1206 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1207 strcpyW (part->text, (LPCWSTR)lParam); 1208 } 1208 1209 } 1209 1210 else { 1210 1211 if (lParam && (len = lstrlenA((LPCSTR)lParam))) { 1211 1212 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, NULL, 0 ); 1212 1213 part->text = COMCTL32_Alloc (lenW*sizeof(WCHAR)); 1213 1214 MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, part->text, lenW ); 1214 1215 } 1215 1216 } 1216 1217 … … 1240 1241 { 1241 1242 if (flags == SIZE_RESTORED) { 1242 1243 1244 1245 1246 1247 MoveWindow (hwnd, parent_rect.left, 1248 1249 1250 1243 /* width and height don't apply */ 1244 GetClientRect (infoPtr->hwndParent, &parent_rect); 1245 width = parent_rect.right - parent_rect.left; 1246 x = parent_rect.left; 1247 y = parent_rect.bottom - infoPtr->height; 1248 MoveWindow (hwnd, parent_rect.left, 1249 parent_rect.bottom - infoPtr->height, 1250 width, infoPtr->height, TRUE); 1251 STATUSBAR_SetPartBounds (infoPtr, hwnd); 1251 1252 } 1252 1253 return 0; /* FIXME: ok to return here ? */ 1253 1254 } 1254 1255 … … 1283 1284 1284 1285 switch (msg) { 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 case SB_SETPARTS: 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1286 case SB_GETBORDERS: 1287 return STATUSBAR_GetBorders (lParam); 1288 1289 case SB_GETICON: 1290 return STATUSBAR_GetIcon (infoPtr, hwnd, wParam); 1291 1292 case SB_GETPARTS: 1293 return STATUSBAR_GetParts (infoPtr, hwnd, wParam, lParam); 1294 1295 case SB_GETRECT: 1296 return STATUSBAR_GetRect (infoPtr, hwnd, wParam, lParam); 1297 1298 case SB_GETTEXTA: 1299 return STATUSBAR_GetTextA (infoPtr, hwnd, wParam, lParam); 1300 1301 case SB_GETTEXTW: 1302 return STATUSBAR_GetTextW (infoPtr, hwnd, wParam, lParam); 1303 1304 case SB_GETTEXTLENGTHA: 1305 case SB_GETTEXTLENGTHW: 1306 return STATUSBAR_GetTextLength (infoPtr, hwnd, wParam); 1307 1308 case SB_GETTIPTEXTA: 1309 return STATUSBAR_GetTipTextA (infoPtr, hwnd, wParam, lParam); 1310 1311 case SB_GETTIPTEXTW: 1312 return STATUSBAR_GetTipTextW (infoPtr, hwnd, wParam, lParam); 1313 1314 case SB_GETUNICODEFORMAT: 1315 return STATUSBAR_GetUnicodeFormat (infoPtr, hwnd); 1316 1317 case SB_ISSIMPLE: 1318 return STATUSBAR_IsSimple (infoPtr, hwnd); 1319 1320 case SB_SETBKCOLOR: 1321 return STATUSBAR_SetBkColor (infoPtr, hwnd, wParam, lParam); 1322 1323 case SB_SETICON: 1324 return STATUSBAR_SetIcon (infoPtr, hwnd, wParam, lParam); 1325 1326 case SB_SETMINHEIGHT: 1327 return STATUSBAR_SetMinHeight (infoPtr, hwnd, wParam, lParam); 1328 1329 case SB_SETPARTS: 1330 return STATUSBAR_SetParts (infoPtr, hwnd, wParam, lParam); 1331 1332 case SB_SETTEXTA: 1333 return STATUSBAR_SetTextA (infoPtr, hwnd, wParam, lParam); 1334 1335 case SB_SETTEXTW: 1336 return STATUSBAR_SetTextW (infoPtr, hwnd, wParam, lParam); 1337 1338 case SB_SETTIPTEXTA: 1339 return STATUSBAR_SetTipTextA (infoPtr, hwnd, wParam, lParam); 1340 1341 case SB_SETTIPTEXTW: 1342 return STATUSBAR_SetTipTextW (infoPtr, hwnd, wParam, lParam); 1343 1344 case SB_SETUNICODEFORMAT: 1345 return STATUSBAR_SetUnicodeFormat (infoPtr, hwnd, wParam); 1346 1347 case SB_SIMPLE: 1348 return STATUSBAR_Simple (infoPtr, hwnd, wParam, lParam); 1349 1350 1351 case WM_CREATE: 1352 return STATUSBAR_WMCreate (hwnd, wParam, lParam); 1353 1354 case WM_DESTROY: 1355 return STATUSBAR_WMDestroy (infoPtr, hwnd); 1356 1357 case WM_GETFONT: 1357 1358 return STATUSBAR_WMGetFont (infoPtr, hwnd); 1358 1359 1359 1360 case WM_GETTEXT: 1360 1361 return STATUSBAR_WMGetText (infoPtr, hwnd, wParam, lParam); 1361 1362 1362 1363 1364 1365 1363 case WM_GETTEXTLENGTH: 1364 return STATUSBAR_GetTextLength (infoPtr, hwnd, 0); 1365 1366 case WM_LBUTTONDBLCLK: 1366 1367 return STATUSBAR_SendNotify (hwnd, NM_DBLCLK); 1367 1368 1368 1369 1370 1371 1369 case WM_LBUTTONUP: 1370 return STATUSBAR_SendNotify (hwnd, NM_CLICK); 1371 1372 case WM_MOUSEMOVE: 1372 1373 return STATUSBAR_WMMouseMove (infoPtr, hwnd, wParam, lParam); 1373 1374 1374 1375 case WM_NCHITTEST: 1375 1376 return STATUSBAR_WMNCHitTest (hwnd, wParam, lParam); 1376 1377 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1378 case WM_NCLBUTTONDOWN: 1379 return STATUSBAR_WMNCLButtonDown (hwnd, wParam, lParam); 1380 1381 case WM_NCLBUTTONUP: 1382 return STATUSBAR_WMNCLButtonUp (hwnd, wParam, lParam); 1383 1384 case WM_PAINT: 1385 return STATUSBAR_WMPaint (infoPtr, hwnd, wParam); 1386 1387 case WM_RBUTTONDBLCLK: 1388 return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK); 1389 1390 case WM_RBUTTONUP: 1391 return STATUSBAR_SendNotify (hwnd, NM_RCLICK); 1392 1393 case WM_SETFONT: 1394 return STATUSBAR_WMSetFont (infoPtr, hwnd, wParam, lParam); 1395 1396 case WM_SETTEXT: 1397 return STATUSBAR_WMSetText (infoPtr, hwnd, wParam, lParam); 1398 1399 case WM_SIZE: 1400 return STATUSBAR_WMSize (infoPtr, hwnd, wParam, lParam); 1401 1402 default: 1403 if (msg >= WM_USER) 1404 ERR("unknown msg %04x wp=%04x lp=%08lx\n", 1405 msg, wParam, lParam); 1405 1406 #ifdef __WIN32OS2__ 1406 1407 return defComCtl32ProcA (hwnd, msg, wParam, lParam); 1407 1408 #else 1408 1409 return DefWindowProcA (hwnd, msg, wParam, lParam); 1409 1410 #endif 1410 1411 } … … 1432 1433 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); 1433 1434 wndClass.lpszClassName = STATUSCLASSNAMEA; 1434 1435 1435 1436 RegisterClassA (&wndClass); 1436 1437 }
Note:
See TracChangeset
for help on using the changeset viewer.