Sergey Khodych : comctl32: toolbar: Use a cx field for buttons in TOOLBAR_WrapToolbar.
Alexandre Julliard
julliard at winehq.org
Thu Nov 6 08:26:09 CST 2008
Module: wine
Branch: master
Commit: 7f25cd993c5cdafd51cba449e7dc87f986122804
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7f25cd993c5cdafd51cba449e7dc87f986122804
Author: Sergey Khodych <khodych at gmail.com>
Date: Wed Nov 5 03:26:49 2008 +0200
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..8e30df0 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 */
More information about the wine-cvs
mailing list