SelectionMark

Aric Stewart aric at codeweavers.com
Wed Feb 11 13:07:39 CST 2004


Changelog: Work toward properly updating the SelectionMark when the 
selected state changed inside a listbox

lgpl
-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.380
diff -u -w -r1.380 listview.c
--- dlls/comctl32/listview.c	10 Dec 2003 00:37:14 -0000	1.380
+++ dlls/comctl32/listview.c	11 Feb 2004 19:09:28 -0000
@@ -7043,6 +7043,44 @@
     else
 	bResult = LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE);
 
+    /* 
+     *update selection mark 
+     *
+     * invistigation on windows 2k showed that selection mark was updated
+     * whenever a new selection was made, but if the selected item was
+     * unselected it was not updated.
+     *
+     * we are probibly still not 100% accurate, but this at leasts set the
+     * proper selection mark when it is needed
+     */
+
+    if (bResult && lvItem.stateMask & LVIS_SELECTED && 
+        lvItem.state&LVIS_SELECTED  && ((infoPtr->nSelectionMark
+         == -1) || (lvItem.iItem <= infoPtr->nSelectionMark)))
+    {
+        infoPtr->nSelectionMark = -1;
+        int i = 0;
+        for (i = 0; i < infoPtr->nItemCount; i++)
+        {
+            if (infoPtr->uCallbackMask & LVIS_SELECTED)
+            {
+	            if (LISTVIEW_GetItemState(infoPtr, i, LVIS_SELECTED))
+                {
+                    infoPtr->nSelectionMark = i;
+                    break;
+                }
+            }
+            else
+            {
+	            if (ranges_contain(infoPtr->selectionRanges, i))
+                {
+                    infoPtr->nSelectionMark = i;
+                    break;
+                }
+            }
+        }
+    }
+
     return bResult;
 }
 


More information about the wine-patches mailing list