diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index d5b055e3a3c..08ce4e06c38 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -843,6 +843,18 @@ static void test_sizes(void) SendMessageA(hToolbar, TB_INSERTBUTTON, 1, (LPARAM)&buttons2[0]); ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(23, 22), "Unexpected button size\n"); + /* TB_HIDEBUTTON and TB_MOVEBUTTON doesn't force a recalc */ + SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(100, 100)); + ok(SendMessageA(hToolbar, TB_MOVEBUTTON, 0, 1), "TB_MOVEBUTTON failed\n"); + ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(100, 100), "Unexpected button size\n"); + ok(SendMessageA(hToolbar, TB_HIDEBUTTON, 20, TRUE), "TB_HIDEBUTTON failed\n"); + ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(100, 100), "Unexpected button size\n"); + /* however changing the hidden flag with TB_SETSTATE does */ + ok(SendMessageA(hToolbar, TB_SETSTATE, 20, TBSTATE_ENABLED|TBSTATE_HIDDEN), "TB_SETSTATE failed\n"); + ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(100, 100), "Unexpected button size\n"); + ok(SendMessageA(hToolbar, TB_SETSTATE, 20, TBSTATE_ENABLED), "TB_SETSTATE failed\n"); + ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(23, 22), "Unexpected button size\n"); + rebuild_toolbar(&hToolbar); SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[3]); ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(27, 39), "Unexpected button size\n"); diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index c17e7b9691d..56dde257d39 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -3757,7 +3757,7 @@ TOOLBAR_HideButton (HWND hwnd, WPARAM wParam, LPARAM lParam) else btnPtr->fsState |= TBSTATE_HIDDEN; - TOOLBAR_CalcToolbar (hwnd); + TOOLBAR_LayoutToolbar (hwnd); InvalidateRect (hwnd, NULL, TRUE); @@ -4099,7 +4099,7 @@ TOOLBAR_MoveButton (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_MoveFixupIndex(&infoPtr->nHotItem, nIndex, nMoveIndex, FALSE); } - TOOLBAR_CalcToolbar(hwnd); + TOOLBAR_LayoutToolbar(hwnd); TOOLBAR_AutoSize(hwnd); InvalidateRect(hwnd, NULL, TRUE);