Mikołaj Zalewski : comctl32: listview: Set the style in WM_CREATE.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 26 07:59:34 CST 2007


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

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Sun Feb 25 12:53:57 2007 +0100

comctl32: listview: Set the style in WM_CREATE.

---

 dlls/comctl32/listview.c       |   11 +++++------
 dlls/comctl32/tests/listview.c |    7 +++++++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index aca548f..e9476ea 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -7702,7 +7702,6 @@ static CALLBACK VOID LISTVIEW_DelayedEditItem(HWND hwnd, UINT uMsg, UINT_PTR idE
 static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
 {
   LISTVIEW_INFO *infoPtr;
-  UINT uView = lpcs->style & LVS_TYPEMASK;
   LOGFONTW logFont;
 
   TRACE("(lpcs=%p)\n", lpcs);
@@ -7714,7 +7713,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
   SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
 
   infoPtr->hwndSelf = hwnd;
-  infoPtr->dwStyle = lpcs->style;
+  infoPtr->dwStyle = lpcs->style;    /* Note: may be changed in WM_CREATE */
   /* determine the type of structures to use */
   infoPtr->hwndNotify = lpcs->hwndParent;
   /* infoPtr->notifyFormat will be filled in WM_CREATE */
@@ -7752,10 +7751,6 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
   if (!(infoPtr->hdpaPosX  = DPA_Create(10))) goto fail;
   if (!(infoPtr->hdpaPosY  = DPA_Create(10))) goto fail;
   if (!(infoPtr->hdpaColumns = DPA_Create(10))) goto fail;
-
-  /* initialize the icon sizes */
-  set_icon_size(&infoPtr->iconSize, infoPtr->himlNormal, uView != LVS_ICON);
-  set_icon_size(&infoPtr->iconStateSize, infoPtr->himlState, TRUE);
   return TRUE;
 
 fail:
@@ -7789,6 +7784,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
 
   TRACE("(lpcs=%p)\n", lpcs);
 
+  infoPtr->dwStyle = lpcs->style;
   infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT,
                                        (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
 
@@ -7824,6 +7820,9 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
 
   OpenThemeData(hwnd, themeClass);
 
+  /* initialize the icon sizes */
+  set_icon_size(&infoPtr->iconSize, infoPtr->himlNormal, uView != LVS_ICON);
+  set_icon_size(&infoPtr->iconStateSize, infoPtr->himlState, TRUE);
   return 0;
 }
 
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 6c1a3b1..8850091 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -350,13 +350,18 @@ static HIMAGELIST test_create_imagelist;
 static LRESULT CALLBACK create_test_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
     if (uMsg == WM_CREATE)
+    {
+        LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
+        lpcs->style |= LVS_REPORT;
         SendMessage(hwnd, LVM_SETIMAGELIST, 0, (LPARAM)test_create_imagelist);
+    }
     return CallWindowProc(listviewWndProc, hwnd, uMsg, wParam, lParam);
 }
 
 static void test_create()
 {
     HWND hList;
+    HWND hHeader;
     WNDCLASSEX cls;
     cls.cbSize = sizeof(WNDCLASSEX);
     ok(GetClassInfoEx(GetModuleHandle(NULL), "SysListView32", &cls), "GetClassInfoEx failed\n");
@@ -368,6 +373,8 @@ static void test_create()
     test_create_imagelist = ImageList_Create(16, 16, 0, 5, 10);
     hList = CreateWindow("MyListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandle(NULL), 0);
     ok((HIMAGELIST)SendMessage(hList, LVM_GETIMAGELIST, 0, 0) == test_create_imagelist, "Image list not obtained\n");
+    hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+    ok(IsWindow(hHeader) && IsWindowVisible(hHeader), "Listview not in report mode\n");
     DestroyWindow(hList);
 }
 




More information about the wine-cvs mailing list