Module: wine Branch: master Commit: 850ea2a7114e3e858af816399126e87b4098f2da URL: http://source.winehq.org/git/wine.git/?a=commit;h=850ea2a7114e3e858af8163991...
Author: Nikolay Sivov bunglehead@gmail.com Date: Sun Nov 22 10:59:45 2009 +0300
comctl32/listview: Add support for LVFI_SUBSTRING.
---
dlls/comctl32/listview.c | 8 +++++--- dlls/comctl32/tests/listview.c | 29 +++++++++++++++++++++++++++++ include/commctrl.h | 11 ++++++----- 3 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 448590a..5b45ffb 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -5888,7 +5888,8 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart, if (!lpFindInfo || nItem < 0) return -1;
lvItem.mask = 0; - if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL)) + if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL) || + lpFindInfo->flags & LVFI_SUBSTRING) { lvItem.mask |= LVIF_TEXT; lvItem.pszText = szDispText; @@ -5952,7 +5953,7 @@ again:
if (lvItem.mask & LVIF_TEXT) { - if (lpFindInfo->flags & LVFI_PARTIAL) + if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING)) { WCHAR *p = strstrW(lvItem.pszText, lpFindInfo->psz); if (!p || p != lvItem.pszText) continue; @@ -6009,7 +6010,8 @@ again: static INT LISTVIEW_FindItemA(const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOA *lpFindInfo) { - BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL); + BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL) || + lpFindInfo->flags & LVFI_SUBSTRING; LVFINDINFOW fiw; INT res; LPWSTR strW = NULL; diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 55e7d96..95d9ddc 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -4128,6 +4128,35 @@ static void test_finditem(void) r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); expect(-1, r);
+ /* try with LVFI_SUBSTRING */ + strcpy(f, "fo"); + fi.flags = LVFI_SUBSTRING; + fi.psz = f; + r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + if (r == -1) + { + win_skip("LVFI_SUBSTRING not supported\n"); + DestroyWindow(hwnd); + return; + } + expect(0, r); + strcpy(f, "f"); + fi.flags = LVFI_SUBSTRING; + fi.psz = f; + r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(0, r); + strcpy(f, "o"); + fi.flags = LVFI_SUBSTRING; + fi.psz = f; + r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(-1, r); + + strcpy(f, "f"); + fi.flags = LVFI_SUBSTRING | LVFI_STRING; + fi.psz = f; + r = SendMessage(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(0, r); + DestroyWindow(hwnd); }
diff --git a/include/commctrl.h b/include/commctrl.h index 4360925..b88d694 100644 --- a/include/commctrl.h +++ b/include/commctrl.h @@ -3023,11 +3023,12 @@ static const WCHAR WC_LISTVIEWW[] = { 'S','y','s', #define LVSICF_NOSCROLL 0x0002
-#define LVFI_PARAM 0X0001 -#define LVFI_STRING 0X0002 -#define LVFI_PARTIAL 0X0008 -#define LVFI_WRAP 0X0020 -#define LVFI_NEARESTXY 0X0040 +#define LVFI_PARAM 0x0001 +#define LVFI_STRING 0x0002 +#define LVFI_SUBSTRING 0x0004 +#define LVFI_PARTIAL 0x0008 +#define LVFI_WRAP 0x0020 +#define LVFI_NEARESTXY 0x0040
#define LVIF_TEXT 0x0001 #define LVIF_IMAGE 0x0002