Mikołaj Zalewski : comctl32: toolbar: In CreateToolbarEx the default bitmap size is also 16x16.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 24 07:23:56 CDT 2007


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

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Thu Apr  5 12:32:47 2007 +0200

comctl32: toolbar: In CreateToolbarEx the default bitmap size is also 16x16.

---

 dlls/comctl32/commctrl.c      |   11 ++++++-----
 dlls/comctl32/tests/toolbar.c |   14 +++++++++++++-
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c
index a5796f3..97810b3 100644
--- a/dlls/comctl32/commctrl.c
+++ b/dlls/comctl32/commctrl.c
@@ -686,12 +686,13 @@ CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
 
        /* set bitmap and button size */
        /*If CreateToolbarEx receives 0, windows sets default values*/
-       if (dxBitmap <= 0)
+       if (dxBitmap < 0)
            dxBitmap = 16;
-       if (dyBitmap <= 0)
-           dyBitmap = 15;
-       SendMessageW (hwndTB, TB_SETBITMAPSIZE, 0,
-                     MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap));
+       if (dyBitmap < 0)
+           dyBitmap = 16;
+       if (dxBitmap == 0 || dyBitmap == 0)
+           dxBitmap = dyBitmap = 16;
+       SendMessageW(hwndTB, TB_SETBITMAPSIZE, 0, MAKELPARAM(dxBitmap, dyBitmap));
 
        if (dxButton < 0)
            dxButton = dxBitmap;
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index be9390c..e2d5095 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -807,7 +807,7 @@ static void test_sizes(void)
     SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(3, 3));
     ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(23, 22), "Unexpected button size\n");
     check_sizes();
-    /* except for the first size, the default size is bitmap size + padding */
+    /* the default size is bitmap size + padding */
     SendMessageA(hToolbar, TB_SETPADDING, 0, MAKELONG(1, 1));
     SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(3, 3));
     ok(SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0) == MAKELONG(17, 17), "Unexpected button size\n");
@@ -922,6 +922,18 @@ static void test_createtoolbarex()
     CHECK_IMAGELIST(16, 16, 8);
     compare((int)SendMessage(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0017, "%x");
     DestroyWindow(hToolbar);
+
+    hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandle(NULL), IDB_BITMAP_128x15, btns,
+        3, 0, 0, 12, -1, sizeof(TBBUTTON));
+    CHECK_IMAGELIST(16, 12, 16);
+    compare((int)SendMessage(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160013, "%x");
+    DestroyWindow(hToolbar);
+
+    hToolbar = CreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandle(NULL), IDB_BITMAP_128x15, btns,
+        3, 0, 0, 0, 12, sizeof(TBBUTTON));
+    CHECK_IMAGELIST(16, 16, 16);
+    compare((int)SendMessage(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160017, "%x");
+    DestroyWindow(hToolbar);
 }
 
 




More information about the wine-cvs mailing list