comctl32: toolbar: TB_HIDEBUTTON and TB_MOVEBUTTON shouldn't force a recalc.

This commit is contained in:
Mikołaj Zalewski 2007-03-27 09:44:46 +02:00 committed by Alexandre Julliard
parent 23e2cb1f59
commit 7bf7cdd1a9
2 changed files with 14 additions and 2 deletions

View File

@ -843,6 +843,18 @@ static void test_sizes(void)
SendMessageA(hToolbar, TB_INSERTBUTTON, 1, (LPARAM)&buttons2[0]); SendMessageA(hToolbar, TB_INSERTBUTTON, 1, (LPARAM)&buttons2[0]);
ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(23, 22), "Unexpected button size\n"); 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); rebuild_toolbar(&hToolbar);
SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[3]); SendMessageA(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&buttons3[3]);
ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(27, 39), "Unexpected button size\n"); ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(27, 39), "Unexpected button size\n");

View File

@ -3757,7 +3757,7 @@ TOOLBAR_HideButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
else else
btnPtr->fsState |= TBSTATE_HIDDEN; btnPtr->fsState |= TBSTATE_HIDDEN;
TOOLBAR_CalcToolbar (hwnd); TOOLBAR_LayoutToolbar (hwnd);
InvalidateRect (hwnd, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
@ -4099,7 +4099,7 @@ TOOLBAR_MoveButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_MoveFixupIndex(&infoPtr->nHotItem, nIndex, nMoveIndex, FALSE); TOOLBAR_MoveFixupIndex(&infoPtr->nHotItem, nIndex, nMoveIndex, FALSE);
} }
TOOLBAR_CalcToolbar(hwnd); TOOLBAR_LayoutToolbar(hwnd);
TOOLBAR_AutoSize(hwnd); TOOLBAR_AutoSize(hwnd);
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);