listbox: ownerdraw fix

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Nov 17 06:33:17 CST 2003


        Aric Stewart <aric at codeweavers.com>
	invalidate items on setselection for ownerdraw items        
-- 
Huw Davies
huw at codeweavers.com
Index: controls/listbox.c
===================================================================
RCS file: /home/wine/wine/controls/listbox.c,v
retrieving revision 1.97
diff -u -r1.97 listbox.c
--- controls/listbox.c	14 Oct 2003 05:24:21 -0000	1.97
+++ controls/listbox.c	17 Nov 2003 12:31:30 -0000
@@ -1143,6 +1143,13 @@
     }
 }
 
+static void LISTBOX_InvalidateItemRect( HWND hwnd, LB_DESCR *descr, INT index )
+{
+    RECT rect;
+
+    if (LISTBOX_GetItemRect( descr, index, &rect ) == 1)
+        InvalidateRect( hwnd, &rect, TRUE );
+}
 
 /***********************************************************************
  *           LISTBOX_GetItemHeight
@@ -1361,7 +1368,11 @@
         {
             if (descr->items[i].selected) continue;
             descr->items[i].selected = TRUE;
-            LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT );
+            if (!IS_OWNERDRAW(descr))
+                LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT );
+            else
+                LISTBOX_InvalidateItemRect(hwnd, descr, i);
+                
         }
         LISTBOX_SetCaretIndex( hwnd, descr, last, TRUE );
     }
@@ -1371,7 +1382,10 @@
         {
             if (!descr->items[i].selected) continue;
             descr->items[i].selected = FALSE;
-            LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT );
+            if (!IS_OWNERDRAW(descr))
+                LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT );
+            else
+                LISTBOX_InvalidateItemRect(hwnd, descr, i);
         }
     }
     return LB_OKAY;



More information about the wine-patches mailing list