Misc Listview fixes

Duane Clark dclark at akamail.com
Mon Mar 18 21:20:45 CST 2002


This patch includes the changes in my previous Listview patch 
(listview-05.diff), which had not made it into CVS yet due to wineconf 
(I assume, since the changes should be pretty non-controversial).

Log message:
	Add LVS_NOSORTHEADER support.
	Sort column on HDN_ITEMCLICKA too.
	Do not edit labels if icon was clicked.
	Fix the incorrect icon width in my earlier patch.

-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.124
diff -u -r1.124 listview.c
--- dlls/comctl32/listview.c	11 Mar 2002 05:02:11 -0000	1.124
+++ dlls/comctl32/listview.c	19 Mar 2002 03:11:07 -0000
@@ -944,9 +944,6 @@
   if ((LVS_TYPESTYLEMASK & lStyle) == LVS_NOSCROLL)
     FIXME("  LVS_NOSCROLL\n");
 
-  if ((LVS_TYPESTYLEMASK & lStyle) == LVS_NOSORTHEADER)
-    FIXME("  LVS_NOSORTHEADER\n");
-
   if (lStyle & LVS_EDITLABELS)
     FIXME("  LVS_EDITLABELS\n");
 
@@ -7217,10 +7214,8 @@
           nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, item_index);
           cx = (nLabelWidth>cx)?nLabelWidth:cx;
         }
-        /* I had to add the '3' to prevent clipping of the end of the
-           line. Probably one of these padding numbers is incorrect. */
         if (infoPtr->himlSmall)
-          cx += WIDTH_PADDING + IMAGE_PADDING + 3;
+          cx += infoPtr->iconSize.cx + IMAGE_PADDING;
       }
       else
       {
@@ -7306,9 +7301,7 @@
              up the positioning, so I suspect no applications actually use
              them. */
           if (item_index == 0 && infoPtr->himlSmall)
-            /* I had to add the '3' to prevent clipping of the end of the
-               line. Probably one of these padding numbers is incorrect. */
-            nLabelWidth += WIDTH_PADDING + IMAGE_PADDING + 3;
+            nLabelWidth += infoPtr->iconSize.cx + IMAGE_PADDING;
           cx = (nLabelWidth>cx)?nLabelWidth:cx;
         }
       }
@@ -8005,9 +7998,9 @@
   
   /* create header */
   infoPtr->hwndHeader =	CreateWindowW(WC_HEADERW, (LPCWSTR)NULL, 
-                                      WS_CHILD | HDS_HORZ | HDS_BUTTONS, 
-                                      0, 0, 0, 0, hwnd, (HMENU)0, 
-                                      lpcs->hInstance, NULL);
+    WS_CHILD | HDS_HORZ | (DWORD)((LVS_NOSORTHEADER & lpcs->style)?0:HDS_BUTTONS), 
+    0, 0, 0, 0, hwnd, (HMENU)0, 
+    lpcs->hInstance, NULL);
 
   /* set header font */
   SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, 
@@ -8696,7 +8689,7 @@
 
     if(infoPtr->nEditLabelItem != -1)
     {
-      if(lvHitTestInfo.iItem == infoPtr->nEditLabelItem)
+      if(lvHitTestInfo.iItem == infoPtr->nEditLabelItem && lvHitTestInfo.flags & LVHT_ONITEMLABEL)
         LISTVIEW_EditLabelT(hwnd, lvHitTestInfo.iItem, TRUE);
       infoPtr->nEditLabelItem = -1;
     }
@@ -8804,7 +8797,7 @@
       infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
       InvalidateRect(hwnd, NULL, TRUE);
     }
-    else if(lpnmh->code ==  HDN_ITEMCLICKW)
+    else if(lpnmh->code ==  HDN_ITEMCLICKW || lpnmh->code ==  HDN_ITEMCLICKA)
     {
         /* Handle sorting by Header Column */
         NMLISTVIEW nmlv;


More information about the wine-patches mailing list