comctl32: listview: Set the style in WM_CREATE.

This commit is contained in:
Mikołaj Zalewski 2007-02-25 12:53:57 +01:00 committed by Alexandre Julliard
parent cc9160f214
commit f3ebf1c7f4
2 changed files with 12 additions and 6 deletions

View File

@ -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;
}

View File

@ -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);
}