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
9c565342
Commit
9c565342
authored
Jun 20, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 22, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/listview: Implement LVM_CANCELEDITLABEL with tests.
parent
e5e4d1e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
7 deletions
+74
-7
listview.c
dlls/comctl32/listview.c
+24
-7
listview.c
dlls/comctl32/tests/listview.c
+50
-0
No files found.
dlls/comctl32/listview.c
View file @
9c565342
...
...
@@ -106,7 +106,6 @@
* -- LVN_BEGINRDRAG
*
* Messages:
* -- LVM_CANCELEDITLABEL
* -- LVM_ENABLEGROUPVIEW
* -- LVM_GETBKIMAGE, LVM_SETBKIMAGE
* -- LVM_GETGROUPINFO, LVM_SETGROUPINFO
...
...
@@ -419,6 +418,7 @@ static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *, INT, BOOL);
static
HWND
CreateEditLabelT
(
LISTVIEW_INFO
*
,
LPCWSTR
,
DWORD
,
BOOL
);
static
HIMAGELIST
LISTVIEW_SetImageList
(
LISTVIEW_INFO
*
,
INT
,
HIMAGELIST
);
static
INT
LISTVIEW_HitTest
(
const
LISTVIEW_INFO
*
,
LPLVHITTESTINFO
,
BOOL
,
BOOL
);
static
BOOL
LISTVIEW_EndEditLabelT
(
LISTVIEW_INFO
*
,
BOOL
,
BOOL
);
/******** Text handling functions *************************************/
...
...
@@ -4591,6 +4591,26 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte
return
dwViewRect
;
}
/***
* DESCRIPTION:
* Cancel edit label with saving item text.
*
* PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure
*
* RETURN:
* Always returns TRUE.
*/
static
LRESULT
LISTVIEW_CancelEditLabel
(
LISTVIEW_INFO
*
infoPtr
)
{
/* handle value will be lost after LISTVIEW_EndEditLabelT */
HWND
edit
=
infoPtr
->
hwndEdit
;
LISTVIEW_EndEditLabelT
(
infoPtr
,
TRUE
,
IsWindowUnicode
(
infoPtr
->
hwndEdit
));
SendMessageW
(
edit
,
WM_CLOSE
,
0
,
0
);
return
TRUE
;
}
/***
* DESCRIPTION:
...
...
@@ -10113,7 +10133,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case
LVM_ARRANGE
:
return
LISTVIEW_Arrange
(
infoPtr
,
(
INT
)
wParam
);
/* case LVM_CANCELEDITLABEL: */
case
LVM_CANCELEDITLABEL
:
return
LISTVIEW_CancelEditLabel
(
infoPtr
);
case
LVM_CREATEDRAGIMAGE
:
return
(
LRESULT
)
LISTVIEW_CreateDragImage
(
infoPtr
,
(
INT
)
wParam
,
(
LPPOINT
)
lParam
);
...
...
@@ -10734,11 +10755,7 @@ static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lP
}
case
EN_KILLFOCUS
:
{
/* handle value will be lost after LISTVIEW_EndEditLabelT */
HWND
edit
=
infoPtr
->
hwndEdit
;
LISTVIEW_EndEditLabelT
(
infoPtr
,
TRUE
,
IsWindowUnicode
(
infoPtr
->
hwndEdit
));
SendMessageW
(
edit
,
WM_CLOSE
,
0
,
0
);
LISTVIEW_CancelEditLabel
(
infoPtr
);
}
default:
...
...
dlls/comctl32/tests/listview.c
View file @
9c565342
...
...
@@ -3534,6 +3534,55 @@ static void test_get_set_view(void)
DestroyWindow
(
hwnd
);
}
static
void
test_canceleditlabel
(
void
)
{
HWND
hwnd
,
hwndedit
;
DWORD
ret
;
CHAR
buff
[
10
];
LVITEMA
itema
;
static
CHAR
test
[]
=
"test"
;
static
const
CHAR
test1
[]
=
"test1"
;
hwnd
=
create_listview_control
(
LVS_EDITLABELS
);
ok
(
hwnd
!=
NULL
,
"failed to create a listview window
\n
"
);
insert_item
(
hwnd
,
0
);
/* try without edit created */
ret
=
SendMessage
(
hwnd
,
LVM_CANCELEDITLABEL
,
0
,
0
);
expect
(
TRUE
,
ret
);
/* cancel without data change */
SetFocus
(
hwnd
);
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_EDITLABEL
,
0
,
0
);
ok
(
IsWindow
(
hwndedit
),
"Expected edit control to be created
\n
"
);
ret
=
SendMessage
(
hwnd
,
LVM_CANCELEDITLABEL
,
0
,
0
);
expect
(
TRUE
,
ret
);
ok
(
!
IsWindow
(
hwndedit
),
"Expected edit control to be destroyed
\n
"
);
/* cancel after data change */
memset
(
&
itema
,
0
,
sizeof
(
itema
));
itema
.
pszText
=
test
;
ret
=
SendMessage
(
hwnd
,
LVM_SETITEMTEXT
,
0
,
(
LPARAM
)
&
itema
);
expect
(
TRUE
,
ret
);
SetFocus
(
hwnd
);
hwndedit
=
(
HWND
)
SendMessage
(
hwnd
,
LVM_EDITLABEL
,
0
,
0
);
ok
(
IsWindow
(
hwndedit
),
"Expected edit control to be created
\n
"
);
ret
=
SetWindowText
(
hwndedit
,
test1
);
ok
(
ret
!=
0
,
"Expected edit text to change
\n
"
);
ret
=
SendMessage
(
hwnd
,
LVM_CANCELEDITLABEL
,
0
,
0
);
expect
(
TRUE
,
ret
);
ok
(
!
IsWindow
(
hwndedit
),
"Expected edit control to be destroyed
\n
"
);
memset
(
&
itema
,
0
,
sizeof
(
itema
));
itema
.
pszText
=
buff
;
itema
.
cchTextMax
=
sizeof
(
buff
)
/
sizeof
(
CHAR
);
ret
=
SendMessage
(
hwnd
,
LVM_GETITEMTEXT
,
0
,
(
LPARAM
)
&
itema
);
expect
(
5
,
ret
);
ok
(
strcmp
(
buff
,
test1
)
==
0
,
"Expected label text not to change
\n
"
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
listview
)
{
HMODULE
hComctl32
;
...
...
@@ -3598,6 +3647,7 @@ START_TEST(listview)
/* comctl32 version 6 tests start here */
test_get_set_view
();
test_canceleditlabel
();
unload_v6_module
(
ctx_cookie
);
...
...
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