listview notifications

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Nov 3 10:43:50 CST 2003


        Huw Davies <huw at codeweavers.com>
        Make the listview send its notifications to the parent window passed
        to it in CREATESTRUCT.  Based on a treeview patch by Igor Grahek.
-- 
Huw Davies
huw at codeweavers.com

Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.369
diff -u -r1.369 listview.c
--- dlls/comctl32/listview.c	7 Oct 2003 03:30:47 -0000	1.369
+++ dlls/comctl32/listview.c	3 Nov 2003 16:42:40 -0000
@@ -238,6 +238,7 @@
   INT nSelectionMark;
   INT nHotItem;
   SHORT notifyFormat;
+  HWND hwndNotify;
   RECT rcList;                 /* This rectangle is really the window
 				* client rectangle possibly reduced by the 
 				* horizontal scroll bar and/or header - see 
@@ -721,7 +722,7 @@
     pnmh->hwndFrom = infoPtr->hwndSelf;
     pnmh->idFrom = GetWindowLongW(infoPtr->hwndSelf, GWL_ID);
     pnmh->code = code;
-    result = SendMessageW(GetParent(infoPtr->hwndSelf), WM_NOTIFY,
+    result = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
 			  (WPARAM)pnmh->idFrom, (LPARAM)pnmh);
 
     TRACE("  <= %ld\n", result);
@@ -1738,7 +1739,7 @@
 	LISTVIEW_GetItemBox(infoPtr, dis.itemID, &dis.rcItem);
 	dis.itemData = item.lParam;
 
-	SendMessageW(GetParent(infoPtr->hwndSelf), WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
+	SendMessageW(infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
     }
     else
     {
@@ -3680,7 +3681,6 @@
 static void LISTVIEW_RefreshOwnerDraw(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
 {
     UINT uID = GetWindowLongW(infoPtr->hwndSelf, GWL_ID);
-    HWND hwndParent = GetParent(infoPtr->hwndSelf);
     DWORD cditemmode = CDRF_DODEFAULT;
     NMLVCUSTOMDRAW nmlvcd;
     POINT Origin, Position;
@@ -3730,7 +3730,7 @@
 	if (!(cditemmode & CDRF_SKIPDEFAULT))
 	{
             prepaint_setup (infoPtr, hdc, &nmlvcd);
-	    SendMessageW(hwndParent, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
+	    SendMessageW(infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
 	}
 
     	if (cditemmode & CDRF_NOTIFYPOSTPAINT)
@@ -7179,7 +7179,8 @@
   infoPtr->hwndSelf = hwnd;
   infoPtr->dwStyle = lpcs->style;
   /* determine the type of structures to use */
-  infoPtr->notifyFormat = SendMessageW(GetParent(infoPtr->hwndSelf), WM_NOTIFYFORMAT,
+  infoPtr->hwndNotify = lpcs->hwndParent;
+  infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT,
                                        (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
 
   /* initialize color information  */
@@ -9064,7 +9065,7 @@
 	}
 
 	default:
-	  return SendMessageW (GetParent (infoPtr->hwndSelf), WM_COMMAND, wParam, lParam);
+	  return SendMessageW (infoPtr->hwndNotify, WM_COMMAND, wParam, lParam);
     }
 
     return 0;



More information about the wine-patches mailing list