mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-15 21:20:29 +00:00
comctl32/combo: Implement logic for setting and getting dropdown height.
Signed-off-by: Fabian Maurer <dark.shadow4@web.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3d0be0bad8
commit
313c63e194
|
@ -18,10 +18,6 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*
|
*
|
||||||
* TODO:
|
|
||||||
* - ComboBox_[GS]etMinVisible()
|
|
||||||
* - CB_GETMINVISIBLE, CB_SETMINVISIBLE
|
|
||||||
* - CB_SETTOPINDEX
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -459,6 +455,11 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
|
||||||
*/
|
*/
|
||||||
lphc->wState |= CBF_MEASUREITEM;
|
lphc->wState |= CBF_MEASUREITEM;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Per default the comctl32 version of combo shows up to 30 items
|
||||||
|
*/
|
||||||
|
lphc->visibleItems = 30;
|
||||||
|
|
||||||
/* M$ IE 3.01 actually creates (and rapidly destroys) an ownerless combobox */
|
/* M$ IE 3.01 actually creates (and rapidly destroys) an ownerless combobox */
|
||||||
|
|
||||||
if( lphc->owner || !(style & WS_VISIBLE) )
|
if( lphc->owner || !(style & WS_VISIBLE) )
|
||||||
|
@ -1010,22 +1011,17 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
||||||
|
|
||||||
if (nItems > 0)
|
if (nItems > 0)
|
||||||
{
|
{
|
||||||
int nHeight;
|
int nIHeight = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
|
||||||
int nIHeight;
|
|
||||||
|
|
||||||
nIHeight = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
|
if (lphc->dwStyle & CBS_NOINTEGRALHEIGHT)
|
||||||
|
|
||||||
nHeight = nIHeight*nItems;
|
|
||||||
|
|
||||||
if (nHeight < nDroppedHeight - COMBO_YBORDERSIZE())
|
|
||||||
nDroppedHeight = nHeight + COMBO_YBORDERSIZE();
|
|
||||||
|
|
||||||
if (nDroppedHeight < nHeight)
|
|
||||||
{
|
{
|
||||||
if (nItems < 5)
|
nDroppedHeight -= 1;
|
||||||
nDroppedHeight = (nItems+1)*nIHeight;
|
}
|
||||||
else if (nDroppedHeight < 6*nIHeight)
|
else
|
||||||
nDroppedHeight = 6*nIHeight;
|
{
|
||||||
|
if (nItems > lphc->visibleItems)
|
||||||
|
nItems = lphc->visibleItems;
|
||||||
|
nDroppedHeight = nItems * nIHeight + COMBO_YBORDERSIZE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2135,6 +2131,13 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam
|
||||||
return SendMessageW(lphc->hWndEdit, EM_LIMITTEXT, wParam, lParam);
|
return SendMessageW(lphc->hWndEdit, EM_LIMITTEXT, wParam, lParam);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
case CB_GETMINVISIBLE:
|
||||||
|
return lphc->visibleItems;
|
||||||
|
|
||||||
|
case CB_SETMINVISIBLE:
|
||||||
|
lphc->visibleItems = (INT)wParam;
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (message >= WM_USER)
|
if (message >= WM_USER)
|
||||||
WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", message - WM_USER, wParam, lParam );
|
WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", message - WM_USER, wParam, lParam );
|
||||||
|
|
|
@ -149,6 +149,7 @@ typedef struct
|
||||||
INT fixedOwnerDrawHeight;
|
INT fixedOwnerDrawHeight;
|
||||||
INT droppedWidth; /* last two are not used unless set */
|
INT droppedWidth; /* last two are not used unless set */
|
||||||
INT editHeight; /* explicitly */
|
INT editHeight; /* explicitly */
|
||||||
|
INT visibleItems;
|
||||||
} HEADCOMBO, *LPHEADCOMBO;
|
} HEADCOMBO, *LPHEADCOMBO;
|
||||||
|
|
||||||
extern BOOL COMBO_FlipListbox(HEADCOMBO *lphc, BOOL ok, BOOL bRedrawButton) DECLSPEC_HIDDEN;
|
extern BOOL COMBO_FlipListbox(HEADCOMBO *lphc, BOOL ok, BOOL bRedrawButton) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -1165,7 +1165,7 @@ static void test_combo_dropdown_size(DWORD style)
|
||||||
int limit;
|
int limit;
|
||||||
} info_height[] = {
|
} info_height[] = {
|
||||||
{33, 50, -1},
|
{33, 50, -1},
|
||||||
{35, 50, 40},
|
{35, 100, 40},
|
||||||
{15, 50, 3},
|
{15, 50, 3},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1182,7 +1182,6 @@ static void test_combo_dropdown_size(DWORD style)
|
||||||
info_test->height_combo, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
|
info_test->height_combo, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
|
||||||
|
|
||||||
min_visible_expected = SendMessageA(hCombo, CB_GETMINVISIBLE, 0, 0);
|
min_visible_expected = SendMessageA(hCombo, CB_GETMINVISIBLE, 0, 0);
|
||||||
todo_wine
|
|
||||||
ok(min_visible_expected == 30, "Unexpected number of items %d.\n", min_visible_expected);
|
ok(min_visible_expected == 30, "Unexpected number of items %d.\n", min_visible_expected);
|
||||||
|
|
||||||
cbInfo.cbSize = sizeof(COMBOBOXINFO);
|
cbInfo.cbSize = sizeof(COMBOBOXINFO);
|
||||||
|
@ -1202,10 +1201,8 @@ static void test_combo_dropdown_size(DWORD style)
|
||||||
min_visible_expected = info_test->limit;
|
min_visible_expected = info_test->limit;
|
||||||
|
|
||||||
ret = SendMessageA(hCombo, CB_SETMINVISIBLE, min_visible_expected, 0);
|
ret = SendMessageA(hCombo, CB_SETMINVISIBLE, min_visible_expected, 0);
|
||||||
todo_wine
|
|
||||||
ok(ret, "Failed to set visible limit.\n");
|
ok(ret, "Failed to set visible limit.\n");
|
||||||
min_visible_actual = SendMessageA(hCombo, CB_GETMINVISIBLE, 0, 0);
|
min_visible_actual = SendMessageA(hCombo, CB_GETMINVISIBLE, 0, 0);
|
||||||
todo_wine
|
|
||||||
ok(min_visible_expected == min_visible_actual, "test %d: unexpected number of items %d.\n",
|
ok(min_visible_expected == min_visible_actual, "test %d: unexpected number of items %d.\n",
|
||||||
test, min_visible_actual);
|
test, min_visible_actual);
|
||||||
}
|
}
|
||||||
|
@ -1242,7 +1239,6 @@ static void test_combo_dropdown_size(DWORD style)
|
||||||
if (expected_height_list < 0)
|
if (expected_height_list < 0)
|
||||||
expected_height_list = 0;
|
expected_height_list = 0;
|
||||||
|
|
||||||
todo_wine
|
|
||||||
ok(expected_height_list == height_list, "Test %d, expected list height to be %d, got %d\n",
|
ok(expected_height_list == height_list, "Test %d, expected list height to be %d, got %d\n",
|
||||||
test, expected_height_list, height_list);
|
test, expected_height_list, height_list);
|
||||||
}
|
}
|
||||||
|
@ -1250,7 +1246,6 @@ static void test_combo_dropdown_size(DWORD style)
|
||||||
{
|
{
|
||||||
expected_height_list = min(info_test->num_items, min_visible_expected) * height_item;
|
expected_height_list = min(info_test->num_items, min_visible_expected) * height_item;
|
||||||
|
|
||||||
todo_wine
|
|
||||||
ok(expected_height_list == height_list, "Test %d, expected list height to be %d, got %d\n",
|
ok(expected_height_list == height_list, "Test %d, expected list height to be %d, got %d\n",
|
||||||
test, expected_height_list, height_list);
|
test, expected_height_list, height_list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5220,6 +5220,11 @@ static const WCHAR WC_COMBOBOXW[] = { 'C','o','m','b','o','B','o','x',0 };
|
||||||
#define CB_SETCUEBANNER (CBM_FIRST + 3)
|
#define CB_SETCUEBANNER (CBM_FIRST + 3)
|
||||||
#define CB_GETCUEBANNER (CBM_FIRST + 4)
|
#define CB_GETCUEBANNER (CBM_FIRST + 4)
|
||||||
|
|
||||||
|
#define ComboBox_GetMinVisible(hwnd) \
|
||||||
|
((int)SendMessage((hwnd), CB_GETMINVISIBLE, 0, 0))
|
||||||
|
#define ComboBox_SetMinVisible(hwnd, count) \
|
||||||
|
((BOOL)SendMessage((hwnd), CB_SETMINVISIBLE, (WPARAM)(count), 0))
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Edit control
|
* Edit control
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue