user32: Fix support for CB_SETDROPPEDWIDTH in combobox.

This commit is contained in:
Bruno Jesus 2011-09-01 02:30:50 -03:00 committed by Alexandre Julliard
parent d9ada7929a
commit 7c76a79ffa
2 changed files with 30 additions and 10 deletions

View File

@ -2112,14 +2112,24 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);
case CB_SETLOCALE:
return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
case CB_SETDROPPEDWIDTH:
if( (CB_GETTYPE(lphc) == CBS_SIMPLE) ||
(INT)wParam >= 32768 )
return CB_ERR;
/* new value must be higher than combobox width */
if((INT)wParam >= lphc->droppedRect.right - lphc->droppedRect.left)
lphc->droppedWidth = wParam;
else if(wParam)
lphc->droppedWidth = 0;
/* recalculate the combobox area */
CBCalcPlacement(hwnd, lphc, &lphc->textRect, &lphc->buttonRect, &lphc->droppedRect );
/* fall through */
case CB_GETDROPPEDWIDTH:
if( lphc->droppedWidth )
return lphc->droppedWidth;
return lphc->droppedRect.right - lphc->droppedRect.left;
case CB_SETDROPPEDWIDTH:
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) &&
(INT)wParam < 32768 ) lphc->droppedWidth = (INT)wParam;
return CB_ERR;
case CB_GETDROPPEDCONTROLRECT:
if( lParam ) CBGetDroppedControlRect(lphc, (LPRECT)lParam );
return CB_OKAY;

View File

@ -406,25 +406,35 @@ static void test_changesize( DWORD style)
}
ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, -1, 0);
todo_wine ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
todo_wine ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 0, 0);
todo_wine ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, clwidth - 1, 0);
todo_wine ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
todo_wine ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, clwidth << 1, 0);
todo_wine ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 0, 0);
ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
ok( ddwidth == (clwidth << 1), "drop-width is %d vs %d\n", ddwidth, clwidth << 1);
ddwidth = SendMessageA(hCombo, CB_SETDROPPEDWIDTH, 1, 0);
ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
ddwidth = SendMessageA(hCombo, CB_GETDROPPEDWIDTH, 0, 0);
ok( ddwidth == clwidth + 2, "drop-width is %d vs %d\n", ddwidth, clwidth + 2);
DestroyWindow(hCombo);
}