Changeset 8382 for trunk/src/comctl32/toolbar.c
- Timestamp:
- May 8, 2002, 1:26:30 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/toolbar.c
r7815 r8382 4 4 * Copyright 1998,1999 Eric Kohl 5 5 * Copyright 2000 Eric Kohl for CodeWeavers 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 20 * 7 21 * Differences between MSDN and actual native control operation: … … 56 70 #include "imagelist.h" 57 71 #include "comctl32.h" 58 #include " debugtools.h"59 60 DEFAULT_DEBUG_CHANNEL(toolbar);72 #include "wine/debug.h" 73 74 WINE_DEFAULT_DEBUG_CHANNEL(toolbar); 61 75 62 76 typedef struct … … 73 87 RECT rect; 74 88 } TBUTTON_INFO; 89 90 typedef struct 91 { 92 UINT nButtons; 93 HINSTANCE hInst; 94 UINT nID; 95 } TBITMAP_INFO; 75 96 76 97 typedef struct … … 91 112 INT nNumBitmaps; /* number of bitmaps */ 92 113 INT nNumStrings; /* number of strings */ 114 INT nNumBitmapInfos; 93 115 BOOL bUnicode; /* ASCII (FALSE) or Unicode (TRUE)? */ 94 116 BOOL bCaptured; /* mouse captured? */ … … 96 118 INT nOldHit; 97 119 INT nHotItem; /* index of the "hot" item */ 120 DWORD dwBaseCustDraw; /* CDRF_ response (w/o TBCDRF_) from PREPAINT */ 121 DWORD dwItemCustDraw; /* CDRF_ response (w/o TBCDRF_) from ITEMPREP */ 122 DWORD dwItemCDFlag; /* TBCDRF_ flags from last ITEMPREPAINT */ 123 SIZE szPadding; /* padding values around button */ 98 124 HFONT hDefaultFont; 99 125 HFONT hFont; /* text font */ … … 115 141 116 142 COLORREF clrInsertMark; /* insert mark color */ 143 COLORREF clrBtnHighlight; /* color for Flat Separator */ 144 COLORREF clrBtnShadow; /* color for Flag Separator */ 117 145 RECT rcBound; /* bounding rectangle */ 118 146 INT iVersion; … … 120 148 TBUTTON_INFO *buttons; /* pointer to button array */ 121 149 LPWSTR *strings; /* pointer to string array */ 150 TBITMAP_INFO *bitmaps; 122 151 } TOOLBAR_INFO, *PTOOLBAR_INFO; 123 152 … … 147 176 #define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE) 148 177 #define TOOLBAR_HasDropDownArrows(exStyle) ((exStyle & TBSTYLE_EX_DRAWDDARROWS) ? TRUE : FALSE) 178 179 /* Used to find undocumented extended styles */ 180 #define TBSTYLE_EX_ALL (TBSTYLE_EX_DRAWDDARROWS | \ 181 TBSTYLE_EX_UNDOC1 | \ 182 TBSTYLE_EX_MIXEDBUTTONS | \ 183 TBSTYLE_EX_HIDECLIPPEDBUTTONS) 184 185 static LRESULT 186 TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam); 149 187 150 188 … … 302 340 303 341 if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 342 if (btnPtr->iBitmap == I_IMAGENONE) return FALSE; 304 343 ERR("index %d is not valid, max %d\n", 305 344 btnPtr->iBitmap, infoPtr->nNumBitmaps); … … 308 347 309 348 if ((index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) { 310 if (index == -1) return FALSE; 349 if ((index == I_IMAGECALLBACK) || 350 (index == I_IMAGENONE)) return FALSE; 311 351 ERR("TBN_GETDISPINFO returned invalid index %d\n", 312 352 index); … … 335 375 336 376 if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 377 if (btnPtr->iBitmap == I_IMAGENONE) return FALSE; 337 378 ERR("index %d is not valid, max %d\n", 338 379 btnPtr->iBitmap, infoPtr->nNumBitmaps); … … 341 382 342 383 if ((index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) { 343 if (index == -1) return FALSE; 384 if ((index == I_IMAGECALLBACK) || 385 (index == I_IMAGENONE)) return FALSE; 344 386 ERR("TBN_GETDISPINFO returned invalid index %d\n", 345 387 index); … … 351 393 352 394 static void 353 TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc) 354 { 355 INT x = (lpRect->left + lpRect->right) / 2 - 1; 356 INT yBottom = lpRect->bottom - 3; 357 INT yTop = lpRect->top + 1; 358 359 SelectObject ( hdc, GetSysColorPen (COLOR_3DSHADOW)); 360 MoveToEx (hdc, x, yBottom, NULL); 361 LineTo (hdc, x, yTop); 362 x++; 363 SelectObject ( hdc, GetSysColorPen (COLOR_3DHILIGHT)); 364 MoveToEx (hdc, x, yBottom, NULL); 365 LineTo (hdc, x, yTop); 395 TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr) 396 { 397 RECT myrect; 398 COLORREF oldcolor, newcolor; 399 400 myrect.left = (lpRect->left + lpRect->right) / 2 - 1; 401 myrect.right = myrect.left + 1; 402 myrect.top = lpRect->top + 2; 403 myrect.bottom = lpRect->bottom - 2; 404 405 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 406 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 407 oldcolor = SetBkColor (hdc, newcolor); 408 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); 409 410 myrect.left = myrect.right; 411 myrect.right = myrect.left + 1; 412 413 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 414 comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; 415 SetBkColor (hdc, newcolor); 416 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); 417 418 SetBkColor (hdc, oldcolor); 366 419 } 367 420 … … 379 432 */ 380 433 static void 381 TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr )434 TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr, TOOLBAR_INFO *infoPtr) 382 435 { 383 436 RECT myrect; … … 394 447 myrect.left, myrect.top, myrect.right, myrect.bottom); 395 448 396 newcolor = GetSysColor (COLOR_BTNSHADOW); 449 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 450 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 397 451 oldcolor = SetBkColor (hdc, newcolor); 398 452 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); … … 401 455 myrect.bottom = myrect.top + 1; 402 456 403 newcolor = GetSysColor (COLOR_BTNHIGHLIGHT); 457 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 458 comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; 404 459 SetBkColor (hdc, newcolor); 405 460 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); … … 432 487 static void 433 488 TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 434 HDC hdc, INT nState, DWORD dwStyle) 435 { 436 RECT rcText = btnPtr->rect; 437 HFONT hOldFont; 438 COLORREF clrOld; 489 HDC hdc, INT nState, DWORD dwStyle, 490 RECT *rcText, LPWSTR lpText, NMTBCUSTOMDRAW *tbcd) 491 { 492 HFONT hOldFont = 0; 493 COLORREF clrOld = 0; 494 495 /* draw text */ 496 if (lpText) { 497 TRACE("string rect=(%d,%d)-(%d,%d)\n", 498 rcText->left, rcText->top, rcText->right, rcText->bottom); 499 500 hOldFont = SelectObject (hdc, infoPtr->hFont); 501 if (!(nState & TBSTATE_ENABLED)) { 502 clrOld = SetTextColor (hdc, tbcd->clrBtnHighlight); 503 OffsetRect (rcText, 1, 1); 504 DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags); 505 SetTextColor (hdc, comctl32_color.clr3dShadow); 506 OffsetRect (rcText, -1, -1); 507 } 508 else if (nState & TBSTATE_INDETERMINATE) { 509 clrOld = SetTextColor (hdc, comctl32_color.clr3dShadow); 510 } 511 else if (btnPtr->bHot && (infoPtr->dwItemCDFlag & TBCDRF_HILITEHOTTRACK )) { 512 clrOld = SetTextColor (hdc, tbcd->clrTextHighlight); 513 } 514 else { 515 clrOld = SetTextColor (hdc, tbcd->clrText); 516 } 517 518 DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags); 519 SetTextColor (hdc, clrOld); 520 SelectObject (hdc, hOldFont); 521 } 522 } 523 524 525 static void 526 TOOLBAR_DrawPattern (HDC hdc, LPRECT lpRect) 527 { 528 HBRUSH hbr = SelectObject (hdc, COMCTL32_hPattern55AABrush); 529 INT cx = lpRect->right - lpRect->left; 530 INT cy = lpRect->bottom - lpRect->top; 531 PatBlt (hdc, lpRect->left, lpRect->top, cx, cy, 0x00FA0089); 532 SelectObject (hdc, hbr); 533 } 534 535 536 static void 537 TOOLBAR_DrawMasked (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 538 HDC hdc, INT x, INT y) 539 { 540 /* FIXME: this function is a hack since it uses image list 541 internals directly */ 542 543 HIMAGELIST himl = infoPtr->himlDef; 544 HBITMAP hbmMask; 545 HDC hdcImageList; 546 HDC hdcMask; 547 548 if (!himl) 549 return; 550 551 /* create new dc's */ 552 hdcImageList = CreateCompatibleDC (0); 553 hdcMask = CreateCompatibleDC (0); 554 555 /* create new bitmap */ 556 hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL); 557 SelectObject (hdcMask, hbmMask); 558 559 /* copy the mask bitmap */ 560 SelectObject (hdcImageList, himl->hbmMask); 561 SetBkColor (hdcImageList, RGB(255, 255, 255)); 562 SetTextColor (hdcImageList, RGB(0, 0, 0)); 563 BitBlt (hdcMask, 0, 0, himl->cx, himl->cy, 564 hdcImageList, himl->cx * btnPtr->iBitmap, 0, SRCCOPY); 565 566 /* draw the new mask */ 567 SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT)); 568 BitBlt (hdc, x+1, y+1, himl->cx, himl->cy, 569 hdcMask, 0, 0, 0xB8074A); 570 571 SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW)); 572 BitBlt (hdc, x, y, himl->cx, himl->cy, 573 hdcMask, 0, 0, 0xB8074A); 574 575 DeleteObject (hbmMask); 576 DeleteDC (hdcMask); 577 DeleteDC (hdcImageList); 578 } 579 580 581 static UINT 582 TOOLBAR_TranslateState(TBUTTON_INFO *btnPtr) 583 { 584 UINT retstate = 0; 585 586 retstate |= (btnPtr->fsState & TBSTATE_CHECKED) ? CDIS_CHECKED : 0; 587 retstate |= (btnPtr->fsState & TBSTATE_PRESSED) ? CDIS_SELECTED : 0; 588 retstate |= (btnPtr->fsState & TBSTATE_ENABLED) ? 0 : CDIS_DISABLED; 589 retstate |= (btnPtr->fsState & TBSTATE_MARKED ) ? CDIS_MARKED : 0; 590 retstate |= (btnPtr->bHot ) ? CDIS_HOT : 0; 591 retstate |= (btnPtr->fsState & TBSTATE_INDETERMINATE) ? CDIS_INDETERMINATE : 0; 592 /* FIXME: don't set CDIS_GRAYED, CDIS_FOCUS, CDIS_DEFAULT */ 593 /* don't test TBSTATE_HIDDEN */ 594 return retstate; 595 } 596 597 598 static void 599 TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc) 600 { 601 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 602 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 603 BOOL hasDropDownArrow = TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && 604 (btnPtr->fsStyle & TBSTYLE_DROPDOWN); 605 RECT rc, rcArrow, rcBitmap, rcText, rcFill; 439 606 LPWSTR lpText = NULL; 440 HIMAGELIST himl = infoPtr->himlDef; 441 442 TRACE ("iString: %x\n", btnPtr->iString); 607 NMTBCUSTOMDRAW tbcd; 608 DWORD ntfret; 609 INT offset; 610 611 if (btnPtr->fsState & TBSTATE_HIDDEN) 612 return; 613 614 rc = btnPtr->rect; 615 CopyRect (&rcFill, &rc); 616 CopyRect (&rcArrow, &rc); 617 CopyRect(&rcBitmap, &rc); 618 CopyRect(&rcText, &rc); 443 619 444 620 /* get a pointer to the text */ 445 621 lpText = TOOLBAR_GetText(infoPtr, btnPtr); 446 622 623 if (hasDropDownArrow) 624 { 625 if (dwStyle & TBSTYLE_FLAT) 626 rc.right = max(rc.left, rc.right - DDARROW_WIDTH); 627 else 628 rc.right = max(rc.left, rc.right - DDARROW_WIDTH - 2); 629 rcArrow.left = rc.right; 630 } 631 632 /* Center the bitmap horizontally and vertically */ 633 if (dwStyle & TBSTYLE_LIST) 634 rcBitmap.left += 3; 635 else 636 rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2; 637 638 if(lpText) 639 rcBitmap.top+=2; /* this looks to be the correct value from vmware comparison - cmm */ 640 else 641 rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2; 642 643 TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n", 644 btnPtr->iBitmap, rcBitmap.left, rcBitmap.top, 645 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); 646 TRACE ("iString: %x\n", btnPtr->iString); 447 647 TRACE ("Stringtext: %s\n", debugstr_w(lpText)); 448 648 … … 452 652 InflateRect (&rcText, -3, -3); 453 653 454 if (himl && TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 654 if (infoPtr->himlDef && 655 TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 455 656 /* The following test looked like this before 456 657 * I changed it. IE4 "Links" toolbar would not … … 477 678 } 478 679 479 if ( nState & (TBSTATE_PRESSED | TBSTATE_CHECKED))680 if (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED)) 480 681 OffsetRect (&rcText, 1, 1); 481 482 TRACE("string rect=(%d,%d)-(%d,%d)\n", 483 rcText.left, rcText.top, rcText.right, rcText.bottom); 484 485 hOldFont = SelectObject (hdc, infoPtr->hFont); 486 if (!(nState & TBSTATE_ENABLED)) { 487 clrOld = SetTextColor (hdc, GetSysColor (COLOR_3DHILIGHT)); 488 OffsetRect (&rcText, 1, 1); 489 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags); 490 SetTextColor (hdc, GetSysColor (COLOR_3DSHADOW)); 491 OffsetRect (&rcText, -1, -1); 492 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags); 493 } 494 else if (nState & TBSTATE_INDETERMINATE) { 495 clrOld = SetTextColor (hdc, GetSysColor (COLOR_3DSHADOW)); 496 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags); 497 } 498 else { 499 clrOld = SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT)); 500 DrawTextW (hdc, lpText, -1, &rcText, infoPtr->dwDTFlags); 501 } 502 503 SetTextColor (hdc, clrOld); 504 SelectObject (hdc, hOldFont); 505 } 506 } 507 508 509 static void 510 TOOLBAR_DrawPattern (HDC hdc, LPRECT lpRect) 511 { 512 HBRUSH hbr = SelectObject (hdc, COMCTL32_hPattern55AABrush); 513 INT cx = lpRect->right - lpRect->left; 514 INT cy = lpRect->bottom - lpRect->top; 515 PatBlt (hdc, lpRect->left, lpRect->top, cx, cy, 0x00FA0089); 516 SelectObject (hdc, hbr); 517 } 518 519 520 static void 521 TOOLBAR_DrawMasked (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 522 HDC hdc, INT x, INT y) 523 { 524 /* FIXME: this function is a hack since it uses image list 525 internals directly */ 526 527 HIMAGELIST himl = infoPtr->himlDef; 528 HBITMAP hbmMask; 529 HDC hdcImageList; 530 HDC hdcMask; 531 532 if (!himl) 533 return; 534 535 /* create new dc's */ 536 hdcImageList = CreateCompatibleDC (0); 537 hdcMask = CreateCompatibleDC (0); 538 539 /* create new bitmap */ 540 hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL); 541 SelectObject (hdcMask, hbmMask); 542 543 /* copy the mask bitmap */ 544 SelectObject (hdcImageList, himl->hbmMask); 545 SetBkColor (hdcImageList, RGB(255, 255, 255)); 546 SetTextColor (hdcImageList, RGB(0, 0, 0)); 547 BitBlt (hdcMask, 0, 0, himl->cx, himl->cy, 548 hdcImageList, himl->cx * btnPtr->iBitmap, 0, SRCCOPY); 549 550 /* draw the new mask */ 551 SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT)); 552 BitBlt (hdc, x+1, y+1, himl->cx, himl->cy, 553 hdcMask, 0, 0, 0xB8074A); 554 555 SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW)); 556 BitBlt (hdc, x, y, himl->cx, himl->cy, 557 hdcMask, 0, 0, 0xB8074A); 558 559 DeleteObject (hbmMask); 560 DeleteDC (hdcMask); 561 DeleteDC (hdcImageList); 562 } 563 564 565 static void 566 TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc) 567 { 568 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 569 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 570 BOOL hasDropDownArrow = TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && 571 (btnPtr->fsStyle & TBSTYLE_DROPDOWN); 572 RECT rc, rcArrow, rcBitmap; 573 574 if (btnPtr->fsState & TBSTATE_HIDDEN) 575 return; 576 577 rc = btnPtr->rect; 578 CopyRect (&rcArrow, &rc); 579 CopyRect(&rcBitmap, &rc); 682 } 683 684 /* Initialize fields in all cases, because we use these later */ 685 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); 686 tbcd.clrText = comctl32_color.clrBtnText; 687 tbcd.clrTextHighlight = comctl32_color.clrHighlightText; 688 tbcd.clrBtnFace = comctl32_color.clrBtnFace; 689 tbcd.clrBtnHighlight = comctl32_color.clrBtnHighlight; 690 tbcd.clrMark = comctl32_color.clrHighlight; 691 tbcd.clrHighlightHotTrack = 0; 692 tbcd.nStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE; 693 tbcd.nHLStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE; 694 /* MSDN says that this is the text rectangle. */ 695 /* But (why always a but) tracing of v5.7 of native shows */ 696 /* that this is really a *relative* rectangle based on the */ 697 /* the nmcd.rc. Also the left and top are always 0 ignoring*/ 698 /* any bitmap that might be present. */ 699 tbcd.rcText.left = 0; 700 tbcd.rcText.top = 0; 701 tbcd.rcText.right = rcText.right - rc.left; 702 tbcd.rcText.bottom = rcText.bottom - rc.top; 703 704 /* FIXME: what should these be set to ????? */ 705 tbcd.hbrMonoDither = 0; 706 tbcd.hbrLines = 0; 707 tbcd.hpenLines = 0; 708 709 /* Issue Item Prepaint notify */ 710 infoPtr->dwItemCustDraw = 0; 711 infoPtr->dwItemCDFlag = 0; 712 if (infoPtr->dwBaseCustDraw & CDRF_NOTIFYITEMDRAW) 713 { 714 tbcd.nmcd.dwDrawStage = CDDS_ITEMPREPAINT; 715 tbcd.nmcd.hdc = hdc; 716 tbcd.nmcd.rc = rc; 717 tbcd.nmcd.dwItemSpec = btnPtr->idCommand; 718 tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr); 719 tbcd.nmcd.lItemlParam = btnPtr->dwData; 720 ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); 721 infoPtr->dwItemCustDraw = ntfret & 0xffff; 722 infoPtr->dwItemCDFlag = ntfret & 0xffff0000; 723 if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT) 724 return; 725 /* save the only part of the rect that the user can change */ 726 rcText.right = tbcd.rcText.right + rc.left; 727 rcText.bottom = tbcd.rcText.bottom + rc.top; 728 } 580 729 581 730 if (!infoPtr->bBtnTranspnt) 582 FillRect( hdc, &rc, GetSysColorBrush(COLOR_BTNFACE)); 583 584 if (hasDropDownArrow) 585 { 586 if (dwStyle & TBSTYLE_FLAT) 587 rc.right = max(rc.left, rc.right - DDARROW_WIDTH); 588 else 589 rc.right = max(rc.left, rc.right - DDARROW_WIDTH - 2); 590 rcArrow.left = rc.right; 591 } 592 593 /* Center the bitmap horizontally and vertically */ 594 if (dwStyle & TBSTYLE_LIST) 595 rcBitmap.left += 3; 596 else 597 rcBitmap.left+=(infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2; 598 599 if(TOOLBAR_HasText(infoPtr, btnPtr)) 600 rcBitmap.top+=2; /* this looks to be the correct value from vmware comparison - cmm */ 601 else 602 rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2; 603 604 TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n", 605 btnPtr->iBitmap, rcBitmap.left, rcBitmap.top, 606 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); 731 FillRect( hdc, &rcFill, GetSysColorBrush(COLOR_BTNFACE)); 607 732 608 733 /* separator */ … … 615 740 if ((dwStyle & TBSTYLE_FLAT) /* && (btnPtr->iBitmap == 0) */) { 616 741 if (btnPtr->fsStyle & TBSTYLE_DROPDOWN) 617 TOOLBAR_DrawDDFlatSeparator (&rc, hdc, btnPtr );742 TOOLBAR_DrawDDFlatSeparator (&rc, hdc, btnPtr, infoPtr); 618 743 else 619 TOOLBAR_DrawFlatSeparator (&rc, hdc); 620 } 621 return; 744 TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr); 745 } 746 else if (btnPtr->fsStyle != TBSTYLE_SEP) { 747 FIXME("Draw some kind of separator: fsStyle=%x\n", 748 btnPtr->fsStyle); 749 } 750 goto FINALNOTIFY; 622 751 } 623 752 624 753 /* disabled */ 625 754 if (!(btnPtr->fsState & TBSTATE_ENABLED)) { 626 if (!(dwStyle & TBSTYLE_FLAT) )755 if (!(dwStyle & TBSTYLE_FLAT) && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) 627 756 { 628 757 DrawEdge (hdc, &rc, EDGE_RAISED, … … 644 773 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); 645 774 646 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle );647 return;775 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); 776 goto FINALNOTIFY; 648 777 } 649 778 650 779 /* pressed TBSTYLE_BUTTON */ 651 780 if (btnPtr->fsState & TBSTATE_PRESSED) { 652 if (dwStyle & TBSTYLE_FLAT) 781 offset = (infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1; 782 if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) 653 783 { 654 DrawEdge (hdc, &rc, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 655 if (hasDropDownArrow) 656 DrawEdge (hdc, &rcArrow, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 657 } 658 else 659 { 660 DrawEdge (hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST); 661 if (hasDropDownArrow) 662 DrawEdge (hdc, &rcArrow, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST); 784 if (dwStyle & TBSTYLE_FLAT) 785 { 786 DrawEdge (hdc, &rc, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 787 if (hasDropDownArrow) 788 DrawEdge (hdc, &rcArrow, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 789 } 790 else 791 { 792 DrawEdge (hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST); 793 if (hasDropDownArrow) 794 DrawEdge (hdc, &rcArrow, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST); 795 } 663 796 } 664 797 … … 667 800 668 801 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, 669 hdc, rcBitmap.left+ 1, rcBitmap.top+1,802 hdc, rcBitmap.left+offset, rcBitmap.top+offset, 670 803 ILD_NORMAL); 671 804 672 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle );673 return;805 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); 806 goto FINALNOTIFY; 674 807 } 675 808 … … 677 810 if ((btnPtr->fsStyle & TBSTYLE_CHECK) && 678 811 (btnPtr->fsState & TBSTATE_CHECKED)) { 679 if (dwStyle & TBSTYLE_FLAT) 680 DrawEdge (hdc, &rc, BDR_SUNKENOUTER, 681 BF_RECT | BF_ADJUST); 682 else 683 DrawEdge (hdc, &rc, EDGE_SUNKEN, 684 BF_RECT | BF_MIDDLE | BF_ADJUST); 812 if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) 813 { 814 if (dwStyle & TBSTYLE_FLAT) 815 DrawEdge (hdc, &rc, BDR_SUNKENOUTER, 816 BF_RECT | BF_ADJUST); 817 else 818 DrawEdge (hdc, &rc, EDGE_SUNKEN, 819 BF_RECT | BF_MIDDLE | BF_ADJUST); 820 } 685 821 686 822 TOOLBAR_DrawPattern (hdc, &rc); … … 690 826 ILD_NORMAL); 691 827 692 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle );693 return;828 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); 829 goto FINALNOTIFY; 694 830 } 695 831 696 832 /* indeterminate */ 697 833 if (btnPtr->fsState & TBSTATE_INDETERMINATE) { 698 DrawEdge (hdc, &rc, EDGE_RAISED, 699 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 834 if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) 835 DrawEdge (hdc, &rc, EDGE_RAISED, 836 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 700 837 701 838 TOOLBAR_DrawPattern (hdc, &rc); 702 839 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); 703 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle );704 return;840 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); 841 goto FINALNOTIFY; 705 842 } 706 843 … … 710 847 if (btnPtr->bHot) 711 848 { 712 DrawEdge (hdc, &rc, BDR_RAISEDINNER, BF_RECT); 713 if (hasDropDownArrow) 714 DrawEdge (hdc, &rcArrow, BDR_RAISEDINNER, BF_RECT); 849 if ( infoPtr->dwItemCDFlag & TBCDRF_HILITEHOTTRACK ) 850 { 851 COLORREF oldclr; 852 853 oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack); 854 ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0); 855 if (hasDropDownArrow) 856 ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0); 857 SetBkColor(hdc, oldclr); 858 } 859 else 860 { 861 if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) 862 { 863 DrawEdge (hdc, &rc, BDR_RAISEDINNER, BF_RECT); 864 if (hasDropDownArrow) 865 DrawEdge (hdc, &rcArrow, BDR_RAISEDINNER, BF_RECT); 866 } 867 } 715 868 } 716 869 #if 1 … … 746 899 else 747 900 { 748 DrawEdge (hdc, &rc, EDGE_RAISED, 749 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 901 if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) 902 DrawEdge (hdc, &rc, EDGE_RAISED, 903 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 750 904 751 905 if (hasDropDownArrow) 752 906 { 753 DrawEdge (hdc, &rcArrow, EDGE_RAISED, 754 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 907 if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) 908 DrawEdge (hdc, &rcArrow, EDGE_RAISED, 909 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 755 910 TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME); 756 911 } … … 758 913 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, 759 914 hdc, rcBitmap.left, rcBitmap.top, 760 ILD_NORMAL); 761 } 762 763 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle); 915 ILD_NORMAL);} 916 917 918 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); 919 920 FINALNOTIFY: 921 if (infoPtr->dwItemCustDraw & CDRF_NOTIFYPOSTPAINT) 922 { 923 tbcd.nmcd.dwDrawStage = CDDS_ITEMPOSTPAINT; 924 tbcd.nmcd.hdc = hdc; 925 tbcd.nmcd.rc = rc; 926 tbcd.nmcd.dwItemSpec = btnPtr->idCommand; 927 tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr); 928 tbcd.nmcd.lItemlParam = btnPtr->dwData; 929 tbcd.rcText = rcText; 930 tbcd.nStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE; 931 tbcd.nHLStringBkMode = (infoPtr->bBtnTranspnt) ? TRANSPARENT : OPAQUE; 932 ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); 933 } 934 764 935 } 765 936 … … 772 943 INT i, oldBKmode = 0; 773 944 RECT rcTemp; 945 NMTBCUSTOMDRAW tbcd; 946 DWORD ntfret; 774 947 775 948 /* if imagelist belongs to the app, it can be changed … … 779 952 780 953 TOOLBAR_DumpToolbar (infoPtr, __LINE__); 954 955 /* Send initial notify */ 956 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); 957 tbcd.nmcd.dwDrawStage = CDDS_PREPAINT; 958 tbcd.nmcd.hdc = hdc; 959 tbcd.nmcd.rc = ps->rcPaint; 960 ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); 961 infoPtr->dwBaseCustDraw = ntfret & 0xffff; 781 962 782 963 if (infoPtr->bBtnTranspnt) … … 793 974 if (infoPtr->bBtnTranspnt && (oldBKmode != TRANSPARENT)) 794 975 SetBkMode (hdc, oldBKmode); 976 977 if (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTPAINT) 978 { 979 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); 980 tbcd.nmcd.dwDrawStage = CDDS_POSTPAINT; 981 tbcd.nmcd.hdc = hdc; 982 tbcd.nmcd.rc = ps->rcPaint; 983 ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); 984 } 795 985 } 796 986 … … 820 1010 LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr); 821 1011 822 /* first get size of all the text */ 823 GetTextExtentPoint32W (hdc, lpText, strlenW (lpText), lpSize); 824 825 /* feed above size into the rectangle for DrawText */ 826 myrect.left = myrect.top = 0; 827 myrect.right = lpSize->cx; 828 myrect.bottom = lpSize->cy; 829 830 /* Use DrawText to get true size as drawn (less pesky "&") */ 831 DrawTextW (hdc, lpText, -1, &myrect, DT_VCENTER | DT_SINGLELINE | 832 DT_CALCRECT | ((btnPtr->fsStyle & TBSTYLE_NOPREFIX) ? 1012 if(lpText != NULL) { 1013 /* first get size of all the text */ 1014 GetTextExtentPoint32W (hdc, lpText, strlenW (lpText), lpSize); 1015 1016 /* feed above size into the rectangle for DrawText */ 1017 myrect.left = myrect.top = 0; 1018 myrect.right = lpSize->cx; 1019 myrect.bottom = lpSize->cy; 1020 1021 /* Use DrawText to get true size as drawn (less pesky "&") */ 1022 DrawTextW (hdc, lpText, -1, &myrect, DT_VCENTER | DT_SINGLELINE | 1023 DT_CALCRECT | ((btnPtr->fsStyle & TBSTYLE_NOPREFIX) ? 833 1024 DT_NOPREFIX : 0)); 834 1025 835 /* feed back to caller */ 836 lpSize->cx = myrect.right; 837 lpSize->cy = myrect.bottom; 1026 /* feed back to caller */ 1027 lpSize->cx = myrect.right; 1028 lpSize->cy = myrect.bottom; 1029 } 838 1030 } 839 1031 … … 891 1083 * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE 892 1084 * flag, and set the TBSTATE_WRAP flags manually on the appropriate items. 1085 * 1086 * Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow 1087 * vertical toolbar lists. 893 1088 */ 894 1089 … … 905 1100 /* no layout is necessary. Applications may use this style */ 906 1101 /* to perform their own layout on the toolbar. */ 907 if( !(dwStyle & TBSTYLE_WRAPABLE) )908 return;1102 if( !(dwStyle & TBSTYLE_WRAPABLE) && 1103 !(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) ) return; 909 1104 910 1105 btnPtr = infoPtr->buttons; … … 972 1167 /* go to the next until it reaches a non separator. */ 973 1168 /* Wrap the last separator if it is before a button. */ 974 while( ( (btnPtr[i].fsStyle & TBSTYLE_SEP) || 975 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && 1169 while( ( ((btnPtr[i].fsStyle & TBSTYLE_SEP) && 1170 !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) || 1171 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && 976 1172 i < infoPtr->nNumButtons ) 977 1173 { … … 1081 1277 TOOLBAR_CalcStrings (hwnd, &sizeString); 1082 1278 1279 for (i = 0; i < infoPtr->nNumButtons && !usesBitmaps; i++) 1280 { 1281 if (TOOLBAR_IsValidBitmapIndex(infoPtr,infoPtr->buttons[i].iBitmap)) 1282 usesBitmaps = TRUE; 1283 } 1083 1284 if (dwStyle & TBSTYLE_LIST) 1084 1285 { 1085 for (i = 0; i < infoPtr->nNumButtons && !usesBitmaps; i++)1086 {1087 if (infoPtr->buttons[i].iBitmap >= 0)1088 usesBitmaps = TRUE;1089 }1090 1286 infoPtr->nButtonHeight = max((usesBitmaps) ? infoPtr->nBitmapHeight : 1091 0, sizeString.cy) + 6;1287 0, sizeString.cy) + infoPtr->szPadding.cy; 1092 1288 infoPtr->nButtonWidth = ((usesBitmaps) ? infoPtr->nBitmapWidth : 1093 1289 0) + sizeString.cx + 6; … … 1098 1294 } 1099 1295 else { 1100 for (i = 0; i < infoPtr->nNumButtons && !usesBitmaps; i++)1101 {1102 if (TOOLBAR_IsValidBitmapIndex(infoPtr,infoPtr->buttons[i].iBitmap))1103 usesBitmaps = TRUE;1104 }1105 1106 1296 if (sizeString.cy > 0) 1107 1297 { … … 1252 1442 btnPtr->nRow = nRows + nSepRows; 1253 1443 1254 TRACE("button %d style=%x, bWrap=%d, nRows=%d, nSepRows=%d, btnrow=%d\n", 1255 i, btnPtr->fsStyle, bWrap, nRows, nSepRows, btnPtr->nRow); 1444 TRACE("button %d style=%x, bWrap=%d, nRows=%d, nSepRows=%d, btnrow=%d, (%d,%d)-(%d,%d)\n", 1445 i, btnPtr->fsStyle, bWrap, nRows, nSepRows, btnPtr->nRow, 1446 x, y, x+cx, y+cy); 1256 1447 1257 1448 if( bWrap ) … … 1275 1466 } 1276 1467 x = infoPtr->nIndent; 1468 1469 /* Increment row number unless this is the last button */ 1470 /* and it has Wrap set. */ 1471 if (i != infoPtr->nNumButtons-1) 1277 1472 nRows++; 1278 1473 } … … 1283 1478 /* infoPtr->nRows is the number of rows on the toolbar */ 1284 1479 infoPtr->nRows = nRows + nSepRows + 1; 1480 1481 #if 0 1482 /******************************************************************** 1483 * The following while interesting, does not match the values * 1484 * created above for the button rectangles, nor the rcBound rect. * 1485 * We will comment it out and remove it later. * 1486 * * 1487 * The problem showed up as heights in the pager control that was * 1488 * wrong. * 1489 ********************************************************************/ 1285 1490 1286 1491 /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following */ … … 1290 1495 nSepRows * (infoPtr->nBitmapHeight + 1) + 1291 1496 BOTTOM_BORDER; 1497 #endif 1498 1499 infoPtr->nHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top; 1500 1292 1501 TRACE("toolbar height %d, button width %d\n", infoPtr->nHeight, infoPtr->nButtonWidth); 1293 1502 } … … 1333 1542 if (CommandIsIndex) { 1334 1543 TRACE("command is really index command=%d\n", idCommand); 1544 if (idCommand >= infoPtr->nNumButtons) return -1; 1335 1545 return idCommand; 1336 1546 } … … 1791 2001 1792 2002 /* set colors and select objects */ 1793 oldBk = SetBkColor (lpdis->hDC, GetSysColor((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW));2003 oldBk = SetBkColor (lpdis->hDC, (lpdis->itemState & ODS_FOCUS)?comctl32_color.clrHighlight:comctl32_color.clrWindow); 1794 2004 if (btnInfo->bVirtual) 1795 oldText = SetTextColor (lpdis->hDC, GetSysColor(COLOR_GRAYTEXT));2005 oldText = SetTextColor (lpdis->hDC, comctl32_color.clrGrayText); 1796 2006 else 1797 oldText = SetTextColor (lpdis->hDC, GetSysColor((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHTTEXT:COLOR_WINDOWTEXT));2007 oldText = SetTextColor (lpdis->hDC, (lpdis->itemState & ODS_FOCUS)?comctl32_color.clrHighlightText:comctl32_color.clrWindowText); 1798 2008 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 1799 2009 hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); … … 2000 2210 } 2001 2211 2212 TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos); 2213 2214 if (infoPtr->nNumBitmapInfos == 0) 2215 { 2216 infoPtr->bitmaps = COMCTL32_Alloc(sizeof(TBITMAP_INFO)); 2217 } 2218 else 2219 { 2220 TBITMAP_INFO *oldBitmaps = infoPtr->bitmaps; 2221 infoPtr->bitmaps = COMCTL32_Alloc((infoPtr->nNumBitmapInfos + 1) * sizeof(TBITMAP_INFO)); 2222 memcpy(&infoPtr->bitmaps[0], &oldBitmaps[0], infoPtr->nNumBitmapInfos); 2223 } 2224 2225 infoPtr->bitmaps[infoPtr->nNumBitmapInfos].nButtons = nButtons; 2226 infoPtr->bitmaps[infoPtr->nNumBitmapInfos].hInst = lpAddBmp->hInst; 2227 infoPtr->bitmaps[infoPtr->nNumBitmapInfos].nID = lpAddBmp->nID; 2228 2229 infoPtr->nNumBitmapInfos++; 2230 TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos); 2231 2002 2232 if (nIndex != -1) 2003 2233 { … … 2824 3054 2825 3055 2826 /* << TOOLBAR_GetColorScheme >> */2827 2828 2829 3056 static LRESULT 2830 3057 TOOLBAR_GetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) … … 2932 3159 2933 3160 /* << TOOLBAR_GetObject >> */ 2934 /* << TOOLBAR_GetPadding >> */ 3161 3162 3163 static LRESULT 3164 TOOLBAR_GetPadding (HWND hwnd) 3165 { 3166 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3167 DWORD oldPad; 3168 3169 oldPad = MAKELONG(infoPtr->szPadding.cx, infoPtr->szPadding.cy); 3170 return (LRESULT) oldPad; 3171 } 2935 3172 2936 3173 … … 3215 3452 TOOLBAR_DumpButton(infoPtr, (TBUTTON_INFO *)lpTbb, nIndex, FALSE); 3216 3453 3217 if (nIndex < 0) 3218 return FALSE; 3219 3220 TRACE("inserting button index=%d\n", nIndex); 3221 if (nIndex > infoPtr->nNumButtons) { 3454 if (nIndex == -1) { 3455 /* EPP: this seems to be an undocumented call (from my IE4) 3456 * I assume in that case that: 3457 * - lpTbb->iString is a string pointer (not a string index in strings[] table 3458 * - index of insertion is at the end of existing buttons 3459 * I only see this happen with nIndex == -1, but it could have a special 3460 * meaning (like -nIndex (or ~nIndex) to get the real position of insertion). 3461 */ 3222 3462 nIndex = infoPtr->nNumButtons; 3223 TRACE("adjust index=%d\n", nIndex); 3224 } 3225 3226 oldButtons = infoPtr->buttons; 3227 infoPtr->nNumButtons++; 3228 infoPtr->buttons = COMCTL32_Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons); 3229 /* pre insert copy */ 3230 if (nIndex > 0) { 3231 memcpy (&infoPtr->buttons[0], &oldButtons[0], 3232 nIndex * sizeof(TBUTTON_INFO)); 3233 } 3234 3463 3464 } else if (nIndex < 0) 3465 return FALSE; 3235 3466 3236 3467 /* If the string passed is not an index, assume address of string … … 3248 3479 lpTbb->iString = TOOLBAR_AddStringW(hwnd, 0, (LPARAM)ptr); 3249 3480 COMCTL32_Free(ptr); 3481 } 3482 3483 TRACE("inserting button index=%d\n", nIndex); 3484 if (nIndex > infoPtr->nNumButtons) { 3485 nIndex = infoPtr->nNumButtons; 3486 TRACE("adjust index=%d\n", nIndex); 3487 } 3488 3489 oldButtons = infoPtr->buttons; 3490 infoPtr->nNumButtons++; 3491 infoPtr->buttons = COMCTL32_Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons); 3492 /* pre insert copy */ 3493 if (nIndex > 0) { 3494 memcpy (&infoPtr->buttons[0], &oldButtons[0], 3495 nIndex * sizeof(TBUTTON_INFO)); 3250 3496 } 3251 3497 … … 3285 3531 COMCTL32_Free (oldButtons); 3286 3532 3533 TOOLBAR_CalcToolbar (hwnd); 3534 3287 3535 InvalidateRect (hwnd, NULL, TRUE); 3288 3536 … … 3407 3655 3408 3656 3409 /* << TOOLBAR_ReplaceBitmap >> */ 3410 3657 static LRESULT 3658 TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) 3659 { 3660 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3661 LPTBREPLACEBITMAP lpReplace = (LPTBREPLACEBITMAP) lParam; 3662 HBITMAP hBitmap; 3663 int i = 0, nOldButtons = 0, pos = 0; 3664 3665 TRACE("hInstOld %x nIDOld %x hInstNew %x nIDNew %x nButtons %x\n", 3666 lpReplace->hInstOld, lpReplace->nIDOld, lpReplace->hInstNew, lpReplace->nIDNew, 3667 lpReplace->nButtons); 3668 3669 if (lpReplace->hInstOld == -1) 3670 { 3671 FIXME("changing standard bitmaps not implemented\n"); 3672 return FALSE; 3673 } 3674 else if (lpReplace->hInstOld != 0) 3675 { 3676 FIXME("resources not in the current module not implemented\n"); 3677 return FALSE; 3678 } 3679 else 3680 { 3681 hBitmap = (HBITMAP) lpReplace->nIDNew; 3682 } 3683 3684 TRACE("To be replaced hInstOld %x nIDOld %x\n", lpReplace->hInstOld, lpReplace->nIDOld); 3685 for (i = 0; i < infoPtr->nNumBitmapInfos; i++) { 3686 TBITMAP_INFO *tbi = &infoPtr->bitmaps[i]; 3687 TRACE("tbimapinfo %d hInstOld %x nIDOld %x\n", i, tbi->hInst, tbi->nID); 3688 if (tbi->hInst == lpReplace->hInstOld && tbi->nID == lpReplace->nIDOld) 3689 { 3690 TRACE("Found: nButtons %d hInst %x nID %x\n", tbi->nButtons, tbi->hInst, tbi->nID); 3691 nOldButtons = tbi->nButtons; 3692 tbi->nButtons = lpReplace->nButtons; 3693 tbi->hInst = lpReplace->hInstNew; 3694 tbi->nID = lpReplace->nIDNew; 3695 TRACE("tbimapinfo changed %d hInstOld %x nIDOld %x\n", i, tbi->hInst, tbi->nID); 3696 break; 3697 } 3698 pos += tbi->nButtons; 3699 } 3700 3701 if (nOldButtons == 0) 3702 { 3703 WARN("No hinst/bitmap found! hInst %x nID %x\n", lpReplace->hInstOld, lpReplace->nIDOld); 3704 return FALSE; 3705 } 3706 3707 infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldButtons + lpReplace->nButtons; 3708 3709 /* ImageList_Replace(infoPtr->himlDef, pos, hBitmap, NULL); */ 3710 3711 3712 for (i = pos + nOldButtons - 1; i >= pos; i--) { 3713 ImageList_Remove(infoPtr->himlDef, i); 3714 } 3715 3716 ImageList_AddMasked(infoPtr->himlDef, hBitmap, CLR_DEFAULT); 3717 3718 InvalidateRect(hwnd, NULL, FALSE); 3719 3720 return TRUE; 3721 } 3411 3722 3412 3723 static LRESULT … … 3599 3910 { 3600 3911 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3601 3602 if ((LOWORD(lParam) <= 0) || (HIWORD(lParam)<=0)) 3912 INT cx = LOWORD(lParam), cy = HIWORD(lParam); 3913 3914 if ((cx < 0) || (cy < 0)) 3603 3915 { 3604 ERR("invalid parameter \n");3916 ERR("invalid parameter 0x%08lx\n", (DWORD)lParam); 3605 3917 return FALSE; 3606 3918 } … … 3612 3924 * Further testing shows that we must actually perform the change too. 3613 3925 */ 3614 infoPtr->nButtonWidth = (INT)LOWORD(lParam); 3615 infoPtr->nButtonHeight = (INT)HIWORD(lParam); 3926 /* 3927 * The documentation also does not mention that if 0 is supplied for 3928 * either size, the system changes it to the default of 24 wide and 3929 * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 3930 */ 3931 infoPtr->nButtonWidth = (cx) ? cx : 24; 3932 infoPtr->nButtonHeight = (cy) ? cy : 22; 3616 3933 return TRUE; 3617 3934 } … … 3681 3998 3682 3999 3683 /* << TOOLBAR_SetColorScheme >> */3684 3685 3686 4000 static LRESULT 3687 4001 TOOLBAR_SetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) … … 3718 4032 } 3719 4033 3720 3721 4034 static LRESULT 3722 4035 TOOLBAR_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam) … … 3727 4040 dwTemp = infoPtr->dwExStyle; 3728 4041 infoPtr->dwExStyle = (DWORD)lParam; 4042 4043 if (infoPtr->dwExStyle & (TBSTYLE_EX_MIXEDBUTTONS | 4044 TBSTYLE_EX_HIDECLIPPEDBUTTONS)) { 4045 FIXME("Extended style not implemented %s %s\n", 4046 (infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ? 4047 "TBSTYLE_EX_MIXEDBUTTONS" : "", 4048 (infoPtr->dwExStyle & TBSTYLE_EX_HIDECLIPPEDBUTTONS) ? 4049 "TBSTYLE_EX_HIDECLIPPEDBUTTONS" : ""); 4050 } 4051 4052 if (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL) 4053 FIXME("Unknown Toolbar Extended Style 0x%08lx. Please report.\n", 4054 (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)); 3729 4055 3730 4056 return (LRESULT)dwTemp; … … 3869 4195 3870 4196 3871 /* << TOOLBAR_SetPadding >> */ 4197 static LRESULT 4198 TOOLBAR_SetPadding (HWND hwnd, WPARAM wParam, LPARAM lParam) 4199 { 4200 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4201 DWORD oldPad; 4202 4203 oldPad = MAKELONG(infoPtr->szPadding.cx, infoPtr->szPadding.cy); 4204 infoPtr->szPadding.cx = LOWORD((DWORD)lParam); 4205 infoPtr->szPadding.cy = HIWORD((DWORD)lParam); 4206 FIXME("stub - nothing done with values, cx=%ld, cy=%ld\n", 4207 infoPtr->szPadding.cx, infoPtr->szPadding.cy); 4208 return (LRESULT) oldPad; 4209 } 3872 4210 3873 4211 … … 4015 4353 4016 4354 static LRESULT 4355 TOOLBAR_GetColorScheme (HWND hwnd, LPCOLORSCHEME lParam) 4356 { 4357 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4358 4359 lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 4360 comctl32_color.clrBtnHighlight : 4361 infoPtr->clrBtnHighlight; 4362 lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 4363 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 4364 return 1; 4365 } 4366 4367 4368 static LRESULT 4369 TOOLBAR_SetColorScheme (HWND hwnd, LPCOLORSCHEME lParam) 4370 { 4371 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4372 4373 TRACE("new colors Hl=%lx Shd=%lx, old colors Hl=%lx Shd=%lx\n", 4374 lParam->clrBtnHighlight, lParam->clrBtnShadow, 4375 infoPtr->clrBtnHighlight, infoPtr->clrBtnShadow); 4376 4377 infoPtr->clrBtnHighlight = lParam->clrBtnHighlight; 4378 infoPtr->clrBtnShadow = lParam->clrBtnShadow; 4379 InvalidateRect(hwnd, 0, 0); 4380 return 0; 4381 } 4382 4383 4384 static LRESULT 4017 4385 TOOLBAR_SetVersion (HWND hwnd, INT iVersion) 4018 4386 { … … 4023 4391 4024 4392 return iOldVersion; 4393 } 4394 4395 4396 /*********************************************************************/ 4397 /* */ 4398 /* This is undocumented and appears to be a "Super" TB_SETHOTITEM */ 4399 /* without the restriction of TBSTYLE_FLAT. This implementation is */ 4400 /* based on relay traces of the native control and IE 5.5 */ 4401 /* */ 4402 /*********************************************************************/ 4403 static LRESULT 4404 TOOLBAR_Unkwn45E (HWND hwnd, WPARAM wParam, LPARAM lParam) 4405 { 4406 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); 4407 INT nOldHotItem = infoPtr->nHotItem; 4408 TBUTTON_INFO *btnPtr; 4409 INT no_hi = 0; 4410 NMTBHOTITEM nmhotitem; 4411 4412 if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons) 4413 wParam = -2; 4414 4415 infoPtr->nHotItem = (INT)wParam; 4416 if (nOldHotItem != infoPtr->nHotItem) { 4417 nmhotitem.dwFlags = (DWORD)lParam; 4418 if ( !(nmhotitem.dwFlags & HICF_ENTERING) ) 4419 nmhotitem.idOld = (nOldHotItem >= 0) ? 4420 infoPtr->buttons[nOldHotItem].idCommand : 0; 4421 if ( !(nmhotitem.dwFlags & HICF_LEAVING) ) 4422 nmhotitem.idNew = (infoPtr->nHotItem >= 0) ? 4423 infoPtr->buttons[infoPtr->nHotItem].idCommand : 0; 4424 no_hi = TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE); 4425 } 4426 if ((INT)wParam >=0) { 4427 btnPtr = &infoPtr->buttons[(INT)wParam]; 4428 btnPtr->bHot = (no_hi) ? FALSE : TRUE; 4429 InvalidateRect (hwnd, &btnPtr->rect, 4430 TOOLBAR_HasText(infoPtr, btnPtr)); 4431 } 4432 if (nOldHotItem>=0) { 4433 btnPtr = &infoPtr->buttons[nOldHotItem]; 4434 btnPtr->bHot = FALSE; 4435 InvalidateRect (hwnd, &btnPtr->rect, 4436 TOOLBAR_HasText(infoPtr, btnPtr)); 4437 } 4438 GetFocus(); 4439 TRACE("old item=%d, new item=%d, flags=%08lx, notify=%d\n", 4440 nOldHotItem, infoPtr->nHotItem, (DWORD)lParam, no_hi); 4441 4442 if (nOldHotItem < 0) 4443 return -1; 4444 4445 return (LRESULT)nOldHotItem; 4446 } 4447 4448 4449 static LRESULT 4450 TOOLBAR_Unkwn463 (HWND hwnd, WPARAM wParam, LPARAM lParam) 4451 { 4452 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4453 LPSIZE lpsize = (LPSIZE)lParam; 4454 4455 if (lpsize == NULL) 4456 return FALSE; 4457 4458 /* 4459 * Testing shows the following: 4460 * wParam = 0 adjust cx value 4461 * = 1 set cy value to max size. 4462 * lParam pointer to SIZE structure 4463 * 4464 */ 4465 TRACE("[0463] wParam %d, lParam 0x%08lx -> 0x%08lx 0x%08lx\n", 4466 wParam, lParam, lpsize->cx, lpsize->cy); 4467 4468 switch(wParam) { 4469 case 0: 4470 if (lpsize->cx == -1) { 4471 /* **** this is wrong, native measures each button and sets it */ 4472 lpsize->cx = infoPtr->rcBound.right - infoPtr->rcBound.left; 4473 } 4474 else if(HIWORD(lpsize->cx)) { 4475 RECT rc; 4476 HWND hwndParent = GetParent(hwnd); 4477 4478 InvalidateRect(hwnd, 0, 1); 4479 GetWindowRect(hwnd, &rc); 4480 MapWindowPoints(0, hwndParent, (LPPOINT)&rc, 2); 4481 TRACE("mapped to (%d,%d)-(%d,%d)\n", 4482 rc.left, rc.top, rc.right, rc.bottom); 4483 lpsize->cx = max(rc.right-rc.left, 4484 infoPtr->rcBound.right - infoPtr->rcBound.left); 4485 } 4486 else { 4487 lpsize->cx = infoPtr->rcBound.right - infoPtr->rcBound.left; 4488 } 4489 break; 4490 case 1: 4491 lpsize->cy = infoPtr->rcBound.bottom - infoPtr->rcBound.top; 4492 /* lpsize->cy = infoPtr->nHeight; */ 4493 break; 4494 default: 4495 ERR("Unknown wParam %d for Toolbar message [0463]. Please report\n", 4496 wParam); 4497 return 0; 4498 } 4499 TRACE("[0463] set to -> 0x%08lx 0x%08lx\n", 4500 lpsize->cx, lpsize->cy); 4501 return 1; 4025 4502 } 4026 4503 … … 4058 4535 infoPtr->bAnchor = FALSE; /* no anchor highlighting */ 4059 4536 infoPtr->iVersion = 0; 4060 infoPtr->bNtfUnicode = FALSE;4061 4537 infoPtr->hwndSelf = hwnd; 4062 4538 infoPtr->bDoRedraw = TRUE; 4539 infoPtr->clrBtnHighlight = CLR_DEFAULT; 4540 infoPtr->clrBtnShadow = CLR_DEFAULT; 4541 infoPtr->szPadding.cx = 7; 4542 infoPtr->szPadding.cy = 6; 4543 TOOLBAR_NotifyFormat(infoPtr, (WPARAM)hwnd, (LPARAM)NF_REQUERY); 4063 4544 4064 4545 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); … … 4137 4618 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 4138 4619 NMTBCUSTOMDRAW tbcd; 4139 INT ret = FALSE, ntfret; 4620 INT ret = FALSE; 4621 DWORD ntfret; 4140 4622 4141 4623 if (dwStyle & TBSTYLE_CUSTOMERASE) { … … 4144 4626 tbcd.nmcd.hdc = (HDC)wParam; 4145 4627 ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); 4628 infoPtr->dwBaseCustDraw = ntfret & 0xffff; 4629 4146 4630 /* FIXME: in general the return flags *can* be or'ed together */ 4147 switch ( ntfret)4631 switch (infoPtr->dwBaseCustDraw) 4148 4632 { 4149 4633 case CDRF_DODEFAULT: … … 4152 4636 return TRUE; 4153 4637 default: 4154 FIXME("[%04x] response % d not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",4638 FIXME("[%04x] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n", 4155 4639 hwnd, ntfret); 4156 4640 } … … 4176 4660 ret = DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam); 4177 4661 4178 if (dwStyle & TBSTYLE_CUSTOMERASE) { 4662 if ((dwStyle & TBSTYLE_CUSTOMERASE) && 4663 (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) { 4179 4664 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); 4180 4665 tbcd.nmcd.dwDrawStage = CDDS_POSTERASE; 4181 4666 tbcd.nmcd.hdc = (HDC)wParam; 4182 4667 ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); 4183 switch (ntfret) 4668 infoPtr->dwBaseCustDraw = ntfret & 0xffff; 4669 switch (infoPtr->dwBaseCustDraw) 4184 4670 { 4185 4671 case CDRF_DODEFAULT: … … 4188 4674 return TRUE; 4189 4675 default: 4190 FIXME("[%04x] response % d not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",4676 FIXME("[%04x] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n", 4191 4677 hwnd, ntfret); 4192 4678 } … … 4345 4831 infoPtr->buttons[infoPtr->nHotItem].bHot = TRUE; 4346 4832 4347 if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) {4348 4833 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; 4349 4834 btnPtr->fsState &= ~TBSTATE_PRESSED; 4350 4835 4351 if (nHit == infoPtr->nButtonDown) { 4352 if (btnPtr->fsStyle & TBSTYLE_CHECK) { 4836 if (btnPtr->fsStyle & TBSTYLE_CHECK) { 4353 4837 if (btnPtr->fsStyle & TBSTYLE_GROUP) { 4354 4838 nOldIndex = TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, 4355 infoPtr->nButtonDown);4356 if (nOldIndex == infoPtr->nButtonDown)4839 nHit); 4840 if (nOldIndex == nHit) 4357 4841 bSendMessage = FALSE; 4358 if ((nOldIndex != infoPtr->nButtonDown) &&4842 if ((nOldIndex != nHit) && 4359 4843 (nOldIndex != -1)) 4360 4844 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED; … … 4367 4851 btnPtr->fsState |= TBSTATE_CHECKED; 4368 4852 } 4369 } 4370 } 4371 else 4372 bSendMessage = FALSE; 4853 } 4373 4854 4374 4855 if (nOldIndex != -1) … … 4383 4864 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 4384 4865 */ 4385 ReleaseCapture (); 4866 if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) 4867 ReleaseCapture (); 4386 4868 4387 4869 /* Issue NM_RELEASEDCAPTURE to parent to let him know it is released */ … … 4404 4886 TBN_ENDDRAG); 4405 4887 4406 if (bSendMessage) 4407 SendMessageA (infoPtr->hwndNotify, WM_COMMAND, 4408 MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd); 4888 SendMessageA (infoPtr->hwndNotify, WM_COMMAND, 4889 MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); 4409 4890 4410 4891 /* !!! Undocumented - toolbar at 4.71 level and above sends … … 4416 4897 TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, 4417 4898 NM_CLICK); 4418 }4419 4420 4899 return 0; 4421 4900 } … … 4488 4967 TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) 4489 4968 { 4490 TBUTTON_INFO *btnPtr , *oldBtnPtr;4969 TBUTTON_INFO *btnPtr = NULL, *oldBtnPtr = NULL; 4491 4970 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4492 4971 POINT pt; 4493 4972 INT nHit; 4494 4973 TRACKMOUSEEVENT trackinfo; 4974 NMTBHOTITEM nmhotitem; 4495 4975 4496 4976 /* fill in the TRACKMOUSEEVENT struct */ … … 4530 5010 oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit]; 4531 5011 oldBtnPtr->bHot = FALSE; 4532 4533 InvalidateRect (hwnd, &oldBtnPtr->rect, 4534 TOOLBAR_HasText(infoPtr, oldBtnPtr)); 4535 } 5012 } 4536 5013 4537 5014 /* It's not a separator or in nowhere. It's a hot button. */ … … 4546 5023 { 4547 5024 btnPtr->bHot = TRUE; 4548 InvalidateRect(hwnd, &btnPtr->rect,4549 TOOLBAR_HasText(infoPtr, btnPtr));4550 5025 } 4551 4552 } 4553 4554 if (infoPtr->bCaptured) { 5026 } 5027 5028 nmhotitem.dwFlags = HICF_MOUSE; 5029 if (oldBtnPtr) 5030 nmhotitem.idOld = oldBtnPtr->idCommand; 5031 else 5032 nmhotitem.dwFlags |= HICF_ENTERING; 5033 if (btnPtr) 5034 nmhotitem.idNew = btnPtr->idCommand; 5035 else 5036 nmhotitem.dwFlags |= HICF_LEAVING; 5037 TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE); 5038 5039 /* now invalidate the old and new buttons so they will be painted */ 5040 if (oldBtnPtr) 5041 InvalidateRect (hwnd, &oldBtnPtr->rect, 5042 TOOLBAR_HasText(infoPtr, oldBtnPtr)); 5043 if (btnPtr && (btnPtr->fsState & TBSTATE_ENABLED)) 5044 InvalidateRect(hwnd, &btnPtr->rect, 5045 TOOLBAR_HasText(infoPtr, btnPtr)); 5046 5047 if (infoPtr->bCaptured) { 4555 5048 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; 4556 5049 if (infoPtr->nOldHit == infoPtr->nButtonDown) { … … 4705 5198 4706 5199 if (lppgc->dwFlag == PGF_CALCWIDTH) { 4707 lppgc->iWidth = infoPtr-> nWidth;5200 lppgc->iWidth = infoPtr->rcBound.right - infoPtr->rcBound.left; 4708 5201 TRACE("processed PGN_CALCSIZE, returning horz size = %d\n", 4709 infoPtr->nWidth);5202 lppgc->iWidth); 4710 5203 } 4711 5204 else { 4712 lppgc->iHeight = infoPtr-> nHeight;5205 lppgc->iHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top; 4713 5206 TRACE("processed PGN_CALCSIZE, returning vert size = %d\n", 4714 infoPtr->nHeight);5207 lppgc->iHeight); 4715 5208 } 4716 5209 return 0; … … 4721 5214 4722 5215 if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) { 4723 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam); 5216 if (infoPtr->bNtfUnicode) 5217 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 5218 wParam, lParam); 5219 else 5220 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 5221 wParam, lParam); 4724 5222 4725 5223 #if 0 … … 4740 5238 4741 5239 return 0; 5240 } 5241 5242 5243 static LRESULT 5244 TOOLBAR_NotifyFormatFake(HWND hwnd, WPARAM wParam, LPARAM lParam) 5245 { 5246 /* remove this routine when Toolbar is improved to pass infoPtr 5247 * around instead of hwnd. 5248 */ 5249 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); 5250 return TOOLBAR_NotifyFormat(infoPtr, wParam, lParam); 5251 } 5252 5253 5254 static LRESULT 5255 TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 5256 { 5257 INT i; 5258 5259 if (lParam == NF_REQUERY) { 5260 i = SendMessageA(GetParent(infoPtr->hwndSelf), 5261 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY); 5262 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 5263 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 5264 i); 5265 i = NFR_ANSI; 5266 } 5267 infoPtr->bNtfUnicode = (i == NFR_UNICODE) ? 1 : 0; 5268 return (LRESULT)i; 5269 } 5270 return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI); 4742 5271 } 4743 5272 … … 4908 5437 4909 5438 5439 static LRESULT 5440 TOOLBAR_SysColorChange (HWND hwnd) 5441 { 5442 COMCTL32_RefreshSysColors(); 5443 5444 return 0; 5445 } 5446 5447 4910 5448 4911 5449 static LRESULT WINAPI … … 4989 5527 return TOOLBAR_GetButtonTextW (hwnd, wParam, lParam); 4990 5528 4991 /* case TB_GETCOLORSCHEME: */ /* 4.71 */4992 4993 5529 case TB_GETDISABLEDIMAGELIST: 4994 5530 return TOOLBAR_GetDisabledImageList (hwnd, wParam, lParam); … … 5016 5552 5017 5553 /* case TB_GETOBJECT: */ /* 4.71 */ 5018 /* case TB_GETPADDING: */ /* 4.71 */ 5554 5555 case TB_GETPADDING: 5556 return TOOLBAR_GetPadding (hwnd); 5019 5557 5020 5558 case TB_GETRECT: … … 5038 5576 case TB_GETUNICODEFORMAT: 5039 5577 return TOOLBAR_GetUnicodeFormat (hwnd, wParam, lParam); 5040 5041 case CCM_GETVERSION:5042 return TOOLBAR_GetVersion (hwnd);5043 5578 5044 5579 case TB_HIDEBUTTON: … … 5089 5624 return TOOLBAR_PressButton (hwnd, wParam, lParam); 5090 5625 5091 /* case TB_REPLACEBITMAP: */ 5626 case TB_REPLACEBITMAP: 5627 return TOOLBAR_ReplaceBitmap (hwnd, wParam, lParam); 5092 5628 5093 5629 case TB_SAVERESTOREA: … … 5118 5654 return TOOLBAR_SetCmdId (hwnd, wParam, lParam); 5119 5655 5120 /* case TB_SETCOLORSCHEME: */ /* 4.71 */5121 5122 5656 case TB_SETDISABLEDIMAGELIST: 5123 5657 return TOOLBAR_SetDisabledImageList (hwnd, wParam, lParam); … … 5149 5683 return TOOLBAR_SetMaxTextRows (hwnd, wParam, lParam); 5150 5684 5151 /* case TB_SETPADDING: */ /* 4.71 */ 5685 case TB_SETPADDING: 5686 return TOOLBAR_SetPadding (hwnd, wParam, lParam); 5152 5687 5153 5688 case TB_SETPARENT: … … 5169 5704 return TOOLBAR_SetUnicodeFormat (hwnd, wParam, lParam); 5170 5705 5706 case TB_UNKWN45E: 5707 return TOOLBAR_Unkwn45E (hwnd, wParam, lParam); 5708 5709 case TB_UNKWN463: 5710 return TOOLBAR_Unkwn463 (hwnd, wParam, lParam); 5711 5712 5713 /* Common Control Messages */ 5714 5715 /* case TB_GETCOLORSCHEME: */ /* identical to CCM_ */ 5716 case CCM_GETCOLORSCHEME: 5717 return TOOLBAR_GetColorScheme (hwnd, (LPCOLORSCHEME)lParam); 5718 5719 /* case TB_SETCOLORSCHEME: */ /* identical to CCM_ */ 5720 case CCM_SETCOLORSCHEME: 5721 return TOOLBAR_SetColorScheme (hwnd, (LPCOLORSCHEME)lParam); 5722 5723 case CCM_GETVERSION: 5724 return TOOLBAR_GetVersion (hwnd); 5725 5171 5726 case CCM_SETVERSION: 5172 5727 return TOOLBAR_SetVersion (hwnd, (INT)wParam); … … 5223 5778 return TOOLBAR_Notify (hwnd, wParam, lParam); 5224 5779 5225 /* case WM_NOTIFYFORMAT: */ 5780 case WM_NOTIFYFORMAT: 5781 TOOLBAR_NotifyFormatFake (hwnd, wParam, lParam); 5226 5782 5227 5783 case WM_PAINT: … … 5237 5793 return TOOLBAR_StyleChanged (hwnd, (INT)wParam, (LPSTYLESTRUCT)lParam); 5238 5794 5239 /* case WM_SYSCOLORCHANGE: */ 5795 case WM_SYSCOLORCHANGE: 5796 return TOOLBAR_SysColorChange (hwnd); 5240 5797 5241 5798 /* case WM_WININICHANGE: */ … … 5254 5811 } 5255 5812 5813 /* We see this in Outlook Express 5.x and just does DefWindowProc */ 5814 case PGM_FORWARDMOUSE: 5815 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 5816 5256 5817 default: 5257 5818 if (uMsg >= WM_USER)
Note:
See TracChangeset
for help on using the changeset viewer.