Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3ea059c9
Commit
3ea059c9
authored
Feb 07, 2007
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Feb 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: listview: Create the LISTVIEW_INFO in WM_NCCREATE.
parent
30b6f9ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
31 deletions
+87
-31
listview.c
dlls/comctl32/listview.c
+58
-31
listview.c
dlls/comctl32/tests/listview.c
+29
-0
No files found.
dlls/comctl32/listview.c
View file @
3ea059c9
...
...
@@ -7673,17 +7673,17 @@ static CALLBACK VOID LISTVIEW_DelayedEditItem(HWND hwnd, UINT uMsg, UINT_PTR idE
/***
* DESCRIPTION:
* Creates the listview control.
* Creates the listview control
- the WM_NCCREATE phase
.
*
* PARAMETER(S):
* [I] hwnd : window handle
* [I] lpcs : the create parameters
*
* RETURN:
* Success:
0
* Failure:
-1
* Success:
TRUE
* Failure:
FALSE
*/
static
LRESULT
LISTVIEW_Create
(
HWND
hwnd
,
const
CREATESTRUCTW
*
lpcs
)
static
LRESULT
LISTVIEW_
NC
Create
(
HWND
hwnd
,
const
CREATESTRUCTW
*
lpcs
)
{
LISTVIEW_INFO
*
infoPtr
;
UINT
uView
=
lpcs
->
style
&
LVS_TYPEMASK
;
...
...
@@ -7693,7 +7693,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
/* initialize info pointer */
infoPtr
=
Alloc
(
sizeof
(
LISTVIEW_INFO
));
if
(
!
infoPtr
)
return
-
1
;
if
(
!
infoPtr
)
return
FALSE
;
SetWindowLongPtrW
(
hwnd
,
0
,
(
DWORD_PTR
)
infoPtr
);
...
...
@@ -7701,8 +7701,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr
->
dwStyle
=
lpcs
->
style
;
/* determine the type of structures to use */
infoPtr
->
hwndNotify
=
lpcs
->
hwndParent
;
infoPtr
->
notifyFormat
=
SendMessageW
(
infoPtr
->
hwndNotify
,
WM_NOTIFYFORMAT
,
(
WPARAM
)
infoPtr
->
hwndSelf
,
(
LPARAM
)
NF_QUERY
);
/* infoPtr->notifyFormat will be filled in WM_CREATE */
/* initialize color information */
infoPtr
->
clrBk
=
CLR_NONE
;
...
...
@@ -7731,12 +7730,58 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr
->
hFont
=
infoPtr
->
hDefaultFont
;
LISTVIEW_SaveTextMetrics
(
infoPtr
);
/* allocate memory for the data structure */
if
(
!
(
infoPtr
->
selectionRanges
=
ranges_create
(
10
)))
goto
fail
;
if
(
!
(
infoPtr
->
hdpaItems
=
DPA_Create
(
10
)))
goto
fail
;
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:
DestroyWindow
(
infoPtr
->
hwndHeader
);
ranges_destroy
(
infoPtr
->
selectionRanges
);
DPA_Destroy
(
infoPtr
->
hdpaItems
);
DPA_Destroy
(
infoPtr
->
hdpaPosX
);
DPA_Destroy
(
infoPtr
->
hdpaPosY
);
DPA_Destroy
(
infoPtr
->
hdpaColumns
);
Free
(
infoPtr
);
return
FALSE
;
}
/***
* DESCRIPTION:
* Creates the listview control - the WM_CREATE phase. Most of the data is
* already set up in LISTVIEW_NCCreate
*
* PARAMETER(S):
* [I] hwnd : window handle
* [I] lpcs : the create parameters
*
* RETURN:
* Success: 0
* Failure: -1
*/
static
LRESULT
LISTVIEW_Create
(
HWND
hwnd
,
const
CREATESTRUCTW
*
lpcs
)
{
LISTVIEW_INFO
*
infoPtr
=
(
LISTVIEW_INFO
*
)
GetWindowLongPtrW
(
hwnd
,
0
);
UINT
uView
=
lpcs
->
style
&
LVS_TYPEMASK
;
TRACE
(
"(lpcs=%p)
\n
"
,
lpcs
);
infoPtr
->
notifyFormat
=
SendMessageW
(
infoPtr
->
hwndNotify
,
WM_NOTIFYFORMAT
,
(
WPARAM
)
infoPtr
->
hwndSelf
,
(
LPARAM
)
NF_QUERY
);
/* create header */
infoPtr
->
hwndHeader
=
CreateWindowW
(
WC_HEADERW
,
NULL
,
WS_CHILD
|
HDS_HORZ
|
HDS_FULLDRAG
|
(
DWORD
)((
LVS_NOSORTHEADER
&
lpcs
->
style
)
?
0
:
HDS_BUTTONS
),
0
,
0
,
0
,
0
,
hwnd
,
NULL
,
lpcs
->
hInstance
,
NULL
);
if
(
!
infoPtr
->
hwndHeader
)
goto
fail
;
if
(
!
infoPtr
->
hwndHeader
)
return
-
1
;
/* set header unicode format */
SendMessageW
(
infoPtr
->
hwndHeader
,
HDM_SETUNICODEFORMAT
,
(
WPARAM
)
TRUE
,
(
LPARAM
)
NULL
);
...
...
@@ -7744,20 +7789,9 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
/* set header font */
SendMessageW
(
infoPtr
->
hwndHeader
,
WM_SETFONT
,
(
WPARAM
)
infoPtr
->
hFont
,
(
LPARAM
)
TRUE
);
/* allocate memory for the data structure */
if
(
!
(
infoPtr
->
selectionRanges
=
ranges_create
(
10
)))
goto
fail
;
if
(
!
(
infoPtr
->
hdpaItems
=
DPA_Create
(
10
)))
goto
fail
;
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
);
/* init item size to avoid division by 0 */
LISTVIEW_UpdateItemSize
(
infoPtr
);
if
(
uView
==
LVS_REPORT
)
{
if
(
!
(
LVS_NOCOLUMNHEADER
&
lpcs
->
style
))
...
...
@@ -7775,16 +7809,6 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
OpenThemeData
(
hwnd
,
themeClass
);
return
0
;
fail:
DestroyWindow
(
infoPtr
->
hwndHeader
);
ranges_destroy
(
infoPtr
->
selectionRanges
);
DPA_Destroy
(
infoPtr
->
hdpaItems
);
DPA_Destroy
(
infoPtr
->
hdpaPosX
);
DPA_Destroy
(
infoPtr
->
hdpaPosY
);
DPA_Destroy
(
infoPtr
->
hdpaColumns
);
Free
(
infoPtr
);
return
-
1
;
}
/***
...
...
@@ -9246,7 +9270,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
TRACE
(
"(uMsg=%x wParam=%x lParam=%lx)
\n
"
,
uMsg
,
wParam
,
lParam
);
if
(
!
infoPtr
&&
(
uMsg
!=
WM_CREATE
))
if
(
!
infoPtr
&&
(
uMsg
!=
WM_
NC
CREATE
))
return
DefWindowProcW
(
hwnd
,
uMsg
,
wParam
,
lParam
);
switch
(
uMsg
)
...
...
@@ -9605,6 +9629,9 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case
WM_COMMAND
:
return
LISTVIEW_Command
(
infoPtr
,
wParam
,
lParam
);
case
WM_NCCREATE
:
return
LISTVIEW_NCCreate
(
hwnd
,
(
LPCREATESTRUCTW
)
lParam
);
case
WM_CREATE
:
return
LISTVIEW_Create
(
hwnd
,
(
LPCREATESTRUCTW
)
lParam
);
...
...
dlls/comctl32/tests/listview.c
View file @
3ea059c9
...
...
@@ -343,6 +343,34 @@ static void test_items(void)
DestroyWindow
(
hwnd
);
}
/* test setting imagelist between WM_NCCREATE and WM_CREATE */
static
WNDPROC
listviewWndProc
;
static
HIMAGELIST
test_create_imagelist
;
static
LRESULT
CALLBACK
create_test_wndproc
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
if
(
uMsg
==
WM_CREATE
)
SendMessage
(
hwnd
,
LVM_SETIMAGELIST
,
0
,
(
LPARAM
)
test_create_imagelist
);
return
CallWindowProc
(
listviewWndProc
,
hwnd
,
uMsg
,
wParam
,
lParam
);
}
static
void
test_create
()
{
HWND
hList
;
WNDCLASSEX
cls
;
cls
.
cbSize
=
sizeof
(
WNDCLASSEX
);
ok
(
GetClassInfoEx
(
GetModuleHandle
(
NULL
),
"SysListView32"
,
&
cls
),
"GetClassInfoEx failed
\n
"
);
listviewWndProc
=
cls
.
lpfnWndProc
;
cls
.
lpfnWndProc
=
create_test_wndproc
;
cls
.
lpszClassName
=
"MyListView32"
;
ok
(
RegisterClassEx
(
&
cls
),
"RegisterClassEx failed
\n
"
);
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
"
);
DestroyWindow
(
hList
);
}
START_TEST
(
listview
)
{
INITCOMMONCONTROLSEX
icc
;
...
...
@@ -354,4 +382,5 @@ START_TEST(listview)
test_images
();
test_checkboxes
();
test_items
();
test_create
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment