comctl32: toolbar: TB_SETBUTTONINFO should do a relayout instead of a recalc.

This commit is contained in:
Mikołaj Zalewski 2009-02-01 13:05:03 +01:00 committed by Alexandre Julliard
parent ada088e62d
commit 5de172af78
2 changed files with 12 additions and 2 deletions

View File

@ -1028,6 +1028,8 @@ static BOOL did_recalc(HWND hToolbar)
static void test_recalc(void)
{
HWND hToolbar;
TBBUTTONINFO bi;
CHAR test[] = "Test";
/* Like TB_ADDBUTTONS tested in test_sized, inserting a button without text
* results in a relayout, while adding one with text forces a recalc */
@ -1039,6 +1041,14 @@ static void test_recalc(void)
SendMessage(hToolbar, TB_INSERTBUTTON, 1, (LPARAM)&buttons3[3]);
ok(did_recalc(hToolbar), "Expected a recalc - adding button with text\n");
/* TB_SETBUTTONINFO, even when adding a text, results only in a relayout */
prepare_recalc_test(&hToolbar);
bi.cbSize = sizeof(bi);
bi.dwMask = TBIF_TEXT;
bi.pszText = test;
SendMessage(hToolbar, TB_SETBUTTONINFO, 1, (LPARAM)&bi);
ok(!did_recalc(hToolbar), "Unexpected recalc - setting a button text\n");
DestroyWindow(hToolbar);
}

View File

@ -4447,7 +4447,7 @@ TOOLBAR_SetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* save the button rect to see if we need to redraw the whole toolbar */
oldBtnRect = btnPtr->rect;
TOOLBAR_CalcToolbar(hwnd);
TOOLBAR_LayoutToolbar(hwnd);
if (!EqualRect(&oldBtnRect, &btnPtr->rect))
InvalidateRect(hwnd, NULL, TRUE);
@ -4500,7 +4500,7 @@ TOOLBAR_SetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* save the button rect to see if we need to redraw the whole toolbar */
oldBtnRect = btnPtr->rect;
TOOLBAR_CalcToolbar(hwnd);
TOOLBAR_LayoutToolbar(hwnd);
if (!EqualRect(&oldBtnRect, &btnPtr->rect))
InvalidateRect(hwnd, NULL, TRUE);