Mikołaj Zalewski : comctl32: toolbar: TB_SETBUTTONINFO should do a relayout instead of a recalc.

Alexandre Julliard julliard at winehq.org
Mon Feb 2 09:01:28 CST 2009


Module: wine
Branch: master
Commit: 5de172af78adbe3663ff014706431d7eeff64bdf
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5de172af78adbe3663ff014706431d7eeff64bdf

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Sun Feb  1 13:05:03 2009 +0100

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

---

 dlls/comctl32/tests/toolbar.c |   10 ++++++++++
 dlls/comctl32/toolbar.c       |    4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 6aefd41..514eece 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -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);
 }
 
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 730919c..d810e18 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -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);




More information about the wine-cvs mailing list