comctl32: listview: Allow LVIF_STATE flag in subitems.

This commit is contained in:
Duane Clark 2007-01-06 15:55:45 -08:00 committed by Alexandre Julliard
parent dbedc885da
commit 2575c37b22
2 changed files with 33 additions and 2 deletions

View File

@ -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);

View File

@ -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);
}