Changeset 110 for trunk/src/comctl32/toolbar.c
- Timestamp:
- Jun 16, 1999, 10:25:45 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/toolbar.c
r94 r110 1 /* $Id: toolbar.c,v 1. 4 1999-06-10 16:22:02 achimhaExp $ */1 /* $Id: toolbar.c,v 1.5 1999-06-16 20:25:43 cbratschi Exp $ */ 2 2 /* 3 3 * Toolbar control … … 5 5 * Copyright 1998,1999 Eric Kohl 6 6 * Copyright 1999 Achim Hasenmueller 7 * Copyright 1999 Christoph Bratschi 7 8 * 8 9 * TODO: … … 65 66 static void 66 67 TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 67 68 HDC hdc, INT nState) 68 69 { 69 70 RECT rcText = btnPtr->rect; … … 74 75 /* draw text */ 75 76 if ((btnPtr->iString > -1) && (btnPtr->iString < infoPtr->nNumStrings)) { 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 77 InflateRect (&rcText, -3, -3); 78 rcText.top += infoPtr->nBitmapHeight; 79 if (nState & (TBSTATE_PRESSED | TBSTATE_CHECKED)) 80 OffsetRect (&rcText, 1, 1); 81 82 hOldFont = SelectObject (hdc, infoPtr->hFont); 83 nOldBkMode = SetBkMode (hdc, TRANSPARENT); 84 if (!(nState & TBSTATE_ENABLED)) { 85 clrOld = SetTextColor (hdc, GetSysColor (COLOR_3DHILIGHT)); 86 OffsetRect (&rcText, 1, 1); 87 DrawTextW (hdc, infoPtr->strings[btnPtr->iString], -1, 88 &rcText, infoPtr->dwDTFlags); 89 SetTextColor (hdc, GetSysColor (COLOR_3DSHADOW)); 90 OffsetRect (&rcText, -1, -1); 91 DrawTextW (hdc, infoPtr->strings[btnPtr->iString], -1, 92 &rcText, infoPtr->dwDTFlags); 93 } 94 else if (nState & TBSTATE_INDETERMINATE) { 95 clrOld = SetTextColor (hdc, GetSysColor (COLOR_3DSHADOW)); 96 DrawTextW (hdc, infoPtr->strings[btnPtr->iString], -1, 97 &rcText, infoPtr->dwDTFlags); 98 } 99 else { 100 clrOld = SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT)); 101 DrawTextW (hdc, infoPtr->strings[btnPtr->iString], -1, 102 &rcText, infoPtr->dwDTFlags); 103 } 104 105 SetTextColor (hdc, clrOld); 106 SelectObject (hdc, hOldFont); 107 if (nOldBkMode != TRANSPARENT) 108 SetBkMode (hdc, nOldBkMode); 108 109 } 109 110 } … … 123 124 static void 124 125 TOOLBAR_DrawMasked (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 125 126 HDC hdc, INT x, INT y) 126 127 { 127 128 /* FIXME: this function is a hack since it uses image list 128 129 internals directly */ 129 130 130 131 HDC hdcImageList = CreateCompatibleDC (0); … … 142 143 SetTextColor (hdcImageList, RGB(0, 0, 0)); 143 144 BitBlt (hdcMask, 0, 0, himl->cx, himl->cy, 144 145 hdcImageList, himl->cx * btnPtr->iBitmap, 0, SRCCOPY); 145 146 146 147 #if 0 … … 149 150 SetBkColor (hdcImageList, RGB(0, 0, 0)); 150 151 BitBlt (hdcMask, 0, 0, himl->cx, himl->cy, 151 152 hdcImageList, himl->cx * btnPtr->iBitmap, 0, MERGEPAINT); 152 153 #endif 153 154 … … 155 156 SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT)); 156 157 BitBlt (hdc, x+1, y+1, himl->cx, himl->cy, 157 158 hdcMask, 0, 0, 0xB8074A); 158 159 159 160 SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW)); 160 161 BitBlt (hdc, x, y, himl->cx, himl->cy, 161 162 hdcMask, 0, 0, 0xB8074A); 162 163 163 164 DeleteObject (hbmMask); … … 175 176 176 177 if (btnPtr->fsState & TBSTATE_HIDDEN) 177 178 return; 178 179 179 180 rc = btnPtr->rect; 180 181 if (btnPtr->fsStyle & TBSTYLE_SEP) { 181 182 183 182 if ((dwStyle & TBSTYLE_FLAT) && (btnPtr->idCommand == 0)) 183 TOOLBAR_DrawFlatSeparator (&btnPtr->rect, hdc); 184 return; 184 185 } 185 186 186 187 /* disabled */ 187 188 if (!(btnPtr->fsState & TBSTATE_ENABLED)) { 188 189 190 191 192 /* 193 194 195 /* 196 /* 197 198 199 200 201 202 189 DrawEdge (hdc, &rc, EDGE_RAISED, 190 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 191 192 if (dwStyle & TBSTYLE_FLAT) { 193 /* if (infoPtr->himlDis) */ 194 ImageList_Draw (infoPtr->himlDis, btnPtr->iBitmap, hdc, 195 rc.left+1, rc.top+1, ILD_NORMAL); 196 /* else */ 197 /* TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rc.left+1, rc.top+1); */ 198 } 199 else 200 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rc.left+1, rc.top+1); 201 202 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState); 203 return; 203 204 } 204 205 205 206 /* pressed TBSTYLE_BUTTON */ 206 207 if (btnPtr->fsState & TBSTATE_PRESSED) { 207 208 209 210 211 208 DrawEdge (hdc, &rc, EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_ADJUST); 209 ImageList_Draw (infoPtr->himlStd, btnPtr->iBitmap, hdc, 210 rc.left+2, rc.top+2, ILD_NORMAL); 211 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState); 212 return; 212 213 } 213 214 214 215 /* checked TBSTYLE_CHECK*/ 215 216 if ((btnPtr->fsStyle & TBSTYLE_CHECK) && 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 } 240 241 /* indeterminate */ 217 (btnPtr->fsState & TBSTATE_CHECKED)) { 218 if (dwStyle & TBSTYLE_FLAT) 219 DrawEdge (hdc, &rc, BDR_SUNKENOUTER, 220 BF_RECT | BF_MIDDLE | BF_ADJUST); 221 else 222 DrawEdge (hdc, &rc, EDGE_SUNKEN, 223 BF_RECT | BF_MIDDLE | BF_ADJUST); 224 225 TOOLBAR_DrawPattern (hdc, &rc); 226 if (dwStyle & TBSTYLE_FLAT) 227 { 228 if (infoPtr->himlDef != NULL) 229 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc, 230 rc.left+2, rc.top+2, ILD_NORMAL); 231 else 232 ImageList_Draw (infoPtr->himlStd, btnPtr->iBitmap, hdc, 233 rc.left+2, rc.top+2, ILD_NORMAL); 234 } 235 else 236 ImageList_Draw (infoPtr->himlStd, btnPtr->iBitmap, hdc, 237 rc.left+2, rc.top+2, ILD_NORMAL); 238 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState); 239 return; 240 } 241 242 /* indeterminate */ 242 243 if (btnPtr->fsState & TBSTATE_INDETERMINATE) { 243 244 245 246 247 248 249 244 DrawEdge (hdc, &rc, EDGE_RAISED, 245 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 246 247 TOOLBAR_DrawPattern (hdc, &rc); 248 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rc.left+1, rc.top+1); 249 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState); 250 return; 250 251 } 251 252 252 253 if (dwStyle & TBSTYLE_FLAT) 253 254 { 254 255 256 257 258 259 260 261 262 263 255 if(btnPtr->bHot) 256 DrawEdge (hdc, &rc, BDR_RAISEDINNER, 257 BF_RECT | BF_MIDDLE | BF_SOFT); 258 259 if(infoPtr->himlDef != NULL) 260 ImageList_Draw (infoPtr->himlDef, btnPtr->iBitmap, hdc, 261 rc.left +2, rc.top +2, ILD_NORMAL); 262 else 263 ImageList_Draw (infoPtr->himlStd, btnPtr->iBitmap, hdc, 264 rc.left +2, rc.top +2, ILD_NORMAL); 264 265 } 265 266 else{ 266 267 /* normal state */ 267 268 DrawEdge (hdc, &rc, EDGE_RAISED, 268 269 270 271 269 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 270 271 ImageList_Draw (infoPtr->himlStd, btnPtr->iBitmap, hdc, 272 rc.left+1, rc.top+1, ILD_NORMAL); 272 273 } 273 274 … … 286 287 btnPtr = infoPtr->buttons; 287 288 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) 288 289 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 289 290 } 290 291 … … 307 308 btnPtr = infoPtr->buttons; 308 309 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { 309 310 311 312 313 314 315 316 317 318 310 if (!(btnPtr->fsState & TBSTATE_HIDDEN) && 311 (btnPtr->iString > -1) && 312 (btnPtr->iString < infoPtr->nNumStrings)) { 313 LPWSTR lpText = infoPtr->strings[btnPtr->iString]; 314 GetTextExtentPoint32W (hdc, lpText, lstrlenW (lpText), &sz); 315 if (sz.cx > lpSize->cx) 316 lpSize->cx = sz.cx; 317 if (sz.cy > lpSize->cy) 318 lpSize->cy = sz.cy; 319 } 319 320 } 320 321 … … 326 327 327 328 /*********************************************************************** 328 * 329 * TOOLBAR_WrapToolbar 329 330 * 330 * This function walks through the buttons and seperators in the 331 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 332 * wrapping should occur based on the width of the toolbar window. 333 * It does *not* calculate button placement itself. That task 334 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 335 * the toolbar wrapping on it's own, it can use the TBSTYLE_WRAPPABLE 331 * This function walks through the buttons and seperators in the 332 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 333 * wrapping should occur based on the width of the toolbar window. 334 * It does *not* calculate button placement itself. That task 335 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 336 * the toolbar wrapping on it's own, it can use the TBSTYLE_WRAPPABLE 336 337 * flag, and set the TBSTATE_WRAP flags manually on the appropriate items. 337 */ 338 */ 338 339 339 340 static void … … 347 348 BOOL bWrap, bButtonWrap; 348 349 349 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */350 /* 351 /* to perform their own layout on the toolbar.*/350 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ 351 /* no layout is necessary. Applications may use this style */ 352 /* to perform their own layout on the toolbar. */ 352 353 if( !(dwStyle & TBSTYLE_WRAPABLE) ) 353 354 return; 354 355 355 356 btnPtr = infoPtr->buttons; … … 362 363 for (i = 0; i < infoPtr->nNumButtons; i++ ) 363 364 { 364 365 366 367 368 369 370 371 372 373 374 cx = (btnPtr[i].iBitmap > 0) ? 375 376 377 378 379 /* Two or more adjacent separators form a separator group. */ 380 381 /* next row if the previous wrapping is on a button.*/382 383 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 384 385 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 386 387 388 389 390 391 392 393 394 395 if ( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 396 > infoPtr->nWidth ) 397 398 399 400 /* If the current button is a separator and not hidden, */ 401 /*go to the next until it reaches a non separator. */402 /*Wrap the last separator if it is before a button. */403 while( ( (btnPtr[i].fsStyle & TBSTYLE_SEP) || 404 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 /* If the current button is not a separator, find the last */ 423 /* separator and wrap it.*/424 425 426 427 428 429 bFound = TRUE; 430 i = j; 431 432 433 bButtonWrap = FALSE; 434 435 436 437 438 /* If no separator available for wrapping, wrap one of*/439 /* non-hidden previous button.*/440 441 442 for ( j = i - 1; 443 444 445 if (btnPtr[j].fsState & TBSTATE_HIDDEN) 446 447 448 bFound = TRUE; 449 i = j; 450 451 452 453 454 455 456 457 458 if (!bFound) 459 460 461 462 463 464 465 466 467 } 468 469 470 471 } 472 } 473 365 bWrap = FALSE; 366 btnPtr[i].fsState &= ~TBSTATE_WRAP; 367 368 if (btnPtr[i].fsState & TBSTATE_HIDDEN) 369 continue; 370 371 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ 372 /* it is the actual width of the separator. This is used for */ 373 /* custom controls in toolbars. */ 374 if (btnPtr[i].fsStyle & TBSTYLE_SEP) 375 cx = (btnPtr[i].iBitmap > 0) ? 376 btnPtr[i].iBitmap : SEPARATOR_WIDTH; 377 else 378 cx = infoPtr->nButtonWidth; 379 380 /* Two or more adjacent separators form a separator group. */ 381 /* The first separator in a group should be wrapped to the */ 382 /* next row if the previous wrapping is on a button. */ 383 if( bButtonWrap && 384 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 385 (i + 1 < infoPtr->nNumButtons ) && 386 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 387 { 388 btnPtr[i].fsState |= TBSTATE_WRAP; 389 x = infoPtr->nIndent; 390 i++; 391 bButtonWrap = FALSE; 392 continue; 393 } 394 395 /* The layout makes sure the bitmap is visible, but not the button. */ 396 if ( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 397 > infoPtr->nWidth ) 398 { 399 BOOL bFound = FALSE; 400 401 /* If the current button is a separator and not hidden, */ 402 /* go to the next until it reaches a non separator. */ 403 /* Wrap the last separator if it is before a button. */ 404 while( ( (btnPtr[i].fsStyle & TBSTYLE_SEP) || 405 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && 406 i < infoPtr->nNumButtons ) 407 { 408 i++; 409 bFound = TRUE; 410 } 411 412 if( bFound && i < infoPtr->nNumButtons ) 413 { 414 i--; 415 btnPtr[i].fsState |= TBSTATE_WRAP; 416 x = infoPtr->nIndent; 417 bButtonWrap = FALSE; 418 continue; 419 } 420 else if ( i >= infoPtr->nNumButtons) 421 break; 422 423 /* If the current button is not a separator, find the last */ 424 /* separator and wrap it. */ 425 for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) 426 { 427 if ((btnPtr[j].fsStyle & TBSTYLE_SEP) && 428 !(btnPtr[j].fsState & TBSTATE_HIDDEN)) 429 { 430 bFound = TRUE; 431 i = j; 432 x = infoPtr->nIndent; 433 btnPtr[j].fsState |= TBSTATE_WRAP; 434 bButtonWrap = FALSE; 435 break; 436 } 437 } 438 439 /* If no separator available for wrapping, wrap one of */ 440 /* non-hidden previous button. */ 441 if (!bFound) 442 { 443 for ( j = i - 1; 444 j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) 445 { 446 if (btnPtr[j].fsState & TBSTATE_HIDDEN) 447 continue; 448 449 bFound = TRUE; 450 i = j; 451 x = infoPtr->nIndent; 452 btnPtr[j].fsState |= TBSTATE_WRAP; 453 bButtonWrap = TRUE; 454 break; 455 } 456 } 457 458 /* If all above failed, wrap the current button. */ 459 if (!bFound) 460 { 461 btnPtr[i].fsState |= TBSTATE_WRAP; 462 bFound = TRUE; 463 x = infoPtr->nIndent; 464 if (btnPtr[i].fsState & TBSTYLE_SEP ) 465 bButtonWrap = FALSE; 466 else 467 bButtonWrap = TRUE; 468 } 469 } 470 else 471 x += cx; 472 } 473 } 474 474 475 /*********************************************************************** 475 * 476 * TOOLBAR_CalcToolbar 476 477 * 477 * This function calculates button and separator placement. It first 478 * calculates the button sizes, gets the toolbar window width and then 479 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 478 * This function calculates button and separator placement. It first 479 * calculates the button sizes, gets the toolbar window width and then 480 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 480 481 * on. It assigns a new location to each item and sends this location to 481 * the tooltip window if appropriate. Finally, it updates the rcBound 482 * rect and calculates the new required toolbar window height. 483 */ 482 * the tooltip window if appropriate. Finally, it updates the rcBound 483 * rect and calculates the new required toolbar window height. 484 */ 484 485 485 486 static void … … 497 498 498 499 if (sizeString.cy > 0) 499 500 infoPtr->nButtonHeight = sizeString.cy + infoPtr->nBitmapHeight + 6; 500 501 else if (infoPtr->nButtonHeight < infoPtr->nBitmapHeight + 6) 501 502 infoPtr->nButtonHeight = infoPtr->nBitmapHeight + 6; 502 503 503 504 if (sizeString.cx > infoPtr->nBitmapWidth) 504 505 infoPtr->nButtonWidth = sizeString.cx + 6; 505 506 else if (infoPtr->nButtonWidth < infoPtr->nBitmapWidth + 6) 506 507 infoPtr->nButtonWidth = infoPtr->nBitmapWidth + 6; 507 508 508 509 TOOLBAR_WrapToolbar( hwnd ); … … 525 526 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++ ) 526 527 { 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 557 558 559 560 561 562 563 564 565 566 567 568 569 /* btnPtr->nRow is zero based. The space between the rows is*/570 /* also considered as a row.*/571 572 573 574 575 576 else 577 { 578 579 580 /* custom controls in toolbars.*/581 y += cy + ( (btnPtr->iBitmap > 0 ) ? 582 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 583 584 /* nSepRows is used to calculate the extra height follwoing */ 585 /* the last row.*/586 587 588 589 590 591 592 528 bWrap = FALSE; 529 if (btnPtr->fsState & TBSTATE_HIDDEN) 530 { 531 SetRectEmpty (&btnPtr->rect); 532 continue; 533 } 534 535 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ 536 /* it is the actual width of the separator. This is used for */ 537 /* custom controls in toolbars. */ 538 if (btnPtr->fsStyle & TBSTYLE_SEP) 539 cx = (btnPtr->iBitmap > 0) ? 540 btnPtr->iBitmap : SEPARATOR_WIDTH; 541 else 542 cx = infoPtr->nButtonWidth; 543 544 if (btnPtr->fsState & TBSTATE_WRAP ) 545 bWrap = TRUE; 546 547 SetRect (&btnPtr->rect, x, y, x + cx, y + cy); 548 549 if (infoPtr->rcBound.left > x) 550 infoPtr->rcBound.left = x; 551 if (infoPtr->rcBound.right < x + cx) 552 infoPtr->rcBound.right = x + cx; 553 if (infoPtr->rcBound.bottom < y + cy) 554 infoPtr->rcBound.bottom = y + cy; 555 556 /* Set the toolTip only for non-hidden, non-separator button */ 557 if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 558 { 559 TTTOOLINFOA ti; 560 561 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 562 ti.cbSize = sizeof(TTTOOLINFOA); 563 ti.hwnd = hwnd; 564 ti.uId = btnPtr->idCommand; 565 ti.rect = btnPtr->rect; 566 SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA, 567 0, (LPARAM)&ti); 568 } 569 570 /* btnPtr->nRow is zero based. The space between the rows is */ 571 /* also considered as a row. */ 572 btnPtr->nRow = nRows + nSepRows; 573 if( bWrap ) 574 { 575 if ( !(btnPtr->fsStyle & TBSTYLE_SEP) ) 576 y += cy; 577 else 578 { 579 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ 580 /* it is the actual width of the separator. This is used for */ 581 /* custom controls in toolbars. */ 582 y += cy + ( (btnPtr->iBitmap > 0 ) ? 583 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 584 585 /* nSepRows is used to calculate the extra height follwoing */ 586 /* the last row. */ 587 nSepRows++; 588 } 589 x = infoPtr->nIndent; 590 nRows++; 591 } 592 else 593 x += cx; 593 594 } 594 595 … … 596 597 infoPtr->nRows = nRows + nSepRows + 1; 597 598 598 /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following 599 /* the last row. 600 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 601 602 nSepRows * (infoPtr->nBitmapHeight + 1) + 603 BOTTOM_BORDER; 599 /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following */ 600 /* the last row. */ 601 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 602 nSepRows * SEPARATOR_WIDTH * 2 / 3 + 603 nSepRows * (infoPtr->nBitmapHeight + 1) + 604 BOTTOM_BORDER; 604 605 // TRACE (toolbar, "toolbar height %d\n", infoPtr->nHeight); 605 606 } … … 612 613 TBUTTON_INFO *btnPtr; 613 614 INT i; 614 615 615 616 btnPtr = infoPtr->buttons; 616 617 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { 617 618 619 620 621 622 // 623 624 625 626 627 628 // 629 630 631 618 if (btnPtr->fsState & TBSTATE_HIDDEN) 619 continue; 620 621 if (btnPtr->fsStyle & TBSTYLE_SEP) { 622 if (PtInRect (&btnPtr->rect, *lpPt)) { 623 // TRACE (toolbar, " ON SEPARATOR %d!\n", i); 624 return -i; 625 } 626 } 627 else { 628 if (PtInRect (&btnPtr->rect, *lpPt)) { 629 // TRACE (toolbar, " ON BUTTON %d!\n", i); 630 return i; 631 } 632 } 632 633 } 633 634 … … 645 646 btnPtr = infoPtr->buttons; 646 647 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { 647 648 // 649 650 648 if (btnPtr->idCommand == idCommand) { 649 // TRACE (toolbar, "command=%d index=%d\n", idCommand, i); 650 return i; 651 } 651 652 } 652 653 // TRACE (toolbar, "no index found for command=%d\n", idCommand); … … 662 663 663 664 if ((nIndex < 0) || (nIndex > infoPtr->nNumButtons)) 664 665 return -1; 665 666 666 667 /* check index button */ 667 668 btnPtr = &infoPtr->buttons[nIndex]; 668 669 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { 669 670 670 if (btnPtr->fsState & TBSTATE_CHECKED) 671 return nIndex; 671 672 } 672 673 … … 674 675 nRunIndex = nIndex - 1; 675 676 while (nRunIndex >= 0) { 676 677 678 679 680 681 682 683 677 btnPtr = &infoPtr->buttons[nRunIndex]; 678 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { 679 if (btnPtr->fsState & TBSTATE_CHECKED) 680 return nRunIndex; 681 } 682 else 683 break; 684 nRunIndex--; 684 685 } 685 686 … … 687 688 nRunIndex = nIndex + 1; 688 689 while (nRunIndex < infoPtr->nNumButtons) { 689 btnPtr = &infoPtr->buttons[nRunIndex]; 690 691 692 693 694 695 696 690 btnPtr = &infoPtr->buttons[nRunIndex]; 691 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { 692 if (btnPtr->fsState & TBSTATE_CHECKED) 693 return nRunIndex; 694 } 695 else 696 break; 697 nRunIndex++; 697 698 } 698 699 … … 703 704 static VOID 704 705 TOOLBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, 705 706 WPARAM wParam, LPARAM lParam) 706 707 { 707 708 MSG msg; … … 731 732 switch (uMsg) 732 733 { 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 /* copy all buttons and append them to the right listbox */ 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 // 798 // lpdis->itemAction, lpdis->itemState);799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 734 case WM_INITDIALOG: 735 infoPtr = (TOOLBAR_INFO *)lParam; 736 SetWindowLongA (hwnd, DWL_USER, (DWORD)infoPtr); 737 738 hDsa = DSA_Create (sizeof(TBUTTON_INFO), 5); 739 740 if (infoPtr) 741 { 742 TBUTTON_INFO *btnPtr; 743 INT i; 744 745 /* insert 'virtual' separator button into 'available buttons' list */ 746 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)""); 747 748 /* copy all buttons and append them to the right listbox */ 749 btnPtr = infoPtr->buttons; 750 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) 751 { 752 DSA_InsertItem (hDsa, i, btnPtr); 753 754 if (btnPtr->fsState & TBSTATE_HIDDEN) 755 { 756 SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)""); 757 } 758 else 759 { 760 SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, (LPARAM)""); 761 } 762 } 763 764 /* append 'virtual' sepatator button to the 'toolbar buttons' list */ 765 /* TODO */ 766 } 767 return TRUE; 768 769 case WM_CLOSE: 770 EndDialog(hwnd, FALSE); 771 return TRUE; 772 773 case WM_COMMAND: 774 switch (LOWORD(wParam)) 775 { 776 case IDCANCEL: 777 EndDialog(hwnd, FALSE); 778 break; 779 } 780 return TRUE; 781 782 case WM_DESTROY: 783 if (hDsa) 784 DSA_Destroy (hDsa); 785 return TRUE; 786 787 case WM_DRAWITEM: 788 if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX) 789 { 790 LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam; 791 RECT rcButton; 792 RECT rcText; 793 HPEN hOldPen; 794 HBRUSH hOldBrush; 795 COLORREF oldText = 0; 796 COLORREF oldBk = 0; 797 798 // FIXME(toolbar, "action: %x itemState: %x\n", 799 // lpdis->itemAction, lpdis->itemState); 800 801 if (lpdis->itemState & ODS_FOCUS) 802 { 803 oldBk = SetBkColor (lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT)); 804 oldText = SetTextColor (lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); 805 } 806 807 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 808 hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 809 810 /* fill background rectangle */ 811 Rectangle (lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, 812 lpdis->rcItem.right, lpdis->rcItem.bottom); 813 814 /* calculate button and text rectangles */ 815 CopyRect (&rcButton, &lpdis->rcItem); 816 InflateRect (&rcButton, -1, -1); 817 CopyRect (&rcText, &rcButton); 818 rcButton.right = rcButton.left + infoPtr->nBitmapWidth + 6; 819 rcText.left = rcButton.right + 2; 820 821 /* draw focus rectangle */ 822 if (lpdis->itemState & ODS_FOCUS) 823 DrawFocusRect (lpdis->hDC, &lpdis->rcItem); 824 825 /* draw button */ 826 DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT); 827 828 /* draw text */ 829 if (wParam == IDC_AVAILBTN_LBOX && lpdis->itemID == 0) 830 DrawTextA (lpdis->hDC, "Separator", -1, &rcText, 831 DT_LEFT | DT_VCENTER | DT_SINGLELINE); 832 833 if (lpdis->itemState & ODS_FOCUS) 834 { 835 SetBkColor (lpdis->hDC, oldBk); 836 SetTextColor (lpdis->hDC, oldText); 837 } 838 839 SelectObject (lpdis->hDC, hOldBrush); 840 SelectObject (lpdis->hDC, hOldPen); 841 842 return TRUE; 843 } 844 return FALSE; 845 846 case WM_MEASUREITEM: 847 if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX) 848 { 849 MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam; 850 851 if (infoPtr) 852 lpmis->itemHeight = infoPtr->nBitmapHeight + 8; 853 else 854 lpmis->itemHeight = 16 + 8; /* default height */ 855 856 return TRUE; 857 } 858 return FALSE; 859 860 default: 861 return FALSE; 861 862 } 862 863 } … … 875 876 876 877 if ((!lpAddBmp) || ((INT)wParam <= 0)) 877 878 return -1; 878 879 879 880 // TRACE (toolbar, "adding %d bitmaps!\n", wParam); 880 881 881 882 if (!(infoPtr->himlStd)) { 882 883 884 // 885 886 887 888 889 890 891 892 if (lpAddBmp->nID & 1) 893 894 895 896 897 898 899 else 900 901 902 903 904 905 906 907 908 909 910 911 912 913 883 /* create new standard image list */ 884 885 // TRACE (toolbar, "creating standard image list!\n"); 886 887 888 /* Windows resize all the buttons to the size of a newly added STandard Image*/ 889 /* TODO: The resizing should be done each time a standard image is added*/ 890 if (lpAddBmp->hInst == HINST_COMMCTRL) 891 { 892 893 if (lpAddBmp->nID & 1) 894 { 895 SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, 896 MAKELPARAM((WORD)26, (WORD)26)); 897 SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, 898 MAKELPARAM((WORD)33, (WORD)33)); 899 } 900 else 901 { 902 SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, 903 MAKELPARAM((WORD)16, (WORD)16)); 904 905 SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, 906 MAKELPARAM((WORD)22, (WORD)22)); 907 } 908 909 TOOLBAR_CalcToolbar (hwnd); 910 } 911 912 infoPtr->himlStd = 913 ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight, 914 ILC_COLOR | ILC_MASK, (INT)wParam, 2); 914 915 } 915 916 916 917 /* Add bitmaps to the standard image list */ 917 918 if (lpAddBmp->hInst == (HINSTANCE)0) { 918 nIndex = 919 920 919 nIndex = 920 ImageList_AddMasked (infoPtr->himlStd, (HBITMAP)lpAddBmp->nID, 921 CLR_DEFAULT); 921 922 } 922 923 else if (lpAddBmp->hInst == HINST_COMMCTRL) { 923 924 925 // 926 927 928 /* Hack to "add" some reserved images within the image list 929 930 931 932 924 /* add internal bitmaps */ 925 926 // FIXME (toolbar, "internal bitmaps not supported!\n"); 927 /* TODO: Resize all the buttons when a new standard image is added */ 928 929 /* Hack to "add" some reserved images within the image list 930 to get the right image indices */ 931 nIndex = ImageList_GetImageCount (infoPtr->himlStd); 932 ImageList_SetImageCount (infoPtr->himlStd, nIndex + (INT)wParam); 933 933 934 } 934 935 else { 935 936 937 938 939 DeleteObject (hBmp); 936 HBITMAP hBmp = 937 LoadBitmapA (lpAddBmp->hInst, (LPSTR)lpAddBmp->nID); 938 nIndex = ImageList_AddMasked (infoPtr->himlStd, hBmp, CLR_DEFAULT); 939 940 DeleteObject (hBmp); 940 941 } 941 942 … … 960 961 961 962 if (infoPtr->nNumButtons == 0) { 962 963 963 infoPtr->buttons = 964 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons); 964 965 } 965 966 else { 966 967 968 969 970 967 TBUTTON_INFO *oldButtons = infoPtr->buttons; 968 infoPtr->buttons = 969 COMCTL32_Alloc (sizeof(TBUTTON_INFO) * nNewButtons); 970 memcpy (&infoPtr->buttons[0], &oldButtons[0], 971 nOldButtons * sizeof(TBUTTON_INFO)); 971 972 COMCTL32_Free (oldButtons); 972 973 } … … 976 977 /* insert new button data */ 977 978 for (nCount = 0; nCount < nAddButtons; nCount++) { 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 979 TBUTTON_INFO *btnPtr = &infoPtr->buttons[nOldButtons+nCount]; 980 btnPtr->iBitmap = lpTbb[nCount].iBitmap; 981 btnPtr->idCommand = lpTbb[nCount].idCommand; 982 btnPtr->fsState = lpTbb[nCount].fsState; 983 btnPtr->fsStyle = lpTbb[nCount].fsStyle; 984 btnPtr->dwData = lpTbb[nCount].dwData; 985 btnPtr->iString = lpTbb[nCount].iString; 986 btnPtr->bHot = FALSE; 987 988 if ((infoPtr->hwndToolTip) && !(btnPtr->fsStyle & TBSTYLE_SEP)) { 989 TTTOOLINFOA ti; 990 991 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 992 ti.cbSize = sizeof (TTTOOLINFOA); 993 ti.hwnd = hwnd; 994 ti.uId = btnPtr->idCommand; 995 ti.hinst = 0; 996 ti.lpszText = LPSTR_TEXTCALLBACKA; 997 998 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA, 999 0, (LPARAM)&ti); 1000 } 1000 1001 } 1001 1002 … … 1018 1019 1019 1020 if ((wParam) && (HIWORD(lParam) == 0)) { 1020 1021 1022 // 1023 1024 1025 1026 1027 // 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1021 char szString[256]; 1022 INT len; 1023 // TRACE (toolbar, "adding string from resource!\n"); 1024 1025 len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam, 1026 szString, 256); 1027 1028 // TRACE (toolbar, "len=%d \"%s\"\n", len, szString); 1029 nIndex = infoPtr->nNumStrings; 1030 if (infoPtr->nNumStrings == 0) { 1031 infoPtr->strings = 1032 COMCTL32_Alloc (sizeof(LPWSTR)); 1033 } 1034 else { 1035 LPWSTR *oldStrings = infoPtr->strings; 1036 infoPtr->strings = 1037 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 1038 memcpy (&infoPtr->strings[0], &oldStrings[0], 1039 sizeof(LPWSTR) * infoPtr->nNumStrings); 1040 COMCTL32_Free (oldStrings); 1041 } 1042 1043 infoPtr->strings[infoPtr->nNumStrings] = 1044 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 1045 lstrcpyAtoW (infoPtr->strings[infoPtr->nNumStrings], szString); 1046 infoPtr->nNumStrings++; 1046 1047 } 1047 1048 else { 1048 1049 1050 1051 1052 1053 // 1054 1055 1056 1057 // 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1049 LPSTR p = (LPSTR)lParam; 1050 INT len; 1051 1052 if (p == NULL) 1053 return -1; 1054 // TRACE (toolbar, "adding string(s) from array!\n"); 1055 nIndex = infoPtr->nNumStrings; 1056 while (*p) { 1057 len = lstrlenA (p); 1058 // TRACE (toolbar, "len=%d \"%s\"\n", len, p); 1059 1060 if (infoPtr->nNumStrings == 0) { 1061 infoPtr->strings = 1062 COMCTL32_Alloc (sizeof(LPWSTR)); 1063 } 1064 else { 1065 LPWSTR *oldStrings = infoPtr->strings; 1066 infoPtr->strings = 1067 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 1068 memcpy (&infoPtr->strings[0], &oldStrings[0], 1069 sizeof(LPWSTR) * infoPtr->nNumStrings); 1070 COMCTL32_Free (oldStrings); 1071 } 1072 1073 infoPtr->strings[infoPtr->nNumStrings] = 1074 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 1075 lstrcpyAtoW (infoPtr->strings[infoPtr->nNumStrings], p); 1076 infoPtr->nNumStrings++; 1077 1078 p += (len+1); 1079 } 1079 1080 } 1080 1081 … … 1090 1091 1091 1092 if ((wParam) && (HIWORD(lParam) == 0)) { 1092 1093 1094 // 1095 1096 1097 1098 1099 // 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1093 WCHAR szString[256]; 1094 INT len; 1095 // TRACE (toolbar, "adding string from resource!\n"); 1096 1097 len = LoadStringW ((HINSTANCE)wParam, (UINT)lParam, 1098 szString, 256); 1099 1100 // TRACE (toolbar, "len=%d \"%s\"\n", len, debugstr_w(szString)); 1101 nIndex = infoPtr->nNumStrings; 1102 if (infoPtr->nNumStrings == 0) { 1103 infoPtr->strings = 1104 COMCTL32_Alloc (sizeof(LPWSTR)); 1105 } 1106 else { 1107 LPWSTR *oldStrings = infoPtr->strings; 1108 infoPtr->strings = 1109 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 1110 memcpy (&infoPtr->strings[0], &oldStrings[0], 1111 sizeof(LPWSTR) * infoPtr->nNumStrings); 1112 COMCTL32_Free (oldStrings); 1113 } 1114 1115 infoPtr->strings[infoPtr->nNumStrings] = 1116 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 1117 lstrcpyW (infoPtr->strings[infoPtr->nNumStrings], szString); 1118 infoPtr->nNumStrings++; 1118 1119 } 1119 1120 else { 1120 1121 1122 1123 1124 1125 // 1126 1127 1128 1129 // 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1121 LPWSTR p = (LPWSTR)lParam; 1122 INT len; 1123 1124 if (p == NULL) 1125 return -1; 1126 // TRACE (toolbar, "adding string(s) from array!\n"); 1127 nIndex = infoPtr->nNumStrings; 1128 while (*p) { 1129 len = lstrlenW (p); 1130 // TRACE (toolbar, "len=%d \"%s\"\n", len, debugstr_w(p)); 1131 1132 if (infoPtr->nNumStrings == 0) { 1133 infoPtr->strings = 1134 COMCTL32_Alloc (sizeof(LPWSTR)); 1135 } 1136 else { 1137 LPWSTR *oldStrings = infoPtr->strings; 1138 infoPtr->strings = 1139 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 1140 memcpy (&infoPtr->strings[0], &oldStrings[0], 1141 sizeof(LPWSTR) * infoPtr->nNumStrings); 1142 COMCTL32_Free (oldStrings); 1143 } 1144 1145 infoPtr->strings[infoPtr->nNumStrings] = 1146 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 1147 lstrcpyW (infoPtr->strings[infoPtr->nNumStrings], p); 1148 infoPtr->nNumStrings++; 1149 1150 p += (len+1); 1151 } 1151 1152 } 1152 1153 … … 1172 1173 1173 1174 if (dwStyle & CCS_NORESIZE) { 1174 1175 1176 1175 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); 1176 cx = 0; 1177 cy = 0; 1177 1178 } 1178 1179 else { 1179 1180 1181 1182 1183 1180 infoPtr->nWidth = parent_rect.right - parent_rect.left; 1181 TOOLBAR_CalcToolbar (hwnd); 1182 InvalidateRect( hwnd, NULL, TRUE ); 1183 cy = infoPtr->nHeight; 1184 cx = infoPtr->nWidth; 1184 1185 } 1185 1186 1186 1187 if (dwStyle & CCS_NOPARENTALIGN) 1187 1188 uPosFlags |= SWP_NOMOVE; 1188 1189 1189 1190 if (!(dwStyle & CCS_NODIVIDER)) 1190 1191 cy += GetSystemMetrics(SM_CYEDGE); 1191 1192 1192 1193 infoPtr->bAutoSize = TRUE; 1193 1194 SetWindowPos (hwnd, HWND_TOP, parent_rect.left, parent_rect.top, 1194 1195 cx, cy, uPosFlags); 1195 1196 1196 1197 return 0; … … 1213 1214 1214 1215 if (infoPtr == NULL) { 1215 // 1216 // 1217 1216 // ERR (toolbar, "(0x%x, 0x%x, 0x%lx)\n", hwnd, wParam, lParam); 1217 // ERR (toolbar, "infoPtr == NULL!\n"); 1218 return 0; 1218 1219 } 1219 1220 … … 1234 1235 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1235 1236 if (nIndex == -1) 1236 1237 return FALSE; 1237 1238 1238 1239 btnPtr = &infoPtr->buttons[nIndex]; … … 1258 1259 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1259 1260 if (nIndex == -1) 1260 1261 return FALSE; 1261 1262 1262 1263 btnPtr = &infoPtr->buttons[nIndex]; 1263 1264 1264 1265 if (!(btnPtr->fsStyle & TBSTYLE_CHECK)) 1265 1266 return FALSE; 1266 1267 1267 1268 if (LOWORD(lParam) == FALSE) 1268 1269 btnPtr->fsState &= ~TBSTATE_CHECKED; 1269 1270 else { 1270 1271 nOldIndex = 1272 1273 1274 1275 1276 1277 1278 1271 if (btnPtr->fsStyle & TBSTYLE_GROUP) { 1272 nOldIndex = 1273 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex); 1274 if (nOldIndex == nIndex) 1275 return 0; 1276 if (nOldIndex != -1) 1277 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED; 1278 } 1279 btnPtr->fsState |= TBSTATE_CHECKED; 1279 1280 } 1280 1281 1281 1282 hdc = GetDC (hwnd); 1282 1283 if (nOldIndex != -1) 1283 1284 TOOLBAR_DrawButton (hwnd, &infoPtr->buttons[nOldIndex], hdc); 1284 1285 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 1285 1286 ReleaseDC (hwnd, hdc); … … 1315 1316 1316 1317 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 1317 1318 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); 1318 1319 1319 1320 if (!(hRes = FindResourceA (COMCTL32_hModule, 1320 1321 MAKEINTRESOURCEA(IDD_TBCUSTOMIZE), 1321 1322 RT_DIALOGA))) 1322 1323 return FALSE; 1323 1324 1324 1325 if(!(template = (LPVOID)LoadResource (COMCTL32_hModule, hRes))) 1325 1326 return FALSE; 1326 1327 1327 1328 ret = DialogBoxIndirectParamA (GetWindowLongA (hwnd, GWL_HINSTANCE), … … 1335 1336 1336 1337 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 1337 1338 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); 1338 1339 1339 1340 return ret; … … 1348 1349 1349 1350 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 1350 1351 1352 if ((infoPtr->hwndToolTip) && 1353 1354 1355 1356 1357 1358 1359 1360 1361 1351 return FALSE; 1352 1353 if ((infoPtr->hwndToolTip) && 1354 !(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) { 1355 TTTOOLINFOA ti; 1356 1357 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 1358 ti.cbSize = sizeof (TTTOOLINFOA); 1359 ti.hwnd = hwnd; 1360 ti.uId = infoPtr->buttons[nIndex].idCommand; 1361 1362 SendMessageA (infoPtr->hwndToolTip, TTM_DELTOOLA, 0, (LPARAM)&ti); 1362 1363 } 1363 1364 1364 1365 if (infoPtr->nNumButtons == 1) { 1365 // 1366 1367 1368 1366 // TRACE (toolbar, " simple delete!\n"); 1367 COMCTL32_Free (infoPtr->buttons); 1368 infoPtr->buttons = NULL; 1369 infoPtr->nNumButtons = 0; 1369 1370 } 1370 1371 else { 1371 1372 TBUTTON_INFO *oldButtons = infoPtr->buttons; 1372 1373 // TRACE(toolbar, "complex delete! [nIndex=%d]\n", nIndex); 1373 1374 1374 1375 1375 infoPtr->nNumButtons--; 1376 infoPtr->buttons = COMCTL32_Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons); 1376 1377 if (nIndex > 0) { 1377 1378 memcpy (&infoPtr->buttons[0], &oldButtons[0], … … 1384 1385 } 1385 1386 1386 1387 COMCTL32_Free (oldButtons); 1387 1388 } 1388 1389 … … 1405 1406 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1406 1407 if (nIndex == -1) 1407 1408 return FALSE; 1408 1409 1409 1410 btnPtr = &infoPtr->buttons[nIndex]; 1410 1411 if (LOWORD(lParam) == FALSE) 1411 1412 btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED); 1412 1413 else 1413 1414 btnPtr->fsState |= TBSTATE_ENABLED; 1414 1415 1415 1416 hdc = GetDC (hwnd); … … 1432 1433 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1433 1434 if (nIndex == -1) 1434 1435 return -1; 1435 1436 1436 1437 return infoPtr->buttons[nIndex].iBitmap; … … 1454 1455 1455 1456 if (infoPtr == NULL) 1456 1457 return FALSE; 1457 1458 1458 1459 if (lpTbb == NULL) 1459 1460 return FALSE; 1460 1461 1461 1462 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 1462 1463 return FALSE; 1463 1464 1464 1465 btnPtr = &infoPtr->buttons[nIndex]; … … 1483 1484 1484 1485 if (infoPtr == NULL) 1485 1486 return -1; 1486 1487 if (lpTbInfo == NULL) 1487 1488 return -1; 1488 1489 if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOA)) 1489 1490 return -1; 1490 1491 1491 1492 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1492 1493 if (nIndex == -1) 1493 1494 return -1; 1494 1495 1495 1496 btnPtr = &infoPtr->buttons[nIndex]; 1496 1497 1497 1498 if (lpTbInfo->dwMask & TBIF_COMMAND) 1498 1499 lpTbInfo->idCommand = btnPtr->idCommand; 1499 1500 if (lpTbInfo->dwMask & TBIF_IMAGE) 1500 1501 lpTbInfo->iImage = btnPtr->iBitmap; 1501 1502 if (lpTbInfo->dwMask & TBIF_LPARAM) 1502 1503 lpTbInfo->lParam = btnPtr->dwData; 1503 1504 if (lpTbInfo->dwMask & TBIF_SIZE) 1504 1505 lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left); 1505 1506 if (lpTbInfo->dwMask & TBIF_STATE) 1506 1507 lpTbInfo->fsState = btnPtr->fsState; 1507 1508 if (lpTbInfo->dwMask & TBIF_STYLE) 1508 1509 lpTbInfo->fsStyle = btnPtr->fsStyle; 1509 1510 if (lpTbInfo->dwMask & TBIF_TEXT) { 1510 1511 lstrcpynA (lpTbInfo->pszText, 1512 1513 1511 if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings)) 1512 lstrcpynA (lpTbInfo->pszText, 1513 (LPSTR)infoPtr->strings[btnPtr->iString], 1514 lpTbInfo->cchText); 1514 1515 } 1515 1516 … … 1527 1528 1528 1529 return MAKELONG((WORD)infoPtr->nButtonWidth, 1529 1530 (WORD)infoPtr->nButtonHeight); 1530 1531 } 1531 1532 … … 1539 1540 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1540 1541 if (nIndex == -1) 1541 1542 return -1; 1542 1543 1543 1544 nStringIndex = infoPtr->buttons[nIndex].iString; … … 1546 1547 1547 1548 if ((nStringIndex < 0) || (nStringIndex >= infoPtr->nNumStrings)) 1548 1549 return -1; 1549 1550 1550 1551 if (lParam == 0) return -1; … … 1566 1567 1567 1568 if (GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_FLAT) 1568 1569 return (LRESULT)infoPtr->himlDis; 1569 1570 else 1570 1571 return 0; 1571 1572 } 1572 1573 … … 1587 1588 1588 1589 if (GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_FLAT) 1589 1590 return (LRESULT)infoPtr->himlHot; 1590 1591 else 1591 1592 return 0; 1592 1593 } 1593 1594 … … 1602 1603 1603 1604 if (GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_FLAT) 1604 1605 return (LRESULT)infoPtr->himlDef; 1605 1606 else 1606 1607 return 0; 1607 1608 } 1608 1609 … … 1621 1622 1622 1623 if (infoPtr == NULL) 1623 1624 return FALSE; 1624 1625 nIndex = (INT)wParam; 1625 1626 btnPtr = &infoPtr->buttons[nIndex]; 1626 1627 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 1627 1628 return FALSE; 1628 1629 lpRect = (LPRECT)lParam; 1629 1630 if (lpRect == NULL) 1630 1631 return FALSE; 1631 1632 if (btnPtr->fsState & TBSTATE_HIDDEN) 1632 1633 1633 return FALSE; 1634 1634 1635 TOOLBAR_CalcToolbar( hwnd ); 1635 1636 1636 1637 lpRect->left = btnPtr->rect.left; 1637 1638 lpRect->right = btnPtr->rect.right; … … 1650 1651 1651 1652 if (lpSize == NULL) 1652 1653 return FALSE; 1653 1654 1654 1655 lpSize->cx = infoPtr->rcBound.right - infoPtr->rcBound.left; … … 1656 1657 1657 1658 // TRACE (toolbar, "maximum size %d x %d\n", 1658 // 1659 // 1659 // infoPtr->rcBound.right - infoPtr->rcBound.left, 1660 // infoPtr->rcBound.bottom - infoPtr->rcBound.top); 1660 1661 1661 1662 return TRUE; … … 1676 1677 1677 1678 if (infoPtr == NULL) 1678 1679 return FALSE; 1679 1680 nIndex = (INT)wParam; 1680 1681 btnPtr = &infoPtr->buttons[nIndex]; 1681 1682 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 1682 1683 return FALSE; 1683 1684 lpRect = (LPRECT)lParam; 1684 1685 if (lpRect == NULL) 1685 1686 1686 return FALSE; 1687 1687 1688 lpRect->left = btnPtr->rect.left; 1688 1689 lpRect->right = btnPtr->rect.right; … … 1700 1701 1701 1702 if (GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_WRAPABLE) 1702 1703 return infoPtr->nRows; 1703 1704 else 1704 1705 return 1; 1705 1706 } 1706 1707 … … 1714 1715 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1715 1716 if (nIndex == -1) 1716 1717 return -1; 1717 1718 1718 1719 return infoPtr->buttons[nIndex].fsState; … … 1728 1729 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1729 1730 if (nIndex == -1) 1730 1731 return -1; 1731 1732 1732 1733 return infoPtr->buttons[nIndex].fsStyle; … … 1740 1741 1741 1742 if (infoPtr == NULL) 1742 1743 return 0; 1743 1744 1744 1745 return infoPtr->nMaxTextRows; … … 1752 1753 1753 1754 if (infoPtr == NULL) 1754 1755 return 0; 1755 1756 return infoPtr->hwndToolTip; 1756 1757 } … … 1762 1763 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 1763 1764 1764 // TRACE (toolbar, "%s hwnd=0x%x stub!\n", 1765 // 1765 // TRACE (toolbar, "%s hwnd=0x%x stub!\n", 1766 // infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd); 1766 1767 1767 1768 return infoPtr->bUnicode; … … 1778 1779 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1779 1780 if (nIndex == -1) 1780 1781 return FALSE; 1781 1782 1782 1783 btnPtr = &infoPtr->buttons[nIndex]; 1783 1784 if (LOWORD(lParam) == FALSE) 1784 1785 btnPtr->fsState &= ~TBSTATE_HIDDEN; 1785 1786 else 1786 1787 btnPtr->fsState |= TBSTATE_HIDDEN; 1787 1788 1788 1789 TOOLBAR_CalcToolbar (hwnd); … … 1811 1812 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1812 1813 if (nIndex == -1) 1813 1814 return FALSE; 1814 1815 1815 1816 btnPtr = &infoPtr->buttons[nIndex]; 1816 1817 if (LOWORD(lParam) == FALSE) 1817 1818 btnPtr->fsState &= ~TBSTATE_INDETERMINATE; 1818 1819 else 1819 1820 btnPtr->fsState |= TBSTATE_INDETERMINATE; 1820 1821 1821 1822 hdc = GetDC (hwnd); … … 1836 1837 1837 1838 if (lpTbb == NULL) 1838 1839 return FALSE; 1839 1840 if (nIndex < 0) 1840 1841 return FALSE; 1841 1842 1842 1843 // TRACE (toolbar, "inserting button index=%d\n", nIndex); 1843 1844 if (nIndex > infoPtr->nNumButtons) { 1844 1845 // 1845 nIndex = infoPtr->nNumButtons; 1846 // TRACE (toolbar, "adjust index=%d\n", nIndex); 1846 1847 } 1847 1848 … … 1851 1852 /* pre insert copy */ 1852 1853 if (nIndex > 0) { 1853 1854 1854 memcpy (&infoPtr->buttons[0], &oldButtons[0], 1855 nIndex * sizeof(TBUTTON_INFO)); 1855 1856 } 1856 1857 … … 1864 1865 1865 1866 if ((infoPtr->hwndToolTip) && !(lpTbb->fsStyle & TBSTYLE_SEP)) { 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1867 TTTOOLINFOA ti; 1868 1869 ZeroMemory (&ti, sizeof(TTTOOLINFOA)); 1870 ti.cbSize = sizeof (TTTOOLINFOA); 1871 ti.hwnd = hwnd; 1872 ti.uId = lpTbb->idCommand; 1873 ti.hinst = 0; 1874 ti.lpszText = LPSTR_TEXTCALLBACKA; 1875 1876 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA, 1877 0, (LPARAM)&ti); 1877 1878 } 1878 1879 1879 1880 /* post insert copy */ 1880 1881 if (nIndex < infoPtr->nNumButtons - 1) { 1881 1882 1882 memcpy (&infoPtr->buttons[nIndex+1], &oldButtons[nIndex], 1883 (infoPtr->nNumButtons - nIndex - 1) * sizeof(TBUTTON_INFO)); 1883 1884 } 1884 1885 … … 1905 1906 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1906 1907 if (nIndex == -1) 1907 1908 return FALSE; 1908 1909 1909 1910 return (infoPtr->buttons[nIndex].fsState & TBSTATE_CHECKED); … … 1919 1920 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1920 1921 if (nIndex == -1) 1921 1922 return FALSE; 1922 1923 1923 1924 return (infoPtr->buttons[nIndex].fsState & TBSTATE_ENABLED); … … 1933 1934 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1934 1935 if (nIndex == -1) 1935 1936 return FALSE; 1936 1937 1937 1938 return (infoPtr->buttons[nIndex].fsState & TBSTATE_HIDDEN); … … 1947 1948 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1948 1949 if (nIndex == -1) 1949 1950 return FALSE; 1950 1951 1951 1952 return (infoPtr->buttons[nIndex].fsState & TBSTATE_MARKED); … … 1961 1962 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1962 1963 if (nIndex == -1) 1963 1964 return FALSE; 1964 1965 1965 1966 return (infoPtr->buttons[nIndex].fsState & TBSTATE_INDETERMINATE); … … 1975 1976 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1976 1977 if (nIndex == -1) 1977 1978 return FALSE; 1978 1979 1979 1980 return (infoPtr->buttons[nIndex].fsState & TBSTATE_PRESSED); … … 1997 1998 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1998 1999 if (nIndex == -1) 1999 2000 return FALSE; 2000 2001 2001 2002 btnPtr = &infoPtr->buttons[nIndex]; 2002 2003 if (LOWORD(lParam) == FALSE) 2003 2004 btnPtr->fsState &= ~TBSTATE_PRESSED; 2004 2005 else 2005 2006 btnPtr->fsState |= TBSTATE_PRESSED; 2006 2007 2007 2008 hdc = GetDC (hwnd); … … 2026 2027 2027 2028 if ((BOOL)wParam) { 2028 2029 // 2030 // 2029 /* save toolbar information */ 2030 // FIXME (toolbar, "save to \"%s\" \"%s\"\n", 2031 // lpSave->pszSubKey, lpSave->pszValueName); 2031 2032 2032 2033 2033 2034 } 2034 2035 else { 2035 2036 2037 // 2038 // 2036 /* restore toolbar information */ 2037 2038 // FIXME (toolbar, "restore from \"%s\" \"%s\"\n", 2039 // lpSave->pszSubKey, lpSave->pszValueName); 2039 2040 2040 2041 … … 2056 2057 2057 2058 if ((LOWORD(lParam) <= 0) || (HIWORD(lParam)<=0)) 2058 2059 return FALSE; 2059 2060 2060 2061 infoPtr->nBitmapWidth = (INT)LOWORD(lParam); … … 2074 2075 2075 2076 if (lptbbi == NULL) 2076 2077 return FALSE; 2077 2078 if (lptbbi->cbSize < sizeof(TBBUTTONINFOA)) 2078 2079 2079 return FALSE; 2080 2080 2081 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2081 2082 if (nIndex == -1) 2082 2083 return FALSE; 2083 2084 2084 2085 btnPtr = &infoPtr->buttons[nIndex]; 2085 2086 if (lptbbi->dwMask & TBIF_COMMAND) 2086 2087 btnPtr->idCommand = lptbbi->idCommand; 2087 2088 if (lptbbi->dwMask & TBIF_IMAGE) 2088 2089 btnPtr->iBitmap = lptbbi->iImage; 2089 2090 if (lptbbi->dwMask & TBIF_LPARAM) 2090 2091 btnPtr->dwData = lptbbi->lParam; 2091 2092 /* if (lptbbi->dwMask & TBIF_SIZE) */ 2092 /* 2093 /* btnPtr->cx = lptbbi->cx; */ 2093 2094 if (lptbbi->dwMask & TBIF_STATE) 2094 2095 btnPtr->fsState = lptbbi->fsState; 2095 2096 if (lptbbi->dwMask & TBIF_STYLE) 2096 2097 btnPtr->fsStyle = lptbbi->fsStyle; 2097 2098 2098 2099 if (lptbbi->dwMask & TBIF_TEXT) { 2099 if ((btnPtr->iString >= 0) || 2100 2100 if ((btnPtr->iString >= 0) || 2101 (btnPtr->iString < infoPtr->nNumStrings)) { 2101 2102 #if 0 2102 2103 2104 2103 CHAR **lpString = &infoPtr->strings[btnPtr->iString]; 2104 INT len = lstrlenA (lptbbi->pszText); 2105 *lpString = COMCTL32_ReAlloc (lpString, sizeof(char)*(len+1)); 2105 2106 #endif 2106 2107 2107 2108 /* 2109 2108 /* this is the ultimate sollution */ 2109 /* Str_SetPtrA (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */ 2110 } 2110 2111 } 2111 2112 … … 2123 2124 2124 2125 if ((LOWORD(lParam) <= 0) || (HIWORD(lParam)<=0)) 2125 2126 return FALSE; 2126 2127 2127 2128 infoPtr->nButtonWidth = (INT)LOWORD(lParam); … … 2138 2139 2139 2140 if (infoPtr == NULL) 2140 2141 return FALSE; 2141 2142 2142 2143 infoPtr->cxMin = (INT)LOWORD(lParam); … … 2154 2155 2155 2156 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) 2156 2157 return FALSE; 2157 2158 2158 2159 infoPtr->buttons[nIndex].idCommand = (INT)lParam; … … 2160 2161 if (infoPtr->hwndToolTip) { 2161 2162 2162 // 2163 // FIXME (toolbar, "change tool tip!\n"); 2163 2164 2164 2165 } … … 2178 2179 2179 2180 if (!(GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_FLAT)) 2180 2181 return 0; 2181 2182 2182 2183 himlTemp = infoPtr->himlDis; … … 2185 2186 /* FIXME: redraw ? */ 2186 2187 2187 return (LRESULT)himlTemp; 2188 return (LRESULT)himlTemp; 2188 2189 } 2189 2190 … … 2197 2198 dwTemp = infoPtr->dwDTFlags; 2198 2199 infoPtr->dwDTFlags = 2199 2200 (infoPtr->dwDTFlags & (DWORD)wParam) | (DWORD)lParam; 2200 2201 2201 2202 return (LRESULT)dwTemp; … … 2212 2213 infoPtr->dwExStyle = (DWORD)lParam; 2213 2214 2214 return (LRESULT)dwTemp; 2215 return (LRESULT)dwTemp; 2215 2216 } 2216 2217 … … 2223 2224 2224 2225 if (!(GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_FLAT)) 2225 2226 return 0; 2226 2227 2227 2228 himlTemp = infoPtr->himlHot; … … 2230 2231 /* FIXME: redraw ? */ 2231 2232 2232 return (LRESULT)himlTemp; 2233 return (LRESULT)himlTemp; 2233 2234 } 2234 2235 … … 2244 2245 2245 2246 if (!(GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_FLAT)) 2246 2247 return 0; 2247 2248 2248 2249 himlTemp = infoPtr->himlDef; … … 2251 2252 /* FIXME: redraw ? */ 2252 2253 2253 return (LRESULT)himlTemp; 2254 return (LRESULT)himlTemp; 2254 2255 } 2255 2256 … … 2292 2293 2293 2294 if (infoPtr == NULL) 2294 2295 return FALSE; 2295 2296 2296 2297 infoPtr->nMaxTextRows = (INT)wParam; … … 2310 2311 2311 2312 if (infoPtr == NULL) 2312 2313 return 0; 2313 2314 hwndOldNotify = infoPtr->hwndNotify; 2314 2315 infoPtr->hwndNotify = (HWND)wParam; … … 2326 2327 if (LOWORD(wParam) > 1) { 2327 2328 2328 // 2329 // FIXME (toolbar, "multiple rows not supported!\n"); 2329 2330 2330 2331 } … … 2335 2336 /* return bounding rectangle */ 2336 2337 if (lprc) { 2337 2338 2339 2340 2338 lprc->left = infoPtr->rcBound.left; 2339 lprc->right = infoPtr->rcBound.right; 2340 lprc->top = infoPtr->rcBound.top; 2341 lprc->bottom = infoPtr->rcBound.bottom; 2341 2342 } 2342 2343 … … 2358 2359 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2359 2360 if (nIndex == -1) 2360 2361 return FALSE; 2361 2362 2362 2363 btnPtr = &infoPtr->buttons[nIndex]; … … 2381 2382 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2382 2383 if (nIndex == -1) 2383 2384 return FALSE; 2384 2385 2385 2386 btnPtr = &infoPtr->buttons[nIndex]; … … 2392 2393 if (infoPtr->hwndToolTip) { 2393 2394 2394 // 2395 // FIXME (toolbar, "change tool tip!\n"); 2395 2396 2396 2397 } … … 2406 2407 2407 2408 if (infoPtr == NULL) 2408 2409 return 0; 2409 2410 infoPtr->hwndToolTip = (HWND)wParam; 2410 2411 return 0; … … 2418 2419 BOOL bTemp; 2419 2420 2420 // TRACE (toolbar, "%s hwnd=0x%04x stub!\n", 2421 // 2421 // TRACE (toolbar, "%s hwnd=0x%04x stub!\n", 2422 // ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd); 2422 2423 2423 2424 bTemp = infoPtr->bUnicode; … … 2460 2461 2461 2462 if (dwStyle & TBSTYLE_TOOLTIPS) { 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2463 /* Create tooltip control */ 2464 infoPtr->hwndToolTip = 2465 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, 2466 CW_USEDEFAULT, CW_USEDEFAULT, 2467 CW_USEDEFAULT, CW_USEDEFAULT, 2468 hwnd, 0, 0, 0); 2469 2470 /* Send NM_TOOLTIPSCREATED notification */ 2471 if (infoPtr->hwndToolTip) { 2472 NMTOOLTIPSCREATED nmttc; 2473 2474 nmttc.hdr.hwndFrom = hwnd; 2475 nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 2476 nmttc.hdr.code = NM_TOOLTIPSCREATED; 2477 nmttc.hwndToolTips = infoPtr->hwndToolTip; 2478 2479 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 2480 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc); 2481 } 2481 2482 } 2482 2483 … … 2492 2493 /* delete tooltip control */ 2493 2494 if (infoPtr->hwndToolTip) 2494 2495 DestroyWindow (infoPtr->hwndToolTip); 2495 2496 2496 2497 /* delete button data */ 2497 2498 if (infoPtr->buttons) 2498 2499 COMCTL32_Free (infoPtr->buttons); 2499 2500 2500 2501 /* delete strings */ 2501 2502 if (infoPtr->strings) { 2502 2503 2504 2505 2506 2507 2503 INT i; 2504 for (i = 0; i < infoPtr->nNumStrings; i++) 2505 if (infoPtr->strings[i]) 2506 COMCTL32_Free (infoPtr->strings[i]); 2507 2508 COMCTL32_Free (infoPtr->strings); 2508 2509 } 2509 2510 2510 2511 /* destroy default image list */ 2511 2512 if (infoPtr->himlDef) 2512 2513 ImageList_Destroy (infoPtr->himlDef); 2513 2514 2514 2515 /* destroy disabled image list */ 2515 2516 if (infoPtr->himlDis) 2516 2517 ImageList_Destroy (infoPtr->himlDis); 2517 2518 2518 2519 /* destroy hot image list */ 2519 2520 if (infoPtr->himlHot) 2520 2521 ImageList_Destroy (infoPtr->himlHot); 2521 2522 2522 2523 /* delete default font */ 2523 2524 if (infoPtr->hFont) 2524 2525 DeleteObject (infoPtr->hFont); 2525 2526 2526 2527 /* free toolbar info data */ … … 2537 2538 2538 2539 if (infoPtr->bTransparent) 2539 2540 return SendMessageA (GetParent (hwnd), WM_ERASEBKGND, wParam, lParam); 2540 2541 2541 2542 return DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam); … … 2557 2558 2558 2559 if (nHit >= 0) { 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2560 btnPtr = &infoPtr->buttons[nHit]; 2561 if (!(btnPtr->fsState & TBSTATE_ENABLED)) 2562 return 0; 2563 SetCapture (hwnd); 2564 infoPtr->bCaptured = TRUE; 2565 infoPtr->nButtonDown = nHit; 2566 2567 btnPtr->fsState |= TBSTATE_PRESSED; 2568 2569 hdc = GetDC (hwnd); 2570 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2571 ReleaseDC (hwnd, hdc); 2571 2572 } 2572 2573 else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE) 2573 2574 TOOLBAR_Customize (hwnd); 2574 2575 2575 2576 return 0; … … 2587 2588 2588 2589 if (infoPtr->hwndToolTip) 2589 2590 2590 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd, 2591 WM_LBUTTONDOWN, wParam, lParam); 2591 2592 2592 2593 pt.x = (INT)LOWORD(lParam); … … 2595 2596 2596 2597 if (nHit >= 0) { 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2598 btnPtr = &infoPtr->buttons[nHit]; 2599 if (!(btnPtr->fsState & TBSTATE_ENABLED)) 2600 return 0; 2601 2602 SetCapture (hwnd); 2603 infoPtr->bCaptured = TRUE; 2604 infoPtr->nButtonDown = nHit; 2605 infoPtr->nOldHit = nHit; 2606 2607 btnPtr->fsState |= TBSTATE_PRESSED; 2608 2609 hdc = GetDC (hwnd); 2610 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2611 ReleaseDC (hwnd, hdc); 2611 2612 } 2612 2613 … … 2627 2628 2628 2629 if (infoPtr->hwndToolTip) 2629 2630 2630 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd, 2631 WM_LBUTTONUP, wParam, lParam); 2631 2632 2632 2633 pt.x = (INT)LOWORD(lParam); … … 2635 2636 2636 2637 if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) { 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 if ((nOldIndex != infoPtr->nButtonDown) && 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2638 infoPtr->bCaptured = FALSE; 2639 ReleaseCapture (); 2640 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; 2641 btnPtr->fsState &= ~TBSTATE_PRESSED; 2642 2643 if (nHit == infoPtr->nButtonDown) { 2644 if (btnPtr->fsStyle & TBSTYLE_CHECK) { 2645 if (btnPtr->fsStyle & TBSTYLE_GROUP) { 2646 nOldIndex = TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, 2647 infoPtr->nButtonDown); 2648 if (nOldIndex == infoPtr->nButtonDown) 2649 bSendMessage = FALSE; 2650 if ((nOldIndex != infoPtr->nButtonDown) && 2651 (nOldIndex != -1)) 2652 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED; 2653 btnPtr->fsState |= TBSTATE_CHECKED; 2654 } 2655 else { 2656 if (btnPtr->fsState & TBSTATE_CHECKED) 2657 btnPtr->fsState &= ~TBSTATE_CHECKED; 2658 else 2659 btnPtr->fsState |= TBSTATE_CHECKED; 2660 } 2661 } 2662 } 2663 else 2664 bSendMessage = FALSE; 2665 2666 hdc = GetDC (hwnd); 2667 if (nOldIndex != -1) 2668 TOOLBAR_DrawButton (hwnd, &infoPtr->buttons[nOldIndex], hdc); 2669 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2670 ReleaseDC (hwnd, hdc); 2671 2672 if (bSendMessage) 2673 SendMessageA (infoPtr->hwndNotify, WM_COMMAND, 2674 MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd); 2675 2676 infoPtr->nButtonDown = -1; 2677 infoPtr->nOldHit = -1; 2677 2678 } 2678 2679 … … 2691 2692 2692 2693 if (infoPtr->hwndToolTip) 2693 2694 2694 TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd, 2695 WM_MOUSEMOVE, wParam, lParam); 2695 2696 2696 2697 pt.x = (INT)LOWORD(lParam); … … 2702 2703 { 2703 2704 /* Remove the effect of an old hot button */ 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2705 if(infoPtr->nOldHit == infoPtr->nHotItem) 2706 { 2707 oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit]; 2708 oldBtnPtr->bHot = FALSE; 2709 2710 InvalidateRect (hwnd, &oldBtnPtr->rect, TRUE); 2711 } 2712 2713 /* It's not a separator or in nowhere. It's a hot button. */ 2714 if (nHit >= 0) 2715 { 2716 btnPtr = &infoPtr->buttons[nHit]; 2717 btnPtr->bHot = TRUE; 2718 2719 hdc = GetDC (hwnd); 2720 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2721 ReleaseDC (hwnd, hdc); 2722 2723 infoPtr->nHotItem = nHit; 2724 } 2724 2725 2725 2726 if (infoPtr->bCaptured) { 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2727 btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; 2728 if (infoPtr->nOldHit == infoPtr->nButtonDown) { 2729 btnPtr->fsState &= ~TBSTATE_PRESSED; 2730 hdc = GetDC (hwnd); 2731 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2732 ReleaseDC (hwnd, hdc); 2733 } 2734 else if (nHit == infoPtr->nButtonDown) { 2735 btnPtr->fsState |= TBSTATE_PRESSED; 2736 hdc = GetDC (hwnd); 2737 TOOLBAR_DrawButton (hwnd, btnPtr, hdc); 2738 ReleaseDC (hwnd, hdc); 2739 } 2740 } 2741 infoPtr->nOldHit = nHit; 2741 2742 } 2742 2743 return 0; … … 2748 2749 { 2749 2750 /* if (wndPtr->dwStyle & CCS_NODIVIDER) */ 2750 2751 return DefWindowProcA (hwnd, WM_NCACTIVATE, wParam, lParam); 2751 2752 /* else */ 2752 /* 2753 /* return TOOLBAR_NCPaint (wndPtr, wParam, lParam); */ 2753 2754 } 2754 2755 … … 2758 2759 { 2759 2760 if (!(GetWindowLongA (hwnd, GWL_STYLE) & CCS_NODIVIDER)) 2760 2761 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 2761 2762 2762 2763 return DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam); … … 2779 2780 if (!GetWindowLongA (hwnd, GWL_HINSTANCE)) { 2780 2781 HINSTANCE hInst = (HINSTANCE)GetWindowLongA (GetParent (hwnd), GWL_HINSTANCE); 2781 2782 SetWindowLongA (hwnd, GWL_HINSTANCE, (DWORD)hInst); 2782 2783 } 2783 2784 … … 2794 2795 2795 2796 if (dwStyle & WS_MINIMIZE) 2796 2797 return 0; /* Nothing to do */ 2797 2798 2798 2799 DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam); 2799 2800 2800 2801 if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW))) 2801 2802 return 0; 2802 2803 2803 2804 if (!(dwStyle & CCS_NODIVIDER)) 2804 2805 { 2805 2806 2807 2806 GetWindowRect (hwnd, &rcWindow); 2807 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); 2808 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP); 2808 2809 } 2809 2810 … … 2823 2824 2824 2825 if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) { 2825 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,wParam, lParam);2826 SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam); 2826 2827 2827 2828 #if 0 2828 2829 2830 2831 // 2832 2833 2834 2835 2836 2837 // 2838 2839 2829 if (lpnmh->code == TTN_GETDISPINFOA) { 2830 LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam; 2831 2832 // FIXME (toolbar, "retrieving ASCII string\n"); 2833 2834 } 2835 else if (lpnmh->code == TTN_GETDISPINFOW) { 2836 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; 2837 2838 // FIXME (toolbar, "retrieving UNICODE string\n"); 2839 2840 } 2840 2841 #endif 2841 2842 } … … 2855 2856 TOOLBAR_Refresh (hwnd, hdc); 2856 2857 if (!wParam) 2857 2858 EndPaint (hwnd, &ps); 2858 2859 return 0; 2859 2860 } … … 2874 2875 /* Resize deadlock check */ 2875 2876 if (infoPtr->bAutoSize) { 2876 2877 2877 infoPtr->bAutoSize = FALSE; 2878 return 0; 2878 2879 } 2879 2880 … … 2887 2888 2888 2889 if (flags == SIZE_RESTORED) { 2889 2890 2891 2892 2893 2894 2895 2896 2897 /* 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2890 /* width and height don't apply */ 2891 parent = GetParent (hwnd); 2892 GetClientRect(parent, &parent_rect); 2893 2894 if (dwStyle & CCS_NORESIZE) { 2895 uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); 2896 2897 /* FIXME */ 2898 /* infoPtr->nWidth = parent_rect.right - parent_rect.left; */ 2899 cy = infoPtr->nHeight; 2900 cx = infoPtr->nWidth; 2901 TOOLBAR_CalcToolbar (hwnd); 2902 infoPtr->nWidth = cx; 2903 infoPtr->nHeight = cy; 2904 } 2905 else { 2906 infoPtr->nWidth = parent_rect.right - parent_rect.left; 2907 TOOLBAR_CalcToolbar (hwnd); 2908 cy = infoPtr->nHeight; 2909 cx = infoPtr->nWidth; 2910 } 2911 2912 if (dwStyle & CCS_NOPARENTALIGN) { 2913 uPosFlags |= SWP_NOMOVE; 2914 cy = infoPtr->nHeight; 2915 cx = infoPtr->nWidth; 2916 } 2917 2918 if (!(dwStyle & CCS_NODIVIDER)) 2919 cy += GetSystemMetrics(SM_CYEDGE); 2920 2921 SetWindowPos (hwnd, 0, parent_rect.left, parent_rect.top, 2922 cx, cy, uPosFlags | SWP_NOZORDER); 2922 2923 } 2923 2924 return 0; … … 2942 2943 switch (uMsg) 2943 2944 { 2944 2945 2946 2947 2948 2949 2950 /* 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 /* case TB_GETANCHORHIGHLIGHT:*/ /* 4.71 */2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 /* case TB_GETBUTTONINFOW:*/ /* 4.71 */3000 3001 3002 3003 3004 3005 3006 3007 /* 3008 /* case TB_GETCOLORSCHEME:*/ /* 4.71 */3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 /* case TB_GETHOTITEM:*/ /* 4.71 */3020 3021 3022 3023 3024 /* case TB_GETINSERTMARK:*/ /* 4.71 */3025 /* case TB_GETINSERTMARKCOLOR:*/ /* 4.71 */3026 3027 3028 3029 3030 3031 3032 3033 /* case TB_GETOBJECT:*/ /* 4.71 */3034 /* case TB_GETPADDING:*/ /* 4.71 */3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 /* 3070 /* case TB_INSERTMARKHITTEST:*/ /* 4.71 */3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 /* case TB_LOADIMAGES:*/ /* 4.70 */3091 /* case TB_MAPACCELERATORA:*/ /* 4.71 */3092 /* case TB_MAPACCELERATORW:*/ /* 4.71 */3093 /* case TB_MARKBUTTON:*/ /* 4.71 */3094 /* case TB_MOVEBUTTON:*/ /* 4.71 */3095 3096 3097 3098 3099 /* 3100 3101 3102 3103 3104 /* 3105 /* case TB_SETANCHORHIGHLIGHT:*/ /* 4.71 */3106 3107 3108 3109 3110 3111 3112 3113 /* case TB_SETBUTTONINFOW:*/ /* 4.71 */3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 /* case TB_SETCOLORSCHEME:*/ /* 4.71 */3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 /* case TB_SETHOTITEM:*/ /* 4.71 */3139 3140 3141 3142 3143 3144 3145 3146 /* case TB_SETINSERTMARK:*/ /* 4.71 */3147 3148 3149 3150 3151 3152 3153 3154 /* case TB_SETPADDING:*/ /* 4.71 */3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 /* 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 /* 3187 /* 3188 /* 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 /* 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 /* 3229 3230 /* 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 // 3242 // 3243 2945 case TB_ADDBITMAP: 2946 return TOOLBAR_AddBitmap (hwnd, wParam, lParam); 2947 2948 case TB_ADDBUTTONSA: 2949 return TOOLBAR_AddButtonsA (hwnd, wParam, lParam); 2950 2951 /* case TB_ADDBUTTONSW: */ 2952 2953 case TB_ADDSTRINGA: 2954 return TOOLBAR_AddStringA (hwnd, wParam, lParam); 2955 2956 case TB_ADDSTRINGW: 2957 return TOOLBAR_AddStringW (hwnd, wParam, lParam); 2958 2959 case TB_AUTOSIZE: 2960 return TOOLBAR_AutoSize (hwnd, wParam, lParam); 2961 2962 case TB_BUTTONCOUNT: 2963 return TOOLBAR_ButtonCount (hwnd, wParam, lParam); 2964 2965 case TB_BUTTONSTRUCTSIZE: 2966 return TOOLBAR_ButtonStructSize (hwnd, wParam, lParam); 2967 2968 case TB_CHANGEBITMAP: 2969 return TOOLBAR_ChangeBitmap (hwnd, wParam, lParam); 2970 2971 case TB_CHECKBUTTON: 2972 return TOOLBAR_CheckButton (hwnd, wParam, lParam); 2973 2974 case TB_COMMANDTOINDEX: 2975 return TOOLBAR_CommandToIndex (hwnd, wParam, lParam); 2976 2977 case TB_CUSTOMIZE: 2978 return TOOLBAR_Customize (hwnd); 2979 2980 case TB_DELETEBUTTON: 2981 return TOOLBAR_DeleteButton (hwnd, wParam, lParam); 2982 2983 case TB_ENABLEBUTTON: 2984 return TOOLBAR_EnableButton (hwnd, wParam, lParam); 2985 2986 /* case TB_GETANCHORHIGHLIGHT: */ /* 4.71 */ 2987 2988 case TB_GETBITMAP: 2989 return TOOLBAR_GetBitmap (hwnd, wParam, lParam); 2990 2991 case TB_GETBITMAPFLAGS: 2992 return TOOLBAR_GetBitmapFlags (hwnd, wParam, lParam); 2993 2994 case TB_GETBUTTON: 2995 return TOOLBAR_GetButton (hwnd, wParam, lParam); 2996 2997 case TB_GETBUTTONINFOA: 2998 return TOOLBAR_GetButtonInfoA (hwnd, wParam, lParam); 2999 3000 /* case TB_GETBUTTONINFOW: */ /* 4.71 */ 3001 3002 case TB_GETBUTTONSIZE: 3003 return TOOLBAR_GetButtonSize (hwnd); 3004 3005 case TB_GETBUTTONTEXTA: 3006 return TOOLBAR_GetButtonTextA (hwnd, wParam, lParam); 3007 3008 /* case TB_GETBUTTONTEXTW: */ 3009 /* case TB_GETCOLORSCHEME: */ /* 4.71 */ 3010 3011 case TB_GETDISABLEDIMAGELIST: 3012 return TOOLBAR_GetDisabledImageList (hwnd, wParam, lParam); 3013 3014 case TB_GETEXTENDEDSTYLE: 3015 return TOOLBAR_GetExtendedStyle (hwnd); 3016 3017 case TB_GETHOTIMAGELIST: 3018 return TOOLBAR_GetHotImageList (hwnd, wParam, lParam); 3019 3020 /* case TB_GETHOTITEM: */ /* 4.71 */ 3021 3022 case TB_GETIMAGELIST: 3023 return TOOLBAR_GetImageList (hwnd, wParam, lParam); 3024 3025 /* case TB_GETINSERTMARK: */ /* 4.71 */ 3026 /* case TB_GETINSERTMARKCOLOR: */ /* 4.71 */ 3027 3028 case TB_GETITEMRECT: 3029 return TOOLBAR_GetItemRect (hwnd, wParam, lParam); 3030 3031 case TB_GETMAXSIZE: 3032 return TOOLBAR_GetMaxSize (hwnd, wParam, lParam); 3033 3034 /* case TB_GETOBJECT: */ /* 4.71 */ 3035 /* case TB_GETPADDING: */ /* 4.71 */ 3036 3037 case TB_GETRECT: 3038 return TOOLBAR_GetRect (hwnd, wParam, lParam); 3039 3040 case TB_GETROWS: 3041 return TOOLBAR_GetRows (hwnd, wParam, lParam); 3042 3043 case TB_GETSTATE: 3044 return TOOLBAR_GetState (hwnd, wParam, lParam); 3045 3046 case TB_GETSTYLE: 3047 return TOOLBAR_GetStyle (hwnd, wParam, lParam); 3048 3049 case TB_GETTEXTROWS: 3050 return TOOLBAR_GetTextRows (hwnd, wParam, lParam); 3051 3052 case TB_GETTOOLTIPS: 3053 return TOOLBAR_GetToolTips (hwnd, wParam, lParam); 3054 3055 case TB_GETUNICODEFORMAT: 3056 return TOOLBAR_GetUnicodeFormat (hwnd, wParam, lParam); 3057 3058 case TB_HIDEBUTTON: 3059 return TOOLBAR_HideButton (hwnd, wParam, lParam); 3060 3061 case TB_HITTEST: 3062 return TOOLBAR_HitTest (hwnd, wParam, lParam); 3063 3064 case TB_INDETERMINATE: 3065 return TOOLBAR_Indeterminate (hwnd, wParam, lParam); 3066 3067 case TB_INSERTBUTTONA: 3068 return TOOLBAR_InsertButtonA (hwnd, wParam, lParam); 3069 3070 /* case TB_INSERTBUTTONW: */ 3071 /* case TB_INSERTMARKHITTEST: */ /* 4.71 */ 3072 3073 case TB_ISBUTTONCHECKED: 3074 return TOOLBAR_IsButtonChecked (hwnd, wParam, lParam); 3075 3076 case TB_ISBUTTONENABLED: 3077 return TOOLBAR_IsButtonEnabled (hwnd, wParam, lParam); 3078 3079 case TB_ISBUTTONHIDDEN: 3080 return TOOLBAR_IsButtonHidden (hwnd, wParam, lParam); 3081 3082 case TB_ISBUTTONHIGHLIGHTED: 3083 return TOOLBAR_IsButtonHighlighted (hwnd, wParam, lParam); 3084 3085 case TB_ISBUTTONINDETERMINATE: 3086 return TOOLBAR_IsButtonIndeterminate (hwnd, wParam, lParam); 3087 3088 case TB_ISBUTTONPRESSED: 3089 return TOOLBAR_IsButtonPressed (hwnd, wParam, lParam); 3090 3091 /* case TB_LOADIMAGES: */ /* 4.70 */ 3092 /* case TB_MAPACCELERATORA: */ /* 4.71 */ 3093 /* case TB_MAPACCELERATORW: */ /* 4.71 */ 3094 /* case TB_MARKBUTTON: */ /* 4.71 */ 3095 /* case TB_MOVEBUTTON: */ /* 4.71 */ 3096 3097 case TB_PRESSBUTTON: 3098 return TOOLBAR_PressButton (hwnd, wParam, lParam); 3099 3100 /* case TB_REPLACEBITMAP: */ 3101 3102 case TB_SAVERESTOREA: 3103 return TOOLBAR_SaveRestoreA (hwnd, wParam, lParam); 3104 3105 /* case TB_SAVERESTOREW: */ 3106 /* case TB_SETANCHORHIGHLIGHT: */ /* 4.71 */ 3107 3108 case TB_SETBITMAPSIZE: 3109 return TOOLBAR_SetBitmapSize (hwnd, wParam, lParam); 3110 3111 case TB_SETBUTTONINFOA: 3112 return TOOLBAR_SetButtonInfoA (hwnd, wParam, lParam); 3113 3114 /* case TB_SETBUTTONINFOW: */ /* 4.71 */ 3115 3116 case TB_SETBUTTONSIZE: 3117 return TOOLBAR_SetButtonSize (hwnd, wParam, lParam); 3118 3119 case TB_SETBUTTONWIDTH: 3120 return TOOLBAR_SetButtonWidth (hwnd, wParam, lParam); 3121 3122 case TB_SETCMDID: 3123 return TOOLBAR_SetCmdId (hwnd, wParam, lParam); 3124 3125 /* case TB_SETCOLORSCHEME: */ /* 4.71 */ 3126 3127 case TB_SETDISABLEDIMAGELIST: 3128 return TOOLBAR_SetDisabledImageList (hwnd, wParam, lParam); 3129 3130 case TB_SETDRAWTEXTFLAGS: 3131 return TOOLBAR_SetDrawTextFlags (hwnd, wParam, lParam); 3132 3133 case TB_SETEXTENDEDSTYLE: 3134 return TOOLBAR_SetExtendedStyle (hwnd, wParam, lParam); 3135 3136 case TB_SETHOTIMAGELIST: 3137 return TOOLBAR_SetHotImageList (hwnd, wParam, lParam); 3138 3139 /* case TB_SETHOTITEM: */ /* 4.71 */ 3140 3141 case TB_SETIMAGELIST: 3142 return TOOLBAR_SetImageList (hwnd, wParam, lParam); 3143 3144 case TB_SETINDENT: 3145 return TOOLBAR_SetIndent (hwnd, wParam, lParam); 3146 3147 /* case TB_SETINSERTMARK: */ /* 4.71 */ 3148 3149 case TB_SETINSERTMARKCOLOR: 3150 return TOOLBAR_SetInsertMarkColor (hwnd, wParam, lParam); 3151 3152 case TB_SETMAXTEXTROWS: 3153 return TOOLBAR_SetMaxTextRows (hwnd, wParam, lParam); 3154 3155 /* case TB_SETPADDING: */ /* 4.71 */ 3156 3157 case TB_SETPARENT: 3158 return TOOLBAR_SetParent (hwnd, wParam, lParam); 3159 3160 case TB_SETROWS: 3161 return TOOLBAR_SetRows (hwnd, wParam, lParam); 3162 3163 case TB_SETSTATE: 3164 return TOOLBAR_SetState (hwnd, wParam, lParam); 3165 3166 case TB_SETSTYLE: 3167 return TOOLBAR_SetStyle (hwnd, wParam, lParam); 3168 3169 case TB_SETTOOLTIPS: 3170 return TOOLBAR_SetToolTips (hwnd, wParam, lParam); 3171 3172 case TB_SETUNICODEFORMAT: 3173 return TOOLBAR_SetUnicodeFormat (hwnd, wParam, lParam); 3174 3175 3176 /* case WM_CHAR: */ 3177 3178 case WM_CREATE: 3179 return TOOLBAR_Create (hwnd, wParam, lParam); 3180 3181 case WM_DESTROY: 3182 return TOOLBAR_Destroy (hwnd, wParam, lParam); 3183 3184 case WM_ERASEBKGND: 3185 return TOOLBAR_EraseBackground (hwnd, wParam, lParam); 3186 3187 /* case WM_GETFONT: */ 3188 /* case WM_KEYDOWN: */ 3189 /* case WM_KILLFOCUS: */ 3190 3191 case WM_LBUTTONDBLCLK: 3192 return TOOLBAR_LButtonDblClk (hwnd, wParam, lParam); 3193 3194 case WM_LBUTTONDOWN: 3195 return TOOLBAR_LButtonDown (hwnd, wParam, lParam); 3196 3197 case WM_LBUTTONUP: 3198 return TOOLBAR_LButtonUp (hwnd, wParam, lParam); 3199 3200 case WM_MOUSEMOVE: 3201 return TOOLBAR_MouseMove (hwnd, wParam, lParam); 3202 3203 case WM_NCACTIVATE: 3204 return TOOLBAR_NCActivate (hwnd, wParam, lParam); 3205 3206 case WM_NCCALCSIZE: 3207 return TOOLBAR_NCCalcSize (hwnd, wParam, lParam); 3208 3209 case WM_NCCREATE: 3210 return TOOLBAR_NCCreate (hwnd, wParam, lParam); 3211 3212 case WM_NCPAINT: 3213 return TOOLBAR_NCPaint (hwnd, wParam, lParam); 3214 3215 case WM_NOTIFY: 3216 return TOOLBAR_Notify (hwnd, wParam, lParam); 3217 3218 /* case WM_NOTIFYFORMAT: */ 3219 3220 case WM_PAINT: 3221 return TOOLBAR_Paint (hwnd, wParam); 3222 3223 case WM_SIZE: 3224 return TOOLBAR_Size (hwnd, wParam, lParam); 3225 3226 case WM_STYLECHANGED: 3227 return TOOLBAR_StyleChanged (hwnd, wParam, lParam); 3228 3229 /* case WM_SYSCOLORCHANGE: */ 3230 3231 /* case WM_WININICHANGE: */ 3232 3233 case WM_CHARTOITEM: 3234 case WM_COMMAND: 3235 case WM_DRAWITEM: 3236 case WM_MEASUREITEM: 3237 case WM_VKEYTOITEM: 3238 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 3239 3240 default: 3241 // if (uMsg >= WM_USER) 3242 // ERR (toolbar, "unknown msg %04x wp=%08x lp=%08lx\n", 3243 // uMsg, wParam, lParam); 3244 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 3244 3245 } 3245 3246 return 0; … … 3262 3263 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); 3263 3264 wndClass.lpszClassName = TOOLBARCLASSNAMEA; 3264 3265 3265 3266 RegisterClassA (&wndClass); 3266 3267 } … … 3271 3272 { 3272 3273 if (GlobalFindAtomA (TOOLBARCLASSNAMEA)) 3273 3274 } 3275 3274 UnregisterClassA (TOOLBARCLASSNAMEA, (HINSTANCE)NULL); 3275 } 3276
Note:
See TracChangeset
for help on using the changeset viewer.