Listview X4

Dimitrie O. Paun dpaun at rogers.com
Thu Oct 24 00:53:29 CDT 2002


This should fix Newsbin Pro from:
  -- crashing
  -- having drawing problems with the green lines :)

ChangeLog
  Fix crash when computing the item width of a report with no columns
  Override custom draw bkgnd color for selection items
  Fill background for all items that have a bkgnd colour.

--- dlls/comctl32/listview.c.X3	Thu Oct 24 01:25:49 2002
+++ dlls/comctl32/listview.c	Thu Oct 24 01:42:50 2002
@@ -2200,8 +2200,12 @@
     {
 	RECT rcHeader;
 
-	LISTVIEW_GetHeaderRect(infoPtr, infoPtr->hdpaColumns->nItemCount - 1, &rcHeader);
-        nItemWidth = rcHeader.right;	
+	if (infoPtr->hdpaColumns->nItemCount > 0)
+	{
+	    LISTVIEW_GetHeaderRect(infoPtr, infoPtr->hdpaColumns->nItemCount - 1, &rcHeader);
+            nItemWidth = rcHeader.right;
+	}
+	else nItemWidth = 0;
     }
     else /* LVS_SMALLICON, or LVS_LIST */
     {
@@ -3419,6 +3423,11 @@
     if (lvItem.iItem == infoPtr->nHotItem) nmlvcd.nmcd.uItemState |= CDIS_HOT;
     nmlvcd.nmcd.lItemlParam = lvItem.lParam;
 
+    if (cdmode & CDRF_NOTIFYITEMDRAW)
+        cditemmode = notify_customdraw (infoPtr, CDDS_ITEMPREPAINT, &nmlvcd);
+    if (cditemmode & CDRF_SKIPDEFAULT) goto postpaint;
+
+    /* apprently, for selected items, we have to override the returned values */
     if (lvItem.state & LVIS_SELECTED)
     {
 	if (infoPtr->bFocus)
@@ -3433,10 +3442,6 @@
 	}
     }
     
-    if (cdmode & CDRF_NOTIFYITEMDRAW)
-        cditemmode = notify_customdraw (infoPtr, CDDS_ITEMPREPAINT, &nmlvcd);
-    if (cditemmode & CDRF_SKIPDEFAULT) goto postpaint;
-
     /* state icons */
     if (infoPtr->himlState && !IsRectEmpty(&rcState))
     {
@@ -3477,7 +3482,7 @@
     	if (uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
 	    rcSelect.right = rcBox.right;
    
-    	if (lvItem.state & LVIS_SELECTED) 
+    	if (nmlvcd.clrTextBk != CLR_NONE) 
             ExtTextOutW(hdc, rcSelect.left, rcSelect.top, ETO_OPAQUE, &rcSelect, 0, 0, 0);
     	if(lprcFocus) *lprcFocus = rcSelect;
     }



-- 
Dimi.




More information about the wine-patches mailing list