Fixes to the handling of LBS_EXTENDEDSEL style, with tests.

This commit is contained in:
Lauri Tulmin 2005-01-10 16:22:33 +00:00 committed by Alexandre Julliard
parent 635221222f
commit d3cc4dcd05
2 changed files with 36 additions and 3 deletions

View File

@ -2010,11 +2010,16 @@ static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr, DWORD keys, INT x, IN
{
LISTBOX_MoveCaret( descr, index, FALSE );
if (descr->style & LBS_MULTIPLESEL)
if (descr->style & LBS_EXTENDEDSEL)
{
LISTBOX_SetSelection( descr, index,
(!(descr->style & LBS_MULTIPLESEL) ||
!descr->items[index].selected),
descr->items[index].selected,
(descr->style & LBS_NOTIFY) != 0 );
}
else
{
LISTBOX_SetSelection( descr, index,
!descr->items[index].selected,
(descr->style & LBS_NOTIFY) != 0 );
}
}

View File

@ -181,6 +181,26 @@ START_TEST(listbox)
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, LB_ERR}, {0,0,0,0},
{ 2, 2, 2, LB_ERR}, {0,0,0,0}};
const struct listbox_test ES =
{{LBS_EXTENDEDSEL},
{ 0, LB_ERR, 0, 0}, {0,0,0,0},
{ 1, 1, 1, 1}, {0,0,0,0},
{ 2, 2, 2, 1}, {0,0,0,0}};
const struct listbox_test ES_NS =
{{LBS_EXTENDEDSEL | LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, LB_ERR}, {0,0,0,0},
{ 2, 2, 2, LB_ERR}, {0,0,0,0}};
const struct listbox_test EMS =
{{LBS_EXTENDEDSEL | LBS_MULTIPLESEL},
{ 0, LB_ERR, 0, 0}, {0,0,0,0},
{ 1, 1, 1, 1}, {0,0,0,0},
{ 2, 2, 2, 1}, {0,0,0,0}};
const struct listbox_test EMS_NS =
{{LBS_EXTENDEDSEL | LBS_MULTIPLESEL | LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, LB_ERR}, {0,0,0,0},
{ 2, 2, 2, LB_ERR}, {0,0,0,0}};
trace (" Testing single selection...\n");
check (SS);
@ -190,6 +210,14 @@ START_TEST(listbox)
check (MS);
trace (" ... with NOSEL\n");
check (MS_NS);
trace (" Testing extended selection...\n");
check (ES);
trace (" ... with NOSEL\n");
check (ES_NS);
trace (" Testing extended and multiple selection...\n");
check (EMS);
trace (" ... with NOSEL\n");
check (EMS_NS);
check_item_height();
}