LISTVIEW_SetItemCount without LVS_OWNERDATA take 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As Dimi pointed out, we should have infoPtr->nItemCount correct at the end of every iteration through the loop.

Changelog:
Implement LISTVIEW_SetItemCount without LVS_OWNERDATA

Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.338
diff -u -r1.338 listview.c
--- dlls/comctl32/listview.c	24 Jan 2003 00:54:59 -0000	1.338
+++ dlls/comctl32/listview.c	2 Feb 2003 23:04:34 -0000
@@ -6657,13 +6657,25 @@
     }
     else
     {
-	/* According to MSDN for non-LVS_OWNERDATA this is just
-	 * a performance issue. The control allocates its internal
-	 * data structures for the number of items specified. It
-	 * cuts down on the number of memory allocations. Therefore
-	 * we will just issue a WARN here
-	 */
-	WARN("for non-ownerdata performance option not implemented.\n");
+        HDPA hdpaSubItems;
+        ITEM_INFO *lpItem;
+        int i;
+        
+        infoPtr->nItemCount = 0;
+        for (i=0; i<nItems; i++)
+        {
+            if ( !(lpItem = (ITEM_INFO *)COMCTL32_Alloc(sizeof(ITEM_INFO))) )
+	        return 0;
+            
+            /* insert item in listview control data structure */
+            if ( (hdpaSubItems = DPA_Create(8)) )
+            {
+                if ( !DPA_SetPtr(hdpaSubItems, 0, lpItem) ) assert (FALSE);
+            
+                DPA_InsertPtr( infoPtr->hdpaItems, i, hdpaSubItems );
+            }
+            infoPtr->nItemCount++;
+        }
     }
 
     return TRUE;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux