Commit 5de172af authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

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

parent ada088e6
...@@ -1028,6 +1028,8 @@ static BOOL did_recalc(HWND hToolbar) ...@@ -1028,6 +1028,8 @@ static BOOL did_recalc(HWND hToolbar)
static void test_recalc(void) static void test_recalc(void)
{ {
HWND hToolbar; HWND hToolbar;
TBBUTTONINFO bi;
CHAR test[] = "Test";
/* Like TB_ADDBUTTONS tested in test_sized, inserting a button without text /* Like TB_ADDBUTTONS tested in test_sized, inserting a button without text
* results in a relayout, while adding one with text forces a recalc */ * results in a relayout, while adding one with text forces a recalc */
...@@ -1039,6 +1041,14 @@ static void test_recalc(void) ...@@ -1039,6 +1041,14 @@ static void test_recalc(void)
SendMessage(hToolbar, TB_INSERTBUTTON, 1, (LPARAM)&buttons3[3]); SendMessage(hToolbar, TB_INSERTBUTTON, 1, (LPARAM)&buttons3[3]);
ok(did_recalc(hToolbar), "Expected a recalc - adding button with text\n"); 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); DestroyWindow(hToolbar);
} }
......
...@@ -4447,7 +4447,7 @@ TOOLBAR_SetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -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 */ /* save the button rect to see if we need to redraw the whole toolbar */
oldBtnRect = btnPtr->rect; oldBtnRect = btnPtr->rect;
TOOLBAR_CalcToolbar(hwnd); TOOLBAR_LayoutToolbar(hwnd);
if (!EqualRect(&oldBtnRect, &btnPtr->rect)) if (!EqualRect(&oldBtnRect, &btnPtr->rect))
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
...@@ -4500,7 +4500,7 @@ TOOLBAR_SetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -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 */ /* save the button rect to see if we need to redraw the whole toolbar */
oldBtnRect = btnPtr->rect; oldBtnRect = btnPtr->rect;
TOOLBAR_CalcToolbar(hwnd); TOOLBAR_LayoutToolbar(hwnd);
if (!EqualRect(&oldBtnRect, &btnPtr->rect)) if (!EqualRect(&oldBtnRect, &btnPtr->rect))
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment