From b608c8d52763843bf42ca3aafb298f98e759574b Mon Sep 17 00:00:00 2001 From: Sergey Khodych Date: Wed, 5 Nov 2008 03:26:49 +0200 Subject: comctl32: toolbar: Use a cx field for buttons in TOOLBAR_WrapToolbar. --- dlls/comctl32/tests/toolbar.c | 16 ++++++++++++++++ dlls/comctl32/toolbar.c | 2 +- 2 files changed, 17 insertions(+), 1 deletions(-) diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index aebf8e5..a0c061c 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -727,6 +727,9 @@ static tbsize_result_t tbsize_results[] = { {0, 0, 672, 42}, {67, 40}, 1, { { 0, 2, 67, 40}, }, }, + { {0, 0, 672, 42}, {67, 41}, 2, { + { 0, 2, 672, 41}, { 0, 41, 672, 80}, + }, }, }; static int tbsize_numtests = 0; @@ -775,6 +778,7 @@ static void test_sizes(void) { HWND hToolbar = NULL; HIMAGELIST himl; + TBBUTTONINFO tbinfo; int style; int i; @@ -980,6 +984,18 @@ static void test_sizes(void) SendMessageA(hToolbar, TB_AUTOSIZE, (WPARAM)0, (LPARAM)0 ); check_sizes(); + rebuild_toolbar(&hToolbar); + SetWindowLong(hToolbar, GWL_STYLE, TBSTYLE_WRAPABLE | GetWindowLong(hToolbar, GWL_STYLE)); + ok(SendMessageA(hToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&buttons3[3]) == 1, "TB_ADDBUTTONS failed\n"); + ok(SendMessageA(hToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&buttons3[3]) == 1, "TB_ADDBUTTONS failed\n"); + tbinfo.cx = 672; + tbinfo.cbSize = sizeof(TBBUTTONINFO); + tbinfo.dwMask = TBIF_SIZE | TBIF_BYINDEX; + ok(SendMessageA(hToolbar, TB_SETBUTTONINFO, (WPARAM)0, (LPARAM)&tbinfo) != 0, "TB_SETBUTTONINFO failed\n"); + ok(SendMessageA(hToolbar, TB_SETBUTTONINFO, (WPARAM)1, (LPARAM)&tbinfo) != 0, "TB_SETBUTTONINFO failed\n"); + SendMessageA(hToolbar, TB_AUTOSIZE, (WPARAM)0, (LPARAM)0); + check_sizes(); + DestroyWindow(hToolbar); } diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 317b21c..3a82baa 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -1329,7 +1329,7 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle ) cx = (btnPtr[i].iBitmap > 0) ? btnPtr[i].iBitmap : SEPARATOR_WIDTH; else - cx = infoPtr->nButtonWidth; + cx = (btnPtr[i].cx) ? btnPtr[i].cx : infoPtr->nButtonWidth; /* Two or more adjacent separators form a separator group. */ /* The first separator in a group should be wrapped to the */ -- 1.5.3.3