Mikołaj Zalewski : comctl32: toolbar: Unlike in listview, TB_SETEXTENDEDSTYLE takes the actual style, not a mask .

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


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

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

comctl32: toolbar: Unlike in listview, TB_SETEXTENDEDSTYLE takes the actual style, not a mask.

---

 dlls/comctl32/tests/toolbar.c |   12 ++++++++++++
 dlls/comctl32/toolbar.c       |    9 ++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 514eece..1eac700 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -1030,6 +1030,7 @@ static void test_recalc(void)
     HWND hToolbar;
     TBBUTTONINFO bi;
     CHAR test[] = "Test";
+    int i;
 
     /* Like TB_ADDBUTTONS tested in test_sized, inserting a button without text
      * results in a relayout, while adding one with text forces a recalc */
@@ -1049,6 +1050,17 @@ static void test_recalc(void)
     SendMessage(hToolbar, TB_SETBUTTONINFO, 1, (LPARAM)&bi);
     ok(!did_recalc(hToolbar), "Unexpected recalc - setting a button text\n");
 
+    for (i = 0; i < 32; i++)
+    {
+        if (i == 1 || i == 3)  /* an undoc style and TBSTYLE_EX_MIXEDBUTTONS */
+            continue;
+        prepare_recalc_test(&hToolbar);
+        expect(0, (int)SendMessage(hToolbar, TB_GETEXTENDEDSTYLE, 0, 0));
+        SendMessage(hToolbar, TB_SETEXTENDEDSTYLE, 0, (1 << i));
+        SendMessage(hToolbar, TB_SETEXTENDEDSTYLE, 0, 0);
+        expect(0, (int)SendMessage(hToolbar, TB_GETEXTENDEDSTYLE, 0, 0));
+    }
+
     DestroyWindow(hToolbar);
 }
 
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index d810e18..b83f944 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -4648,11 +4648,10 @@ static LRESULT
 TOOLBAR_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
-    DWORD dwTemp;
+    DWORD dwOldStyle;
 
-    dwTemp = infoPtr->dwExStyle;
-    infoPtr->dwExStyle &= ~wParam;
-    infoPtr->dwExStyle |= (DWORD)lParam;
+    dwOldStyle = infoPtr->dwExStyle;
+    infoPtr->dwExStyle = (DWORD)lParam;
 
     TRACE("new style 0x%08x\n", infoPtr->dwExStyle);
 
@@ -4666,7 +4665,7 @@ TOOLBAR_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
     InvalidateRect(hwnd, NULL, TRUE);
 
-    return (LRESULT)dwTemp;
+    return (LRESULT)dwOldStyle;
 }
 
 




More information about the wine-cvs mailing list