From 2b8b6ac284dca2bd22514d293519cb877a1079d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 29 Jul 2022 21:20:44 +0200 Subject: Add ListView::FindNextItem. This makes it much more ergonomic and less error-prone to look up list view items. --- c/listview.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'c/listview.cpp') diff --git a/c/listview.cpp b/c/listview.cpp index 62dfba8..b4a61b4 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -29,6 +29,14 @@ ListView::ListView(const HWND hWndParent, const HMENU hMenu, const DWORD dwStyle SendMessage(hWnd, WM_SETFONT, (WPARAM)g_hfNormal, MAKELPARAM(FALSE, 0)); } +/* Retrieve next matching list view item. */ +bool ListView::FindNextItem(LVITEM* const lvi, const LPARAM lParam) +{ + if ((lvi->iItem = ListView_GetNextItem(hWnd, lvi->iItem, lParam)) == -1) + return false; + return ListView_GetItem(hWnd, lvi); +} + /* Naively calculate height of list view. */ int ListView::Height(int bHeader) { -- cgit v1.2.3