Nikolay Sivov : comctl32/listview: Implement LVM_ISITEMVISIBLE.

Alexandre Julliard julliard at winehq.org
Mon Jun 22 09:04:15 CDT 2009


Module: wine
Branch: master
Commit: 76cb9c0d77d1652be1f306f5cc6d15a1cd78320e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=76cb9c0d77d1652be1f306f5cc6d15a1cd78320e

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Sat Jun 20 02:28:20 2009 +0400

comctl32/listview: Implement LVM_ISITEMVISIBLE.

---

 dlls/comctl32/listview.c |   41 +++++++++++++++++++++++++++++++++++++++++
 include/commctrl.h       |    1 +
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index f9608c6..53298be 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -6946,6 +6946,44 @@ fail:
 
 /***
  * DESCRIPTION:
+ * Checks item visibility.
+ *
+ * PARAMETER(S):
+ * [I] infoPtr : valid pointer to the listview structure
+ * [I] nFirst : item index to check for
+ *
+ * RETURN:
+ *   Item visible : TRUE
+ *   Item invisible or failure : FALSE
+ */
+static BOOL LISTVIEW_IsItemVisible(const LISTVIEW_INFO *infoPtr, INT nItem)
+{
+    POINT Origin, Position;
+    RECT rcItem;
+    HDC hdc;
+    BOOL ret;
+
+    TRACE("nItem=%d\n", nItem);
+
+    if (nItem < 0 || nItem >= DPA_GetPtrCount(infoPtr->hdpaItems)) return FALSE;
+
+    LISTVIEW_GetOrigin(infoPtr, &Origin);
+    LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
+    rcItem.left = Position.x + Origin.x;
+    rcItem.top  = Position.y + Origin.y;
+    rcItem.right  = rcItem.left + infoPtr->nItemWidth;
+    rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
+
+    hdc = GetDC(infoPtr->hwndSelf);
+    if (!hdc) return FALSE;
+    ret = RectVisible(hdc, &rcItem);
+    ReleaseDC(infoPtr->hwndSelf, hdc);
+
+    return ret;
+}
+
+/***
+ * DESCRIPTION:
  * Redraws a range of items.
  *
  * PARAMETER(S):
@@ -10340,6 +10378,9 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
   /* case LVM_ISGROUPVIEWENABLED: */
 
+  case LVM_ISITEMVISIBLE:
+    return LISTVIEW_IsItemVisible(infoPtr, (INT)wParam);
+
   /* case LVM_MAPIDTOINDEX: */
 
   /* case LVM_MAPINDEXTOID: */
diff --git a/include/commctrl.h b/include/commctrl.h
index b064c01..6eb5f32 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -3252,6 +3252,7 @@ static const WCHAR WC_LISTVIEWW[] = { 'S','y','s',
 #define LVM_CANCELEDITLABEL     (LVM_FIRST + 179)
 #define LVM_MAPINDEXTOID        (LVM_FIRST + 180)
 #define LVM_MAPIDTOINDEX        (LVM_FIRST + 181)
+#define LVM_ISITEMVISIBLE       (LVM_FIRST + 182)
 
 #define LVN_FIRST               (0U-100U)
 #define LVN_LAST                (0U-199U)




More information about the wine-cvs mailing list