From c16b65cdd99c13a1531ca41233c7587dba4cd49f Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 21 Jan 2022 19:08:24 +0300 Subject: [PATCH] comctl32/listview: Add partial implementation of LVM_GETNEXTITEMINDEX. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/comctl32/listview.c | 14 ++++++++++++++ dlls/comctl32/tests/listview.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 044e64bfa53..4176fb72c63 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -7452,6 +7452,17 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF return -1; } +static BOOL LISTVIEW_GetNextItemIndex(const LISTVIEW_INFO *infoPtr, LVITEMINDEX *index, UINT flags) +{ + /* FIXME: specified item group is ignored */ + + if (!index) + return FALSE; + + index->iItem = LISTVIEW_GetNextItem(infoPtr, index->iItem, flags); + return index->iItem != -1; +} + /* LISTVIEW_GetNumberOfWorkAreas */ /*** @@ -11426,6 +11437,9 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case LVM_GETNEXTITEM: return LISTVIEW_GetNextItem(infoPtr, (INT)wParam, LOWORD(lParam)); + case LVM_GETNEXTITEMINDEX: + return LISTVIEW_GetNextItemIndex(infoPtr, (LVITEMINDEX *)wParam, lParam); + case LVM_GETNUMBEROFWORKAREAS: FIXME("LVM_GETNUMBEROFWORKAREAS: unimplemented\n"); return 1; diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index e95b81f5bb1..5b40cea1fce 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -6624,6 +6624,37 @@ static void test_selected_column(void) } } +static void test_LVM_GETNEXTITEMINDEX(void) +{ + LVITEMINDEX index; + HWND hwnd; + BOOL ret; + + hwnd = create_listview_control(LVS_REPORT); + + insert_item(hwnd, 0); + insert_item(hwnd, 1); + + ret = SendMessageA(hwnd, LVM_GETNEXTITEMINDEX, 0, LVNI_ALL); + ok(!ret, "Unexpected return value %d.\n", ret); + + index.iItem = -1; + index.iGroup = 0; + ret = SendMessageA(hwnd, LVM_GETNEXTITEMINDEX, (WPARAM)&index, LVNI_ALL); + ok(ret, "Unexpected return value %d.\n", ret); + ok(index.iItem == 0, "Unexpected item index %d.\n", index.iItem); + + ret = SendMessageA(hwnd, LVM_GETNEXTITEMINDEX, (WPARAM)&index, LVNI_ALL); + ok(ret, "Unexpected return value %d.\n", ret); + ok(index.iItem == 1, "Unexpected item index %d.\n", index.iItem); + + ret = SendMessageA(hwnd, LVM_GETNEXTITEMINDEX, (WPARAM)&index, LVNI_ALL); + ok(!ret, "Unexpected return value %d.\n", ret); + ok(index.iItem == -1, "Unexpected item index %d.\n", index.iItem); + + DestroyWindow(hwnd); +} + START_TEST(listview) { ULONG_PTR ctx_cookie; @@ -6730,6 +6761,7 @@ START_TEST(listview) test_LVM_GETCOUNTPERPAGE(); test_item_state_change(); test_selected_column(); + test_LVM_GETNEXTITEMINDEX(); unload_v6_module(ctx_cookie, hCtx); -- 2.11.4.GIT