Listview R7

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

 




ChangeLog
   Notification code cleanup, more traces, etc.

--- dlls/comctl32/listview.c.R6	Wed Oct 16 15:03:13 2002
+++ dlls/comctl32/listview.c	Wed Oct 16 15:34:56 2002
@@ -533,16 +533,24 @@
 
 /******** Notification functions i************************************/
 
-static inline BOOL notify_hdr(LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh)
+static LRESULT notify_hdr(LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh)
 {
+    LRESULT result;
+    
+    TRACE("(code=%d)\n", code);
+
     pnmh->hwndFrom = infoPtr->hwndSelf;
     pnmh->idFrom = GetWindowLongW(infoPtr->hwndSelf, GWL_ID);
     pnmh->code = code;
-    return (BOOL)SendMessageW(GetParent(infoPtr->hwndSelf), WM_NOTIFY,
-			      (WPARAM)pnmh->idFrom, (LPARAM)pnmh);
+    result = SendMessageW(GetParent(infoPtr->hwndSelf), WM_NOTIFY,
+			  (WPARAM)pnmh->idFrom, (LPARAM)pnmh);
+
+    TRACE("  <= %ld\n", result);
+
+    return result;
 }
 
-static inline BOOL notify(LISTVIEW_INFO *infoPtr, INT code)
+static inline LRESULT notify(LISTVIEW_INFO *infoPtr, INT code)
 {
     NMHDR nmh;
     return notify_hdr(infoPtr, code, &nmh);
@@ -553,12 +561,12 @@
     notify(infoPtr, LVN_ITEMACTIVATE);
 }
 
-static inline BOOL notify_listview(LISTVIEW_INFO *infoPtr, INT code, LPNMLISTVIEW plvnm)
+static inline LRESULT notify_listview(LISTVIEW_INFO *infoPtr, INT code, LPNMLISTVIEW plvnm)
 {
     return notify_hdr(infoPtr, code, (LPNMHDR)plvnm);
 }
 
-static BOOL notify_click(LISTVIEW_INFO *infoPtr,  INT code, LVHITTESTINFO *lvht)
+static LRESULT notify_click(LISTVIEW_INFO *infoPtr,  INT code, LVHITTESTINFO *lvht)
 {
     NMLISTVIEW nmlv;
     
@@ -656,45 +664,13 @@
     return bResult;
 }
 
-static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, LISTVIEW_INFO *infoPtr, HDC hdc, LPRECT rcBounds, LVITEMW *lpLVItem)
+static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, LISTVIEW_INFO *infoPtr, HDC hdc, LPRECT rcBounds)
 {
-    BOOL isSelected;
-    
     ZeroMemory(lpnmlvcd, sizeof(NMLVCUSTOMDRAW));
     lpnmlvcd->nmcd.hdc = hdc;
     lpnmlvcd->nmcd.rc = *rcBounds;
-    if (lpLVItem)
-    {
-	lpnmlvcd->nmcd.dwItemSpec = lpLVItem->iItem;
-	lpnmlvcd->iSubItem = lpLVItem->iSubItem;
-        if (lpLVItem->state & LVIS_SELECTED) lpnmlvcd->nmcd.uItemState |= CDIS_SELECTED;
-	if (lpLVItem->state & LVIS_FOCUSED) lpnmlvcd->nmcd.uItemState |= CDIS_FOCUS;
-	if (lpLVItem->iItem == infoPtr->nHotItem) lpnmlvcd->nmcd.uItemState |= CDIS_HOT;
-	lpnmlvcd->nmcd.lItemlParam = lpLVItem->lParam;
-    }
-
-    isSelected = lpnmlvcd->nmcd.uItemState & CDIS_SELECTED;
-    /* subitems are selected only in full-row-select, report mode */
-    if ( lpnmlvcd->iSubItem != 0 && 
-	 !((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_REPORT && 
-	   (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)) )
-	isSelected = FALSE;
-
-    if (isSelected && infoPtr->bFocus)
-    {
-	lpnmlvcd->clrTextBk = comctl32_color.clrHighlight;
-	lpnmlvcd->clrText   = comctl32_color.clrHighlightText;
-    }
-    else if (isSelected && (infoPtr->dwStyle & LVS_SHOWSELALWAYS))
-    {
-	lpnmlvcd->clrTextBk = comctl32_color.clr3dFace;
-	lpnmlvcd->clrText   = comctl32_color.clrBtnText;
-    }
-    else
-    {
-	lpnmlvcd->clrTextBk = infoPtr->clrTextBk;
-	lpnmlvcd->clrText   = infoPtr->clrText;
-    }
+    lpnmlvcd->clrTextBk = infoPtr->clrTextBk;
+    lpnmlvcd->clrText   = infoPtr->clrText;
 }
 
 static inline DWORD notify_customdraw (LISTVIEW_INFO *infoPtr, DWORD dwDrawStage, NMLVCUSTOMDRAW *lpnmlvcd)
@@ -3201,7 +3177,30 @@
     TRACE("    rcBox=%s, rcState=%s, rcIcon=%s. rcLabel=%s\n", 
 	debugrect(&rcBox), debugrect(&rcState), debugrect(&rcIcon), debugrect(&rcLabel));
 
-    customdraw_fill(&nmlvcd, infoPtr, hdc, &rcBox, &lvItem);
+    /* fill in the custom draw structure */
+    customdraw_fill(&nmlvcd, infoPtr, hdc, &rcBox);
+    nmlvcd.nmcd.dwItemSpec = lvItem.iItem;
+    nmlvcd.iSubItem = lvItem.iSubItem;
+    if (lvItem.state & LVIS_SELECTED) nmlvcd.nmcd.uItemState |= CDIS_SELECTED;
+    if (lvItem.state & LVIS_FOCUSED) nmlvcd.nmcd.uItemState |= CDIS_FOCUS;
+    if (lvItem.iItem == infoPtr->nHotItem) nmlvcd.nmcd.uItemState |= CDIS_HOT;
+    nmlvcd.nmcd.lItemlParam = lvItem.lParam;
+    if ((lvItem.state & LVIS_SELECTED) && 
+	(lvItem.iSubItem == 0 || 
+	 (uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))))
+    {
+	if (infoPtr->bFocus)
+	{
+	    nmlvcd.clrTextBk = comctl32_color.clrHighlight;
+	    nmlvcd.clrText   = comctl32_color.clrHighlightText;
+        }
+	else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
+	{
+	    nmlvcd.clrTextBk = comctl32_color.clr3dFace;
+	    nmlvcd.clrText   = comctl32_color.clrBtnText;
+	}
+    }
+    
     if (cdmode & CDRF_NOTIFYITEMDRAW)
         cditemmode = notify_customdraw (infoPtr, CDDS_ITEMPREPAINT, &nmlvcd);
     if (cditemmode & CDRF_SKIPDEFAULT) goto postpaint;
@@ -3492,7 +3491,7 @@
     oldClrText   = infoPtr->clrText;
    
     GetClientRect(infoPtr->hwndSelf, &rcClient);
-    customdraw_fill(&nmlvcd, infoPtr, hdc, &rcClient, NULL);
+    customdraw_fill(&nmlvcd, infoPtr, hdc, &rcClient);
     cdmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd);
     if (cdmode & CDRF_SKIPDEFAULT) goto enddraw;
 
@@ -3870,26 +3869,21 @@
 {
   LONG lStyle = infoPtr->dwStyle;
   UINT uView = lStyle & LVS_TYPEMASK;
-  LONG lCtrlId = GetWindowLongW(infoPtr->hwndSelf, GWL_ID);
   NMLISTVIEW nmlv;
   BOOL bResult = FALSE;
   HDPA hdpaSubItems;
   LISTVIEW_ITEM *lpItem;
   LISTVIEW_SUBITEM *lpSubItem;
-  INT i;
   LVITEMW item;
+  INT i;
 
   TRACE("(nItem=%d)\n", nItem);
 
 
   /* First, send LVN_DELETEITEM notification. */
-  memset(&nmlv, 0, sizeof (NMLISTVIEW));
-  nmlv.hdr.hwndFrom = infoPtr->hwndSelf;
-  nmlv.hdr.idFrom = lCtrlId;
-  nmlv.hdr.code = LVN_DELETEITEM;
+  ZeroMemory(&nmlv, sizeof (NMLISTVIEW));
   nmlv.iItem = nItem;
-  SendMessageW((infoPtr->hwndSelf), WM_NOTIFY, (WPARAM)lCtrlId,
-               (LPARAM)&nmlv);
+  notify_listview(infoPtr, LVN_DELETEITEM, &nmlv);
 
   if (nItem == infoPtr->nFocusedItem)
   {



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

  Powered by Linux