comctl32/listview: Select all items with LVM_SETITEMSTATE is blocked in LVS_SINGLESEL.
This commit is contained in:
parent
472b521606
commit
4a5e23a2f9
|
@ -7687,6 +7687,10 @@ static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *infoPtr, INT nItem, const LVITE
|
||||||
|
|
||||||
if (nItem == -1)
|
if (nItem == -1)
|
||||||
{
|
{
|
||||||
|
/* select all isn't allowed in LVS_SINGLESEL */
|
||||||
|
if ((lvItem.state & lvItem.stateMask & LVIS_SELECTED) && (infoPtr->dwStyle & LVS_SINGLESEL))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* apply to all items */
|
/* apply to all items */
|
||||||
for (lvItem.iItem = 0; lvItem.iItem < infoPtr->nItemCount; lvItem.iItem++)
|
for (lvItem.iItem = 0; lvItem.iItem < infoPtr->nItemCount; lvItem.iItem++)
|
||||||
if (!LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE)) bResult = FALSE;
|
if (!LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE)) bResult = FALSE;
|
||||||
|
|
|
@ -1496,6 +1496,7 @@ static void test_multiselect(void)
|
||||||
BYTE kstate[256];
|
BYTE kstate[256];
|
||||||
select_task task;
|
select_task task;
|
||||||
LONG_PTR style;
|
LONG_PTR style;
|
||||||
|
LVITEMA item;
|
||||||
|
|
||||||
static struct t_select_task task_list[] = {
|
static struct t_select_task task_list[] = {
|
||||||
{ "using VK_DOWN", 0, VK_DOWN, -1, -1 },
|
{ "using VK_DOWN", 0, VK_DOWN, -1, -1 },
|
||||||
|
@ -1605,6 +1606,36 @@ todo_wine
|
||||||
todo_wine
|
todo_wine
|
||||||
expect(-1, r);
|
expect(-1, r);
|
||||||
|
|
||||||
|
/* try to select all on LVS_SINGLESEL */
|
||||||
|
memset(&item, 0, sizeof(item));
|
||||||
|
item.stateMask = LVIS_SELECTED;
|
||||||
|
r = SendMessage(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
|
||||||
|
expect(TRUE, r);
|
||||||
|
ListView_SetSelectionMark(hwnd, -1);
|
||||||
|
|
||||||
|
item.stateMask = LVIS_SELECTED;
|
||||||
|
item.state = LVIS_SELECTED;
|
||||||
|
r = SendMessage(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
|
||||||
|
expect(FALSE, r);
|
||||||
|
|
||||||
|
r = ListView_GetSelectedCount(hwnd);
|
||||||
|
expect(0, r);
|
||||||
|
r = ListView_GetSelectionMark(hwnd);
|
||||||
|
expect(-1, r);
|
||||||
|
|
||||||
|
/* try to deselect all on LVS_SINGLESEL */
|
||||||
|
item.stateMask = LVIS_SELECTED;
|
||||||
|
item.state = LVIS_SELECTED;
|
||||||
|
r = SendMessage(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item);
|
||||||
|
expect(TRUE, r);
|
||||||
|
|
||||||
|
item.stateMask = LVIS_SELECTED;
|
||||||
|
item.state = 0;
|
||||||
|
r = SendMessage(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
|
||||||
|
expect(TRUE, r);
|
||||||
|
r = ListView_GetSelectedCount(hwnd);
|
||||||
|
expect(0, r);
|
||||||
|
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue