[4/4] comctl32/listview: Enable column reordering

Nikolay Sivov bunglehead at gmail.com
Mon Aug 3 15:55:36 CDT 2009


http://bugs.winehq.org/show_bug.cgi?id=3231

After three previous patches we should just enable reordering,
I hope this is the last one.

Changelog:
    - Enable column reordering

>From 15993e44612b5ffbbf2b0ea04de5bd4e9ac0f021 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 4 Aug 2009 00:42:51 +0400
Subject: Enable column reordering

---
 dlls/comctl32/listview.c       |   18 +++++++++---------
 dlls/comctl32/tests/listview.c |    4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 6dea474..3a0c411 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -52,7 +52,6 @@
  *   -- Support CustomDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs).
  *   -- LVA_SNAPTOGRID not implemented
  *   -- LISTVIEW_ApproximateViewRect partially implemented
- *   -- LISTVIEW_[GS]etColumnOrderArray stubs
  *   -- LISTVIEW_SetColumnWidth ignores header images & bitmap
  *   -- LISTVIEW_SetIconSpacing is incomplete
  *   -- LISTVIEW_StyleChanged doesn't handle some changes too well
@@ -7556,16 +7555,16 @@ static BOOL LISTVIEW_SetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn,
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_SetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCount, const INT *lpiArray)
+static BOOL LISTVIEW_SetColumnOrderArray(LISTVIEW_INFO *infoPtr, INT iCount, const INT *lpiArray)
 {
-  FIXME("iCount %d lpiArray %p\n", iCount, lpiArray);
+    TRACE("iCount %d lpiArray %p\n", iCount, lpiArray);
 
-  if (!lpiArray)
-    return FALSE;
+    if (!lpiArray || !IsWindow(infoPtr->hwndHeader)) return FALSE;
 
-  return TRUE;
-}
+    infoPtr->colRectsDirty = TRUE;
 
+    return SendMessageW(infoPtr->hwndHeader, HDM_SETORDERARRAY, iCount, (LPARAM)lpiArray);
+}
 
 /***
  * DESCRIPTION:
@@ -9541,9 +9540,10 @@ static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADE
             return (infoPtr->dwLvExStyle & LVS_EX_HEADERDRAGDROP) == 0;
 
         case HDN_ENDDRAG:
-            FIXME("Changing column order not implemented\n");
+            infoPtr->colRectsDirty = TRUE;
+            LISTVIEW_InvalidateList(infoPtr);
             notify_forward_header(infoPtr, lpnmh);
-            return TRUE;
+            return FALSE;
 
         case HDN_ITEMCHANGINGW:
         case HDN_ITEMCHANGINGA:
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 4ac14d5..72abdff 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -3159,7 +3159,7 @@ static void test_getitemrect(void)
     r = SendMessage(hwnd, LVM_GETITEMPOSITION, 0, (LPARAM)&pt);
     expect(TRUE, r);
     /* 1 indexed column width + padding */
-    todo_wine expect(102, pt.x);
+    expect(102, pt.x);
     /* rect is at zero too */
     rect.left = LVIR_BOUNDS;
     rect.right = rect.top = rect.bottom = -1;
@@ -3174,7 +3174,7 @@ static void test_getitemrect(void)
     r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
     expect(TRUE, r);
     /* column width + padding */
-    todo_wine expect(102, rect.left);
+    expect(102, rect.left);
 
     /* back to initial order */
     order[0] = 0; order[1] = 1;
-- 
1.5.6.5





More information about the wine-patches mailing list