[2/2] comctl32/listview: Implement callback functionality for item indentation

Nikolay Sivov bunglehead at gmail.com
Tue Jun 9 18:25:08 CDT 2009


Changelog:
    - Implement callback functionality for item indentation

>From 03b393562bf2b8084e6ae3ec194e23df2532372e Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 10 Jun 2009 03:23:17 +0400
Subject: Implement callback functionality for item indentation

---
 dlls/comctl32/listview.c       |   21 +++++++++++++++++++--
 dlls/comctl32/tests/listview.c |    2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index df07384..55519dd 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -6,6 +6,7 @@
  * Copyright 2000 Jason Mawdsley
  * Copyright 2001 CodeWeavers Inc.
  * Copyright 2002 Dimitrie O. Paun
+ * Copyright 2009 Nikolay Sivov
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -5746,6 +5747,14 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem,
         dispInfo.item.iImage = I_IMAGECALLBACK;
     }
 
+    /* Only items support indentation */
+    if ((lpLVItem->mask & LVIF_INDENT) && lpItem->iIndent == I_INDENTCALLBACK &&
+        (isubitem == 0))
+    {
+        dispInfo.item.mask |= LVIF_INDENT;
+        dispInfo.item.iIndent = I_INDENTCALLBACK;
+    }
+
     /* Apps depend on calling back for text if it is NULL or LPSTR_TEXTCALLBACKW */
     if ((lpLVItem->mask & LVIF_TEXT) && !(lpLVItem->mask & LVIF_NORECOMPUTE) &&
         !is_textW(pItemHdr->pszText))
@@ -5837,8 +5846,16 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem,
     }
 
     /* and last, but not least, the indent field */
-    if (lpLVItem->mask & LVIF_INDENT)
-	lpLVItem->iIndent = lpItem->iIndent;
+    if (dispInfo.item.mask & LVIF_INDENT)
+    {
+	lpLVItem->iIndent = dispInfo.item.iIndent;
+	if ((dispInfo.item.mask & LVIF_DI_SETITEM) && lpItem->iIndent == I_INDENTCALLBACK)
+	    lpItem->iIndent = dispInfo.item.iIndent;
+    }
+    else if (lpLVItem->mask & LVIF_INDENT)
+    {
+        lpLVItem->iIndent = lpItem->iIndent;
+    }
 
     return TRUE;
 }
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index e7cbe03..2dce945 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -3304,7 +3304,7 @@ static void test_indentation(void)
     expect(TRUE, r);
 
     ok_sequence(sequences, PARENT_SEQ_INDEX, single_getdispinfo_parent_seq,
-                "get indent dispinfo", TRUE);
+                "get indent dispinfo", FALSE);
 
     DestroyWindow(hwnd);
 }
-- 
1.5.6.5





More information about the wine-patches mailing list