comctl32: toolbar: Use a cx field for buttons in TOOLBAR_WrapToolbar.

This commit is contained in:
Sergey Khodych 2008-11-05 03:26:49 +02:00 committed by Alexandre Julliard
parent 65e9a6e02e
commit 7f25cd993c
2 changed files with 17 additions and 1 deletions

View File

@ -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);
}

View File

@ -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 */