Changeset 9370 for trunk/src/comctl32/toolbar.c
- Timestamp:
- Oct 29, 2002, 1:19:36 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/toolbar.c
r8382 r9370 86 86 INT nRow; 87 87 RECT rect; 88 } TBUTTON_INFO; 88 } TBUTTON_INFO; 89 89 90 90 typedef struct … … 171 171 #define TOP_BORDER 2 172 172 #define BOTTOM_BORDER 2 173 #define DDARROW_WIDTH 11 173 #define DDARROW_WIDTH 11 174 174 175 175 #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0)) … … 197 197 else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings)) 198 198 lpText = infoPtr->strings[btnPtr->iString]; 199 199 200 200 return lpText; 201 201 } … … 213 213 btn_num, bP->idCommand, 214 214 (bP->bHot) ? "TRUE":"FALSE", bP->nRow, 215 bP->rect.left, bP->rect.top, 215 bP->rect.left, bP->rect.top, 216 216 bP->rect.right, bP->rect.bottom); 217 217 } … … 227 227 228 228 dwStyle = GetWindowLongA (iP->hwndSelf, GWL_STYLE); 229 TRACE("toolbar % 08xat line %d, exStyle=%08lx, buttons=%d, bitmaps=%d, strings=%d, style=%08lx\n",229 TRACE("toolbar %p at line %d, exStyle=%08lx, buttons=%d, bitmaps=%d, strings=%d, style=%08lx\n", 230 230 iP->hwndSelf, line, 231 231 iP->dwExStyle, iP->nNumButtons, iP->nNumBitmaps, 232 232 iP->nNumStrings, dwStyle); 233 TRACE("toolbar % 08xat line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n",233 TRACE("toolbar %p at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n", 234 234 iP->hwndSelf, line, 235 235 iP->himlInt, iP->himlDef, iP->himlHot, iP->himlDis, … … 253 253 { 254 254 if (dwStyle & TBSTYLE_ALTDRAG) 255 FIXME("[% 04x] TBSTYLE_ALTDRAG not implemented\n", hwnd);255 FIXME("[%p] TBSTYLE_ALTDRAG not implemented\n", hwnd); 256 256 if (dwStyle & TBSTYLE_REGISTERDROP) 257 FIXME("[% 04x] TBSTYLE_REGISTERDROP not implemented\n", hwnd);257 FIXME("[%p] TBSTYLE_REGISTERDROP not implemented\n", hwnd); 258 258 } 259 259 … … 264 264 if(!IsWindow(infoPtr->hwndSelf)) 265 265 return 0; /* we have just been destroyed */ 266 266 267 267 nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf); 268 268 nmhdr->hwndFrom = infoPtr->hwndSelf; 269 269 nmhdr->code = code; 270 270 271 TRACE("to window % 04x, code=%08x, %s\n", infoPtr->hwndNotify, code,271 TRACE("to window %p, code=%08x, %s\n", infoPtr->hwndNotify, code, 272 272 (infoPtr->bNtfUnicode) ? "via Unicode" : "via ANSI"); 273 273 274 274 if (infoPtr->bNtfUnicode) 275 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 275 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 276 276 (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr); 277 277 else 278 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 278 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 279 279 (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr); 280 280 } … … 287 287 * is issued to retrieve the index. 288 288 */ 289 static INT 289 static INT 290 290 TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr) 291 291 { … … 306 306 } 307 307 ret = nmgd.iImage; 308 TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n", 308 TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n", 309 309 ret, nmgd.dwMask, infoPtr->nNumBitmaps); 310 310 } … … 313 313 314 314 315 static BOOL 315 static BOOL 316 316 TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index) 317 317 { … … 329 329 * This function validates the bitmap index (including I_IMAGECALLBACK 330 330 * functionality). It then draws the image via the ImageList_Draw 331 * function. It returns TRUE if the image was drawn, FALSE otherwise. 331 * function. It returns TRUE if the image was drawn, FALSE otherwise. 332 332 */ 333 333 static BOOL … … 341 341 if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 342 342 if (btnPtr->iBitmap == I_IMAGENONE) return FALSE; 343 ERR("index %d is not valid, max %d\n", 343 ERR("index %d is not valid, max %d\n", 344 344 btnPtr->iBitmap, infoPtr->nNumBitmaps); 345 345 return FALSE; … … 376 376 if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 377 377 if (btnPtr->iBitmap == I_IMAGENONE) return FALSE; 378 ERR("index %d is not valid, max %d\n", 378 ERR("index %d is not valid, max %d\n", 379 379 btnPtr->iBitmap, infoPtr->nNumBitmaps); 380 380 return FALSE; … … 403 403 myrect.bottom = lpRect->bottom - 2; 404 404 405 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 405 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 406 406 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 407 407 oldcolor = SetBkColor (hdc, newcolor); … … 411 411 myrect.right = myrect.left + 1; 412 412 413 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 413 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 414 414 comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; 415 415 SetBkColor (hdc, newcolor); … … 447 447 myrect.left, myrect.top, myrect.right, myrect.bottom); 448 448 449 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 449 newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 450 450 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 451 451 oldcolor = SetBkColor (hdc, newcolor); … … 455 455 myrect.bottom = myrect.top + 1; 456 456 457 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 457 newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 458 458 comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; 459 459 SetBkColor (hdc, newcolor); … … 468 468 { 469 469 INT x, y; 470 SelectObject ( hdc, GetSysColorPen (colorRef)); 470 HPEN hPen, hOldPen; 471 472 if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return; 473 hOldPen = SelectObject ( hdc, hPen ); 471 474 x = left + 2; 472 475 y = top + 8; … … 477 480 MoveToEx (hdc, x, y, NULL); 478 481 LineTo (hdc, x+1, y++); 482 SelectObject( hdc, hOldPen ); 483 DeleteObject( hPen ); 479 484 } 480 485 … … 627 632 else 628 633 rc.right = max(rc.left, rc.right - DDARROW_WIDTH - 2); 629 rcArrow.left = rc.right; 634 rcArrow.left = rc.right; 630 635 } 631 636 … … 641 646 rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2; 642 647 643 TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n", 648 TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n", 644 649 btnPtr->iBitmap, rcBitmap.left, rcBitmap.top, 645 650 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); … … 652 657 InflateRect (&rcText, -3, -3); 653 658 654 if (infoPtr->himlDef && 659 if (infoPtr->himlDef && 655 660 TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { 656 661 /* The following test looked like this before … … 660 665 * ((btnPtr->fsStyle & TBSTYLE_AUTOSIZE) == 0) && 661 666 * (btnPtr->iBitmap != I_IMAGENONE)) 662 */ 667 */ 663 668 if (dwStyle & TBSTYLE_LIST) { 664 669 /* LIST style w/ ICON offset is by matching native. */ … … 707 712 tbcd.hpenLines = 0; 708 713 709 /* Issue Item Prepaint notify */ 714 /* Issue Item Prepaint notify */ 710 715 infoPtr->dwItemCustDraw = 0; 711 716 infoPtr->dwItemCDFlag = 0; … … 721 726 infoPtr->dwItemCustDraw = ntfret & 0xffff; 722 727 infoPtr->dwItemCDFlag = ntfret & 0xffff0000; 723 if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT) 728 if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT) 724 729 return; 725 730 /* save the only part of the rect that the user can change */ … … 761 766 BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); 762 767 } 763 768 764 769 if (hasDropDownArrow) 765 770 { … … 769 774 770 775 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDis, 771 hdc, rcBitmap.left, rcBitmap.top, 776 hdc, rcBitmap.left, rcBitmap.top, 772 777 ILD_NORMAL)) 773 778 TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); … … 800 805 801 806 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, 802 hdc, rcBitmap.left+offset, rcBitmap.top+offset, 807 hdc, rcBitmap.left+offset, rcBitmap.top+offset, 803 808 ILD_NORMAL); 804 809 … … 821 826 822 827 TOOLBAR_DrawPattern (hdc, &rc); 823 828 824 829 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, 825 hdc, rcBitmap.left+1, rcBitmap.top+1, 830 hdc, rcBitmap.left+1, rcBitmap.top+1, 826 831 ILD_NORMAL); 827 832 … … 830 835 } 831 836 832 /* indeterminate */ 837 /* indeterminate */ 833 838 if (btnPtr->fsState & TBSTATE_INDETERMINATE) { 834 839 if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) … … 884 889 if (btnPtr->bHot) { 885 890 /* if hot, attempt to draw with himlHot, if fails, use himlDef */ 886 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, 891 if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, 887 892 infoPtr->himlHot, 888 hdc, rcBitmap.left, 893 hdc, rcBitmap.left, 889 894 rcBitmap.top, ILD_NORMAL)) 890 895 TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, … … 914 919 hdc, rcBitmap.left, rcBitmap.top, 915 920 ILD_NORMAL);} 916 921 917 922 918 923 TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); … … 998 1003 */ 999 1004 static void 1000 TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 1005 TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, 1001 1006 HDC hdc, LPSIZE lpSize) 1002 1007 { … … 1006 1011 lpSize->cy = 0; 1007 1012 1008 if (!(btnPtr->fsState & TBSTATE_HIDDEN) ) 1013 if (!(btnPtr->fsState & TBSTATE_HIDDEN) ) 1009 1014 { 1010 1015 LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr); … … 1076 1081 * TOOLBAR_WrapToolbar 1077 1082 * 1078 * This function walks through the buttons and seperators in the 1079 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 1080 * wrapping should occur based on the width of the toolbar window. 1081 * It does *not* calculate button placement itself. That task 1082 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 1083 * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE 1083 * This function walks through the buttons and seperators in the 1084 * toolbar, and sets the TBSTATE_WRAP flag only on those items where 1085 * wrapping should occur based on the width of the toolbar window. 1086 * It does *not* calculate button placement itself. That task 1087 * takes place in TOOLBAR_CalcToolbar. If the program wants to manage 1088 * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE 1084 1089 * flag, and set the TBSTATE_WRAP flags manually on the appropriate items. 1085 1090 * 1086 * Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow 1087 * vertical toolbar lists. 1088 */ 1091 * Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow 1092 * vertical toolbar lists. 1093 */ 1089 1094 1090 1095 static void … … 1097 1102 BOOL bWrap, bButtonWrap; 1098 1103 1099 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ 1104 /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ 1100 1105 /* no layout is necessary. Applications may use this style */ 1101 1106 /* to perform their own layout on the toolbar. */ 1102 if( !(dwStyle & TBSTYLE_WRAPABLE) && 1107 if( !(dwStyle & TBSTYLE_WRAPABLE) && 1103 1108 !(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) ) return; 1104 1109 … … 1122 1127 bWrap = FALSE; 1123 1128 btnPtr[i].fsState &= ~TBSTATE_WRAP; 1124 1129 1125 1130 if (btnPtr[i].fsState & TBSTATE_HIDDEN) 1126 1131 continue; … … 1134 1139 if ((btnPtr[i].fsStyle & TBSTYLE_SEP) && 1135 1140 !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) 1136 cx = (btnPtr[i].iBitmap > 0) ? 1141 cx = (btnPtr[i].iBitmap > 0) ? 1137 1142 btnPtr[i].iBitmap : SEPARATOR_WIDTH; 1138 1143 else 1139 1144 cx = infoPtr->nButtonWidth; 1140 1145 1141 /* Two or more adjacent separators form a separator group. */ 1146 /* Two or more adjacent separators form a separator group. */ 1142 1147 /* The first separator in a group should be wrapped to the */ 1143 1148 /* next row if the previous wrapping is on a button. */ 1144 1149 if( bButtonWrap && 1145 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 1150 (btnPtr[i].fsStyle & TBSTYLE_SEP) && 1146 1151 (i + 1 < infoPtr->nNumButtons ) && 1147 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 1152 (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) 1148 1153 { 1149 1154 TRACE("wrap point 1 btn %d style %02x\n", i, btnPtr[i].fsStyle); … … 1158 1163 /* Test added to also wrap after a button that starts a row but */ 1159 1164 /* is bigger than the area. - GA 8/01 */ 1160 if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 1165 if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 1161 1166 > infoPtr->nWidth ) || 1162 1167 ((x == infoPtr->nIndent) && (cx > infoPtr->nWidth))) … … 1164 1169 BOOL bFound = FALSE; 1165 1170 1166 /* If the current button is a separator and not hidden, */ 1171 /* If the current button is a separator and not hidden, */ 1167 1172 /* go to the next until it reaches a non separator. */ 1168 1173 /* Wrap the last separator if it is before a button. */ 1169 1174 while( ( ((btnPtr[i].fsStyle & TBSTYLE_SEP) && 1170 !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) || 1175 !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) || 1171 1176 (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && 1172 1177 i < infoPtr->nNumButtons ) … … 1175 1180 bFound = TRUE; 1176 1181 } 1177 1182 1178 1183 if( bFound && i < infoPtr->nNumButtons ) 1179 1184 { 1180 1185 i--; 1181 TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n", 1186 TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n", 1182 1187 i, btnPtr[i].fsStyle, x, cx); 1183 1188 btnPtr[i].fsState |= TBSTATE_WRAP; … … 1189 1194 break; 1190 1195 1191 /* If the current button is not a separator, find the last */ 1196 /* If the current button is not a separator, find the last */ 1192 1197 /* separator and wrap it. */ 1193 1198 for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) … … 1196 1201 !(btnPtr[j].fsState & TBSTATE_HIDDEN)) 1197 1202 { 1198 bFound = TRUE; 1199 i = j; 1200 TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n", 1203 bFound = TRUE; 1204 i = j; 1205 TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n", 1201 1206 i, btnPtr[i].fsStyle, x, cx); 1202 1207 x = infoPtr->nIndent; 1203 1208 btnPtr[j].fsState |= TBSTATE_WRAP; 1204 bButtonWrap = FALSE; 1209 bButtonWrap = FALSE; 1205 1210 break; 1206 1211 } … … 1211 1216 if (!bFound) 1212 1217 { 1213 for ( j = i - 1; 1218 for ( j = i - 1; 1214 1219 j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) 1215 1220 { 1216 if (btnPtr[j].fsState & TBSTATE_HIDDEN) 1221 if (btnPtr[j].fsState & TBSTATE_HIDDEN) 1217 1222 continue; 1218 1223 1219 bFound = TRUE; 1220 i = j; 1221 TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n", 1224 bFound = TRUE; 1225 i = j; 1226 TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n", 1222 1227 i, btnPtr[i].fsStyle, x, cx); 1223 1228 x = infoPtr->nIndent; … … 1229 1234 1230 1235 /* If all above failed, wrap the current button. */ 1231 if (!bFound) 1236 if (!bFound) 1232 1237 { 1233 1238 TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n", … … 1240 1245 else 1241 1246 bButtonWrap = TRUE; 1242 } 1247 } 1243 1248 } 1244 1249 else { 1245 TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n", 1250 TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n", 1246 1251 i, btnPtr[i].fsStyle, x, cx); 1247 1252 x += cx; … … 1254 1259 * TOOLBAR_CalcToolbar 1255 1260 * 1256 * This function calculates button and separator placement. It first 1257 * calculates the button sizes, gets the toolbar window width and then 1258 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 1261 * This function calculates button and separator placement. It first 1262 * calculates the button sizes, gets the toolbar window width and then 1263 * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap 1259 1264 * on. It assigns a new location to each item and sends this location to 1260 * the tooltip window if appropriate. Finally, it updates the rcBound 1261 * rect and calculates the new required toolbar window height. 1262 */ 1265 * the tooltip window if appropriate. Finally, it updates the rcBound 1266 * rect and calculates the new required toolbar window height. 1267 */ 1263 1268 1264 1269 static void … … 1297 1302 { 1298 1303 if (usesBitmaps) 1299 infoPtr->nButtonHeight = sizeString.cy + 1304 infoPtr->nButtonHeight = sizeString.cy + 1300 1305 2 + /* this is the space to separate text from bitmap */ 1301 1306 infoPtr->nBitmapHeight + 6; 1302 else 1307 else 1303 1308 infoPtr->nButtonHeight = sizeString.cy + 6; 1304 1309 } … … 1323 1328 1324 1329 /* 1325 * We will set the height below, and we set the width on entry 1326 * so we do not reset them here.. 1330 * We will set the height below, and we set the width on entry 1331 * so we do not reset them here.. 1327 1332 */ 1328 1333 #if 0 … … 1385 1390 else 1386 1391 { 1387 if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) 1392 if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) 1388 1393 { 1389 1394 SIZE sz; … … 1402 1407 /* toolbars with native control (v4.71). - GA 8/01 */ 1403 1408 cx = sz.cx + 6 + 5 + 5; 1404 if ((dwStyle & TBSTYLE_LIST) && 1409 if ((dwStyle & TBSTYLE_LIST) && 1405 1410 (TOOLBAR_TestImageExist (infoPtr, btnPtr, infoPtr->himlDef))) 1406 1411 cx += infoPtr->nBitmapWidth; … … 1410 1415 1411 1416 if (hasDropDownArrows && (btnPtr->fsStyle & TBSTYLE_DROPDOWN)) 1412 cx += DDARROW_WIDTH; 1417 cx += DDARROW_WIDTH; 1413 1418 } 1414 1419 if (btnPtr->fsState & TBSTATE_WRAP ) … … 1425 1430 1426 1431 /* Set the toolTip only for non-hidden, non-separator button */ 1427 if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 1432 if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) 1428 1433 { 1429 1434 TTTOOLINFOA ti; … … 1450 1455 if ( !(btnPtr->fsStyle & TBSTYLE_SEP) ) 1451 1456 y += cy; 1452 else 1453 { 1457 else 1458 { 1454 1459 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ 1455 1460 /* it is the actual width of the separator. This is used for */ … … 1457 1462 if ( !(btnPtr->fsStyle & TBSTYLE_DROPDOWN)) 1458 1463 y += cy + ( (btnPtr->iBitmap > 0 ) ? 1459 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 1464 btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; 1460 1465 else 1461 1466 y += cy; 1462 1467 1463 1468 /* nSepRows is used to calculate the extra height follwoing */ 1464 1469 /* the last row. */ … … 1491 1496 /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following */ 1492 1497 /* the last row. */ 1493 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 1498 infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + 1494 1499 nSepRows * (SEPARATOR_WIDTH * 2 / 3) + 1495 nSepRows * (infoPtr->nBitmapHeight + 1) + 1496 BOTTOM_BORDER; 1500 nSepRows * (infoPtr->nBitmapHeight + 1) + 1501 BOTTOM_BORDER; 1497 1502 #endif 1498 1503 … … 1509 1514 TBUTTON_INFO *btnPtr; 1510 1515 INT i; 1511 1516 1512 1517 btnPtr = infoPtr->buttons; 1513 1518 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { … … 1589 1594 nRunIndex = nIndex + 1; 1590 1595 while (nRunIndex < infoPtr->nNumButtons) { 1591 btnPtr = &infoPtr->buttons[nRunIndex]; 1596 btnPtr = &infoPtr->buttons[nRunIndex]; 1592 1597 if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { 1593 1598 if (btnPtr->fsState & TBSTATE_CHECKED) … … 1644 1649 int i = 0; 1645 1650 int index; 1646 1651 1647 1652 infoPtr = custInfo->tbInfo; 1648 1653 … … 1664 1669 /* send TBN_QUERYDELETE notification */ 1665 1670 nmtb.iItem = i; 1666 btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb, 1667 infoPtr, 1671 btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb, 1672 infoPtr, 1668 1673 TBN_QUERYDELETE); 1669 1674 … … 1693 1698 break; 1694 1699 1695 TRACE("style: %x\n", nmtb.tbButton.fsStyle); 1700 TRACE("style: %x\n", nmtb.tbButton.fsStyle); 1696 1701 1697 1702 /* insert button into the apropriate list */ … … 1769 1774 /* send TBN_QUERYINSERT notification */ 1770 1775 nmtb.iItem = index; 1771 TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, 1776 TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, 1772 1777 TBN_QUERYINSERT); 1773 1778 … … 1987 1992 RECT rcButton; 1988 1993 RECT rcText; 1989 HPEN h OldPen;1994 HPEN hPen, hOldPen; 1990 1995 HBRUSH hOldBrush; 1991 1996 COLORREF oldText = 0; … … 2006 2011 else 2007 2012 oldText = SetTextColor (lpdis->hDC, (lpdis->itemState & ODS_FOCUS)?comctl32_color.clrHighlightText:comctl32_color.clrWindowText); 2008 hOldPen = SelectObject (lpdis->hDC, GetSysColorPen ((lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 2013 hPen = CreatePen( PS_SOLID, 1, 2014 GetSysColor( (lpdis->itemState & ODS_SELECTED)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 2015 hOldPen = SelectObject (lpdis->hDC, hPen ); 2009 2016 hOldBrush = SelectObject (lpdis->hDC, GetSysColorBrush ((lpdis->itemState & ODS_FOCUS)?COLOR_HIGHLIGHT:COLOR_WINDOW)); 2010 2017 … … 2039 2046 SetBkColor (lpdis->hDC, oldBk); 2040 2047 SetTextColor (lpdis->hDC, oldText); 2041 2048 DeleteObject( hPen ); 2042 2049 return TRUE; 2043 2050 } … … 2076 2083 HBITMAP hbmLoad; 2077 2084 2078 TRACE("hwnd=% xwParam=%x lParam=%lx\n", hwnd, wParam, lParam);2085 TRACE("hwnd=%p wParam=%x lParam=%lx\n", hwnd, wParam, lParam); 2079 2086 if (!lpAddBmp) 2080 2087 return -1; … … 2094 2101 2095 2102 /* Windows resize all the buttons to the size of a newly added standard image */ 2096 if (lpAddBmp->nID & 1) 2103 if (lpAddBmp->nID & 1) 2097 2104 { 2098 2105 /* large icons */ 2099 /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap 2100 * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this 2106 /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap 2107 * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this 2101 2108 */ 2102 2109 SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, … … 2104 2111 SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, 2105 2112 MAKELPARAM((WORD)31, (WORD)30)); 2106 } 2107 else 2113 } 2114 else 2108 2115 { 2109 2116 /* small icons */ … … 2113 2120 MAKELPARAM((WORD)22, (WORD)22)); 2114 2121 } 2115 2122 2116 2123 TOOLBAR_CalcToolbar (hwnd); 2117 2124 } … … 2121 2128 if (nButtons <= 0) 2122 2129 return -1; 2123 2130 2124 2131 TRACE ("adding %d bitmaps!\n", nButtons); 2125 2132 } 2126 2133 2127 2134 if (!(infoPtr->himlDef)) { 2128 2135 /* create new default image list */ … … 2140 2147 if (lpAddBmp->hInst == (HINSTANCE)0) 2141 2148 { 2142 nIndex = 2149 nIndex = 2143 2150 ImageList_AddMasked (infoPtr->himlDef, (HBITMAP)lpAddBmp->nID, 2144 2151 CLR_DEFAULT); … … 2470 2477 { 2471 2478 PWSTR p = szString + 1; 2472 2473 nIndex = infoPtr->nNumStrings; 2474 while (*p != L'|') { 2475 2476 if (infoPtr->nNumStrings == 0) { 2477 infoPtr->strings = 2478 COMCTL32_Alloc (sizeof(LPWSTR)); 2479 } 2480 else { 2481 LPWSTR *oldStrings = infoPtr->strings; 2482 infoPtr->strings = 2483 COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 2484 memcpy (&infoPtr->strings[0], &oldStrings[0], 2485 sizeof(LPWSTR) * infoPtr->nNumStrings); 2486 COMCTL32_Free (oldStrings); 2487 } 2488 2489 len = COMCTL32_StrChrW (p, L'|') - p; 2490 TRACE("len=%d %s\n", len, debugstr_w(p)); 2491 infoPtr->strings[infoPtr->nNumStrings] = 2492 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 2493 lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1); 2494 infoPtr->nNumStrings++; 2495 2496 p += (len+1); 2497 } 2479 2480 nIndex = infoPtr->nNumStrings; 2481 while (*p != L'|' && *p != L'\0') { 2482 PWSTR np; 2483 2484 if (infoPtr->nNumStrings == 0) { 2485 infoPtr->strings = COMCTL32_Alloc (sizeof(LPWSTR)); 2486 } 2487 else 2488 { 2489 LPWSTR *oldStrings = infoPtr->strings; 2490 infoPtr->strings = COMCTL32_Alloc(sizeof(LPWSTR) * (infoPtr->nNumStrings + 1)); 2491 memcpy(&infoPtr->strings[0], &oldStrings[0], 2492 sizeof(LPWSTR) * infoPtr->nNumStrings); 2493 COMCTL32_Free(oldStrings); 2494 } 2495 2496 np=COMCTL32_StrChrW (p, L'|'); 2497 if (np!=NULL) { 2498 len = np - p; 2499 np++; 2500 } else { 2501 len = strlenW(p); 2502 np = p + len; 2503 } 2504 TRACE("len=%d %s\n", len, debugstr_w(p)); 2505 infoPtr->strings[infoPtr->nNumStrings] = 2506 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 2507 lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1); 2508 infoPtr->nNumStrings++; 2509 2510 p = np; 2511 } 2498 2512 } 2499 2513 else … … 2635 2649 2636 2650 if (infoPtr == NULL) { 2637 ERR("( 0x%x, 0x%x, 0x%lx)\n", hwnd, wParam, lParam);2651 ERR("(%p, 0x%x, 0x%lx)\n", hwnd, wParam, lParam); 2638 2652 ERR("infoPtr == NULL!\n"); 2639 2653 return 0; … … 2692 2706 else { 2693 2707 if (btnPtr->fsStyle & TBSTYLE_GROUP) { 2694 nOldIndex = 2708 nOldIndex = 2695 2709 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex); 2696 2710 if (nOldIndex == nIndex) … … 2752 2766 return FALSE; 2753 2767 2754 ret = DialogBoxIndirectParamA ( GetWindowLongA(hwnd, GWL_HINSTANCE),2768 ret = DialogBoxIndirectParamA ((HINSTANCE)GetWindowLongA(hwnd, GWL_HINSTANCE), 2755 2769 (LPDLGTEMPLATEA)template, 2756 2770 hwnd, … … 2775 2789 return FALSE; 2776 2790 2777 if ((infoPtr->hwndToolTip) && 2791 if ((infoPtr->hwndToolTip) && 2778 2792 !(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) { 2779 2793 TTTOOLINFOA ti; … … 2970 2984 return -1; 2971 2985 2972 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 2986 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 2973 2987 lpTbInfo->dwMask & 0x80000000); 2974 2988 if (nIndex == -1) … … 2976 2990 2977 2991 btnPtr = &infoPtr->buttons[nIndex]; 2992 2993 if(!btnPtr) 2994 return -1; 2978 2995 2979 2996 if (lpTbInfo->dwMask & TBIF_COMMAND) … … 3128 3145 if (btnPtr->fsState & TBSTATE_HIDDEN) 3129 3146 return FALSE; 3130 3147 3131 3148 lpRect->left = btnPtr->rect.left; 3132 3149 lpRect->right = btnPtr->rect.right; … … 3189 3206 if (lpRect == NULL) 3190 3207 return FALSE; 3191 3208 3192 3209 lpRect->left = btnPtr->rect.left; 3193 3210 lpRect->right = btnPtr->rect.right; … … 3258 3275 if (infoPtr == NULL) 3259 3276 return 0; 3260 return infoPtr->hwndToolTip;3277 return (LRESULT)infoPtr->hwndToolTip; 3261 3278 } 3262 3279 … … 3267 3284 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3268 3285 3269 TRACE("%s hwnd= 0x%x stub!\n",3286 TRACE("%s hwnd=%p stub!\n", 3270 3287 infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd); 3271 3288 … … 3465 3482 return FALSE; 3466 3483 3467 /* If the string passed is not an index, assume address of string 3484 /* If the string passed is not an index, assume address of string 3468 3485 and do our own AddString */ 3469 3486 if ((HIWORD(lpTbb->iString) != 0) && (lpTbb->iString != -1)) { … … 3663 3680 int i = 0, nOldButtons = 0, pos = 0; 3664 3681 3665 TRACE("hInstOld % x nIDOld %x hInstNew %xnIDNew %x nButtons %x\n",3682 TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n", 3666 3683 lpReplace->hInstOld, lpReplace->nIDOld, lpReplace->hInstNew, lpReplace->nIDNew, 3667 3684 lpReplace->nButtons); 3668 3685 3669 if (lpReplace->hInstOld == -1)3686 if (lpReplace->hInstOld == HINST_COMMCTRL) 3670 3687 { 3671 3688 FIXME("changing standard bitmaps not implemented\n"); … … 3682 3699 } 3683 3700 3684 TRACE("To be replaced hInstOld % xnIDOld %x\n", lpReplace->hInstOld, lpReplace->nIDOld);3701 TRACE("To be replaced hInstOld %p nIDOld %x\n", lpReplace->hInstOld, lpReplace->nIDOld); 3685 3702 for (i = 0; i < infoPtr->nNumBitmapInfos; i++) { 3686 3703 TBITMAP_INFO *tbi = &infoPtr->bitmaps[i]; 3687 TRACE("tbimapinfo %d hInstOld % xnIDOld %x\n", i, tbi->hInst, tbi->nID);3704 TRACE("tbimapinfo %d hInstOld %p nIDOld %x\n", i, tbi->hInst, tbi->nID); 3688 3705 if (tbi->hInst == lpReplace->hInstOld && tbi->nID == lpReplace->nIDOld) 3689 3706 { 3690 TRACE("Found: nButtons %d hInst % xnID %x\n", tbi->nButtons, tbi->hInst, tbi->nID);3707 TRACE("Found: nButtons %d hInst %p nID %x\n", tbi->nButtons, tbi->hInst, tbi->nID); 3691 3708 nOldButtons = tbi->nButtons; 3692 3709 tbi->nButtons = lpReplace->nButtons; 3693 3710 tbi->hInst = lpReplace->hInstNew; 3694 3711 tbi->nID = lpReplace->nIDNew; 3695 TRACE("tbimapinfo changed %d hInstOld % xnIDOld %x\n", i, tbi->hInst, tbi->nID);3712 TRACE("tbimapinfo changed %d hInstOld %p nIDOld %x\n", i, tbi->hInst, tbi->nID); 3696 3713 break; 3697 3714 } … … 3701 3718 if (nOldButtons == 0) 3702 3719 { 3703 WARN("No hinst/bitmap found! hInst % xnID %x\n", lpReplace->hInstOld, lpReplace->nIDOld);3720 WARN("No hinst/bitmap found! hInst %p nID %x\n", lpReplace->hInstOld, lpReplace->nIDOld); 3704 3721 return FALSE; 3705 3722 } … … 3833 3850 if (lptbbi->cbSize < sizeof(TBBUTTONINFOA)) 3834 3851 return FALSE; 3835 3852 3836 3853 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 3837 3854 lptbbi->dwMask & 0x80000000); … … 3857 3874 /* iString is index, zero it to make Str_SetPtr succeed */ 3858 3875 btnPtr->iString=0; 3859 3876 3860 3877 Str_SetPtrAtoW ((LPWSTR *)&btnPtr->iString, lptbbi->pszText); 3861 3878 } … … 3919 3936 3920 3937 /* The documentation claims you can only change the button size before 3921 * any button has been added. But this is wrong. 3922 * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding 3938 * any button has been added. But this is wrong. 3939 * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding 3923 3940 * it to the toolbar, and it checks that the return value is nonzero - mjm 3924 3941 * Further testing shows that we must actually perform the change too. … … 3927 3944 * The documentation also does not mention that if 0 is supplied for 3928 3945 * either size, the system changes it to the default of 24 wide and 3929 * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 3946 * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 3930 3947 */ 3931 3948 infoPtr->nButtonWidth = (cx) ? cx : 24; … … 3950 3967 TRACE("matches current width, min=%d, max=%d, no recalc\n", 3951 3968 infoPtr->cxMin, infoPtr->cxMax); 3952 return TRUE; 3969 return TRUE; 3953 3970 } 3954 3971 … … 3959 3976 /* if both values are 0 then we are done */ 3960 3977 if (lParam == 0) { 3961 TRACE("setting both min and max to 0, norecalc\n"); 3978 TRACE("setting both min and max to 0, norecalc\n"); 3962 3979 return TRUE; 3963 3980 } … … 3966 3983 recalc the bounding rectangle (does DrawText w/ DT_CALCRECT 3967 3984 which doesn't actually draw - GA). */ 3968 TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n", 3985 TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n", 3969 3986 infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax); 3970 3987 … … 4015 4032 /* FIXME: redraw ? */ 4016 4033 4017 return (LRESULT)himlTemp; 4034 return (LRESULT)himlTemp; 4018 4035 } 4019 4036 … … 4054 4071 (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)); 4055 4072 4056 return (LRESULT)dwTemp; 4073 return (LRESULT)dwTemp; 4057 4074 } 4058 4075 … … 4074 4091 /* FIXME: redraw ? */ 4075 4092 4076 return (LRESULT)himlTemp; 4093 return (LRESULT)himlTemp; 4077 4094 } 4078 4095 … … 4133 4150 ImageList_GetIconSize(infoPtr->himlDef, &infoPtr->nBitmapWidth, 4134 4151 &infoPtr->nBitmapHeight); 4135 TRACE("hwnd % 08x, new himl=%08x, count=%d, bitmap w=%d, h=%d\n",4152 TRACE("hwnd %p, new himl=%08x, count=%d, bitmap w=%d, h=%d\n", 4136 4153 hwnd, (INT)infoPtr->himlDef, infoPtr->nNumBitmaps, 4137 4154 infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); … … 4140 4157 InvalidateRect(hwnd, NULL, TRUE); 4141 4158 4142 return (LRESULT)himlTemp; 4159 return (LRESULT)himlTemp; 4143 4160 } 4144 4161 … … 4223 4240 infoPtr->hwndNotify = (HWND)wParam; 4224 4241 4225 return hwndOldNotify;4242 return (LRESULT)hwndOldNotify; 4226 4243 } 4227 4244 … … 4342 4359 BOOL bTemp; 4343 4360 4344 TRACE("%s hwnd= 0x%04x stub!\n",4361 TRACE("%s hwnd=%p stub!\n", 4345 4362 ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd); 4346 4363 … … 4357 4374 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4358 4375 4359 lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 4360 comctl32_color.clrBtnHighlight : 4376 lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? 4377 comctl32_color.clrBtnHighlight : 4361 4378 infoPtr->clrBtnHighlight; 4362 lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 4379 lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? 4363 4380 comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; 4364 4381 return 1; … … 4420 4437 infoPtr->buttons[nOldHotItem].idCommand : 0; 4421 4438 if ( !(nmhotitem.dwFlags & HICF_LEAVING) ) 4422 nmhotitem.idNew = (infoPtr->nHotItem >= 0) ? 4439 nmhotitem.idNew = (infoPtr->nHotItem >= 0) ? 4423 4440 infoPtr->buttons[infoPtr->nHotItem].idCommand : 0; 4424 4441 no_hi = TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE); … … 4629 4646 4630 4647 /* FIXME: in general the return flags *can* be or'ed together */ 4631 switch (infoPtr->dwBaseCustDraw) 4648 switch (infoPtr->dwBaseCustDraw) 4632 4649 { 4633 4650 case CDRF_DODEFAULT: … … 4636 4653 return TRUE; 4637 4654 default: 4638 FIXME("[% 04x] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",4655 FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n", 4639 4656 hwnd, ntfret); 4640 4657 } 4641 4658 } 4642 4659 4643 /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up 4660 /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up 4644 4661 * to my parent for processing. 4645 4662 */ … … 4660 4677 ret = DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam); 4661 4678 4662 if ((dwStyle & TBSTYLE_CUSTOMERASE) && 4663 (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) { 4679 if ((dwStyle & TBSTYLE_CUSTOMERASE) && 4680 (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) { 4664 4681 ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); 4665 4682 tbcd.nmcd.dwDrawStage = CDDS_POSTERASE; … … 4667 4684 ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); 4668 4685 infoPtr->dwBaseCustDraw = ntfret & 0xffff; 4669 switch (infoPtr->dwBaseCustDraw) 4686 switch (infoPtr->dwBaseCustDraw) 4670 4687 { 4671 4688 case CDRF_DODEFAULT: … … 4674 4691 return TRUE; 4675 4692 default: 4676 FIXME("[% 04x] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n",4693 FIXME("[%p] response %ld not handled to NM_CUSTOMDRAW (CDDS_PREERASE)\n", 4677 4694 hwnd, ntfret); 4678 4695 } … … 4687 4704 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4688 4705 4689 return infoPtr->hFont;4706 return (LRESULT)infoPtr->hFont; 4690 4707 } 4691 4708 … … 4743 4760 RECT arrowRect; 4744 4761 btnPtr = &infoPtr->buttons[nHit]; 4745 if (!(btnPtr->fsState & TBSTATE_ENABLED))4746 return 0;4747 4748 4762 infoPtr->nOldHit = nHit; 4749 4763 … … 4752 4766 4753 4767 /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */ 4754 if ((btnPtr->fsSt yle & TBSTYLE_DROPDOWN) &&4768 if ((btnPtr->fsState & TBSTATE_ENABLED) && (btnPtr->fsStyle & TBSTYLE_DROPDOWN) && 4755 4769 ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) || 4756 4770 (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle)))) … … 4783 4797 btnPtr->bHot = FALSE; 4784 4798 4785 InvalidateRect(hwnd, &btnPtr->rect, 4786 4799 if (btnPtr->fsState & TBSTATE_ENABLED) 4800 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, btnPtr)); 4787 4801 UpdateWindow(hwnd); 4788 4802 SetCapture (hwnd); … … 4840 4854 if (nOldIndex == nHit) 4841 4855 bSendMessage = FALSE; 4842 if ((nOldIndex != nHit) && 4856 if ((nOldIndex != nHit) && 4843 4857 (nOldIndex != -1)) 4844 4858 infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED; … … 4862 4876 * now we can ReleaseCapture, which triggers CAPTURECHANGED msg, 4863 4877 * that resets bCaptured and btn TBSTATE_PRESSED flags, 4864 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 4878 * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) 4865 4879 */ 4866 4880 if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) 4867 4881 ReleaseCapture (); 4882 infoPtr->nButtonDown = -1; 4868 4883 4869 4884 /* Issue NM_RELEASEDCAPTURE to parent to let him know it is released */ … … 4871 4886 NM_RELEASEDCAPTURE); 4872 4887 4873 /* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the 4888 /* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the 4874 4889 * TBN_BEGINDRAG 4875 4890 */ … … 4886 4901 TBN_ENDDRAG); 4887 4902 4888 SendMessageA (infoPtr->hwndNotify, WM_COMMAND, 4889 MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); 4890 4891 /* !!! Undocumented - toolbar at 4.71 level and above sends 4892 * either NMRCLICK or NM_CLICK with the NMMOUSE structure. 4893 * Only NM_RCLICK is documented. 4894 */ 4895 nmmouse.dwItemSpec = btnPtr->idCommand; 4896 nmmouse.dwItemData = btnPtr->dwData; 4897 TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, 4898 NM_CLICK); 4903 if (btnPtr->fsState & TBSTATE_ENABLED) 4904 { 4905 SendMessageA (infoPtr->hwndNotify, WM_COMMAND, 4906 MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); 4907 4908 /* !!! Undocumented - toolbar at 4.71 level and above sends 4909 * either NMRCLICK or NM_CLICK with the NMMOUSE structure. 4910 * Only NM_RCLICK is documented. 4911 */ 4912 nmmouse.dwItemSpec = btnPtr->idCommand; 4913 nmmouse.dwItemData = btnPtr->dwData; 4914 TOOLBAR_SendNotify ((NMHDR *) &nmmouse, infoPtr, NM_CLICK); 4915 } 4899 4916 return 0; 4900 4917 } … … 4913 4930 btnPtr->fsState &= ~TBSTATE_PRESSED; 4914 4931 4915 infoPtr->nButtonDown = -1;4916 4932 infoPtr->nOldHit = -1; 4917 4933 4918 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, 4919 btnPtr)); 4934 if (btnPtr->fsState & TBSTATE_ENABLED) 4935 InvalidateRect(hwnd, &btnPtr->rect, TOOLBAR_HasText(infoPtr, 4936 btnPtr)); 4920 4937 } 4921 4938 return 0; … … 4986 5003 if(!(trackinfo.dwFlags & TME_LEAVE)) { 4987 5004 trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ 4988 5005 4989 5006 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ 4990 5007 /* and can properly deactivate the hot toolbar button */ … … 5005 5022 /* Remove the effect of an old hot button if the button was enabled and was 5006 5023 drawn with the hot button effect */ 5007 if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem && 5024 if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem && 5008 5025 (infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED)) 5009 5026 { … … 5019 5036 infoPtr->nHotItem = nHit; 5020 5037 5021 /* only enabled buttons show hot effect */ 5038 /* only enabled buttons show hot effect */ 5022 5039 if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED) 5023 5040 { … … 5110 5127 * hdc = GetDC(toolbar) 5111 5128 * GetSystemMetrics(0x48) 5112 * fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, 5129 * fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, 5113 5130 * 0, 0, 0, 0, "MARLETT") 5114 5131 * oldfnt = SelectObject(hdc, fnt2) … … 5199 5216 if (lppgc->dwFlag == PGF_CALCWIDTH) { 5200 5217 lppgc->iWidth = infoPtr->rcBound.right - infoPtr->rcBound.left; 5201 TRACE("processed PGN_CALCSIZE, returning horz size = %d\n", 5218 TRACE("processed PGN_CALCSIZE, returning horz size = %d\n", 5202 5219 lppgc->iWidth); 5203 5220 } 5204 5221 else { 5205 5222 lppgc->iHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top; 5206 TRACE("processed PGN_CALCSIZE, returning vert size = %d\n", 5223 TRACE("processed PGN_CALCSIZE, returning vert size = %d\n", 5207 5224 lppgc->iHeight); 5208 5225 } 5226 return 0; 5227 } 5228 5229 if (lpnmh->code == PGN_SCROLL) { 5230 LPNMPGSCROLL lppgs = (LPNMPGSCROLL)lParam; 5231 5232 lppgs->iScroll = (lppgs->iDir & (PGF_SCROLLLEFT | PGF_SCROLLRIGHT)) ? 5233 infoPtr->nButtonWidth : infoPtr->nButtonHeight; 5234 TRACE("processed PGN_SCROLL, returning scroll=%d, dir=%d\n", 5235 lppgs->iScroll, lppgs->iDir); 5209 5236 return 0; 5210 5237 } … … 5215 5242 if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) { 5216 5243 if (infoPtr->bNtfUnicode) 5217 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 5244 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 5218 5245 wParam, lParam); 5219 5246 else 5220 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 5247 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 5221 5248 wParam, lParam); 5222 5249 … … 5259 5286 if (lParam == NF_REQUERY) { 5260 5287 i = SendMessageA(GetParent(infoPtr->hwndSelf), 5261 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);5288 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); 5262 5289 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 5263 5290 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", … … 5280 5307 5281 5308 /* fill ps.rcPaint with a default rect */ 5282 memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound)); 5309 memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound)); 5283 5310 5284 5311 hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam; … … 5303 5330 * 5304 5331 * Documentation: 5305 * According to testing V4.71 of COMCTL32 returns the 5332 * According to testing V4.71 of COMCTL32 returns the 5306 5333 * *previous* status of the redraw flag (either 0 or 1) 5307 5334 * instead of the MSDN documented value of 0 if handled. … … 5314 5341 BOOL oldredraw = infoPtr->bDoRedraw; 5315 5342 5316 TRACE("set to %s\n", 5343 TRACE("set to %s\n", 5317 5344 (wParam) ? "TRUE" : "FALSE"); 5318 5345 infoPtr->bDoRedraw = (BOOL) wParam; … … 5368 5395 * Calc Toolbar will not adjust it, only the height 5369 5396 */ 5370 infoPtr->nWidth = parent_rect.right - parent_rect.left; 5397 infoPtr->nWidth = parent_rect.right - parent_rect.left; 5371 5398 cy = infoPtr->nHeight; 5372 5399 cx = infoPtr->nWidth; … … 5424 5451 } 5425 5452 infoPtr->bTransparent = (lpStyle->styleNew & TBSTYLE_TRANSPARENT); 5426 infoPtr->bBtnTranspnt = (lpStyle->styleNew & 5453 infoPtr->bBtnTranspnt = (lpStyle->styleNew & 5427 5454 (TBSTYLE_FLAT | TBSTYLE_LIST)); 5428 5455 TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew); … … 5450 5477 ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 5451 5478 { 5452 TRACE("hwnd=% x msg=%x wparam=%x lparam=%lx\n",5479 TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", 5453 5480 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); 5454 5481 … … 5758 5785 5759 5786 case WM_MOUSELEAVE: 5760 return TOOLBAR_MouseLeave (hwnd, wParam, lParam); 5787 return TOOLBAR_MouseLeave (hwnd, wParam, lParam); 5761 5788 5762 5789 case WM_CAPTURECHANGED: 5763 return TOOLBAR_CaptureChanged(hwnd); 5790 return TOOLBAR_CaptureChanged(hwnd); 5764 5791 5765 5792 case WM_NCACTIVATE: … … 5816 5843 5817 5844 default: 5818 if ( uMsg >= WM_USER)5845 if ((uMsg >= WM_USER) && (uMsg < WM_APP)) 5819 5846 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 5820 5847 uMsg, wParam, lParam); … … 5838 5865 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); 5839 5866 wndClass.lpszClassName = TOOLBARCLASSNAMEA; 5840 5867 5841 5868 RegisterClassA (&wndClass); 5842 5869 }
Note:
See TracChangeset
for help on using the changeset viewer.