Commit 2575c37b authored by Duane Clark's avatar Duane Clark Committed by Alexandre Julliard

comctl32: listview: Allow LVIF_STATE flag in subitems.

parent dbedc885
......@@ -3506,8 +3506,12 @@ static BOOL set_sub_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL i
if (lpLVItem->iSubItem >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
/* First do some sanity checks */
if (lpLVItem->mask & ~(LVIF_TEXT | LVIF_IMAGE)) return FALSE;
if (!(lpLVItem->mask & (LVIF_TEXT | LVIF_IMAGE))) return TRUE;
/* The LVIF_STATE flag is valid for subitems, but does not appear to be
particularly useful. We currently do not actually do anything with
the flag on subitems.
*/
if (lpLVItem->mask & ~(LVIF_TEXT | LVIF_IMAGE | LVIF_STATE)) return FALSE;
if (!(lpLVItem->mask & (LVIF_TEXT | LVIF_IMAGE | LVIF_STATE))) return TRUE;
/* get the subitem structure, and create it if not there */
hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem);
......
......@@ -313,6 +313,33 @@ static void test_items(void)
ok(r != 0, "ret %d\n", r);
ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
/**** Some tests of state highlighting ****/
memset (&item, 0xaa, sizeof (item));
item.mask = LVIF_STATE;
item.iItem = 0;
item.iSubItem = 0;
item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED | LVIS_DROPHILITED;
r = SendMessage(hwnd, LVM_SETITEM, 0, (LPARAM) &item);
ok(r != 0, "ret %d\n", r);
item.iSubItem = 1;
item.state = LVIS_DROPHILITED;
r = SendMessage(hwnd, LVM_SETITEM, 0, (LPARAM) &item);
ok(r != 0, "ret %d\n", r);
memset (&item, 0xaa, sizeof (item));
item.mask = LVIF_STATE;
item.iItem = 0;
item.iSubItem = 0;
item.stateMask = -1;
r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
ok(r != 0, "ret %d\n", r);
ok(item.state == LVIS_SELECTED, "got state %x, expected %x\n", item.state, LVIS_SELECTED);
item.iSubItem = 1;
r = SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM) &item);
ok(r != 0, "ret %d\n", r);
todo_wine ok(item.state == LVIS_DROPHILITED, "got state %x, expected %x\n", item.state, LVIS_DROPHILITED);
DestroyWindow(hwnd);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment