Toolbar: Fix TBN_DELETINGBUTTON Notification
Robert Shearman
rob at codeweavers.com
Mon Oct 18 05:12:38 CDT 2004
Changelog:
- TBN_DELETINGBUTTON sends the command ID, not the index.
- Fill in tbButton structure for TBN_DELETINGBUTTON notification.
- Document TBN_QUERY* sending indices.
-------------- next part --------------
Index: wine/dlls/comctl32/toolbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.194
diff -u -p -r1.194 toolbar.c
--- wine/dlls/comctl32/toolbar.c 23 Sep 2004 22:51:14 -0000 1.194
+++ wine/dlls/comctl32/toolbar.c 17 Oct 2004 18:12:38 -0000
@@ -1801,8 +1801,9 @@ static void TOOLBAR_Cust_MoveButton(PCUS
if (nIndexFrom == nIndexTo)
return;
- /* send TBN_QUERYINSERT notification */
- nmtb.iItem = nIndexFrom; /* FIXME: this doesn't look right */
+ /* MSDN states that iItem is the index of the button, rather than the
+ * command ID as used by every other NMTOOLBAR notification */
+ nmtb.iItem = nIndexFrom;
if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT))
{
PCUSTOMBUTTON btnInfo;
@@ -1841,8 +1842,9 @@ static void TOOLBAR_Cust_AddButton(PCUST
TRACE("Add: nIndexAvail %d, nIndexTo %d\n", nIndexAvail, nIndexTo);
- /* send TBN_QUERYINSERT notification */
- nmtb.iItem = nIndexAvail; /* FIXME: this doesn't look right */
+ /* MSDN states that iItem is the index of the button, rather than the
+ * command ID as used by every other NMTOOLBAR notification */
+ nmtb.iItem = nIndexAvail;
if (TOOLBAR_SendNotify((NMHDR *)&nmtb, custInfo->tbInfo, TBN_QUERYINSERT))
{
PCUSTOMBUTTON btnInfo;
@@ -3191,16 +3193,23 @@ TOOLBAR_DeleteButton (HWND hwnd, WPARAM
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
INT nIndex = (INT)wParam;
NMTOOLBARW nmtb;
+ TBUTTON_INFO *btnPtr = &infoPtr->buttons[nIndex];
if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
- return FALSE;
+ return FALSE;
memset(&nmtb, 0, sizeof(nmtb));
- nmtb.iItem = nIndex;
+ nmtb.iItem = btnPtr->idCommand;
+ nmtb.tbButton.iBitmap = btnPtr->iBitmap;
+ nmtb.tbButton.idCommand = btnPtr->idCommand;
+ nmtb.tbButton.fsState = btnPtr->fsState;
+ nmtb.tbButton.fsStyle = btnPtr->fsStyle;
+ nmtb.tbButton.dwData = btnPtr->dwData;
+ nmtb.tbButton.iString = btnPtr->iString;
TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_DELETINGBUTTON);
if ((infoPtr->hwndToolTip) &&
- !(infoPtr->buttons[nIndex].fsStyle & BTNS_SEP)) {
+ !(btnPtr->fsStyle & BTNS_SEP)) {
TTTOOLINFOW ti;
ZeroMemory (&ti, sizeof(ti));
@@ -7167,10 +7176,12 @@ static BOOL TOOLBAR_GetButtonInfo(TOOLBA
static BOOL TOOLBAR_IsButtonRemovable(TOOLBAR_INFO *infoPtr,
int iItem, PCUSTOMBUTTON btnInfo)
{
- NMTOOLBARA nmtb;
+ NMTOOLBARW nmtb;
+ /* MSDN states that iItem is the index of the button, rather than the
+ * command ID as used by every other NMTOOLBAR notification */
nmtb.iItem = iItem;
memcpy(&nmtb.tbButton, &btnInfo->btn, sizeof(TBBUTTON));
- return TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_QUERYDELETE);
+ return TOOLBAR_SendNotify(&nmtb.hdr, infoPtr, TBN_QUERYDELETE);
}
More information about the wine-patches
mailing list