Nikolay Sivov : comctl32/listview: Notify parent with WM_MEASUREITEM on control creation.

Alexandre Julliard julliard at winehq.org
Tue Jun 23 10:02:43 CDT 2009


Module: wine
Branch: master
Commit: 8e18e9e6bdc6dff7f8b148bd7f9b9abd34bdee94
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8e18e9e6bdc6dff7f8b148bd7f9b9abd34bdee94

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Mon Jun 22 22:04:41 2009 +0400

comctl32/listview: Notify parent with WM_MEASUREITEM on control creation.

---

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

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index f0a294e..0e22848 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -1027,6 +1027,20 @@ static inline DWORD notify_postpaint (const LISTVIEW_INFO *infoPtr, NMLVCUSTOMDR
     return notify_customdraw(infoPtr, CDDS_POSTPAINT, lpnmlvcd);
 }
 
+static void notify_measureitem(LISTVIEW_INFO *infoPtr)
+{
+    MEASUREITEMSTRUCT mis;
+    mis.CtlType = ODT_LISTVIEW;
+    mis.CtlID = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
+    mis.itemID = -1;
+    mis.itemWidth = 0;
+    mis.itemData = 0;
+    mis.itemHeight= infoPtr->nItemHeight;
+    SendMessageW(infoPtr->hwndNotify, WM_MEASUREITEM, mis.CtlID, (LPARAM)&mis);
+    if (infoPtr->nItemHeight != max(mis.itemHeight, 1))
+        infoPtr->nMeasureItemHeight = infoPtr->nItemHeight = max(mis.itemHeight, 1);
+}
+
 /******** Item iterator functions **********************************/
 
 static RANGES ranges_create(int count);
@@ -8654,6 +8668,8 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
       ShowWindow(infoPtr->hwndHeader, SW_SHOWNORMAL);
     }
     LISTVIEW_UpdateScroll(infoPtr);
+    /* send WM_MEASUREITEM notification */
+    if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED) notify_measureitem(infoPtr);
   }
 
   OpenThemeData(hwnd, themeClass);
@@ -10776,16 +10792,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
       if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS))
       {
-          MEASUREITEMSTRUCT mis;
-          mis.CtlType = ODT_LISTVIEW;
-          mis.CtlID = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
-          mis.itemID = -1;
-          mis.itemWidth = 0;
-          mis.itemData = 0;
-          mis.itemHeight= infoPtr->nItemHeight;
-          SendMessageW(infoPtr->hwndNotify, WM_MEASUREITEM, mis.CtlID, (LPARAM)&mis);
-          if (infoPtr->nItemHeight != max(mis.itemHeight, 1))
-              infoPtr->nMeasureItemHeight = infoPtr->nItemHeight = max(mis.itemHeight, 1);
+          notify_measureitem(infoPtr);
       }
 
 	  LISTVIEW_UpdateSize(infoPtr);
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 820acc6..38155b1 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -1405,7 +1405,7 @@ static void test_create(void)
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
     hList = create_listview_control(LVS_OWNERDRAWFIXED);
     ok_sequence(sequences, PARENT_SEQ_INDEX, create_ownerdrawfixed_parent_seq,
-                "created with LVS_OWNERDRAWFIXED - parent seq", TRUE);
+                "created with LVS_OWNERDRAWFIXED|LVS_REPORT - parent seq", FALSE);
     DestroyWindow(hList);
 }
 




More information about the wine-cvs mailing list