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
a6569448
Commit
a6569448
authored
Oct 05, 2002
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Oct 05, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite the begin/end label edit procedures.
Better support of OWNERDRAW. Cleaner, simpler code.
parent
530793ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
125 deletions
+63
-125
listview.c
dlls/comctl32/listview.c
+63
-125
No files found.
dlls/comctl32/listview.c
View file @
a6569448
...
@@ -4062,56 +4062,32 @@ static LRESULT LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
...
@@ -4062,56 +4062,32 @@ static LRESULT LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
*/
*/
static
BOOL
LISTVIEW_EndEditLabelT
(
LISTVIEW_INFO
*
infoPtr
,
LPWSTR
pszText
,
BOOL
isW
)
static
BOOL
LISTVIEW_EndEditLabelT
(
LISTVIEW_INFO
*
infoPtr
,
LPWSTR
pszText
,
BOOL
isW
)
{
{
LONG
lStyle
=
infoPtr
->
dwStyle
;
NMLVDISPINFOW
dispInfo
;
NMLVDISPINFOW
dispInfo
;
LISTVIEW_ITEM
*
lpItem
;
HDPA
hdpaSubItems
;
LISTVIEW_ITEM
lvItemRef
;
LVITEMW
item
;
BOOL
bResult
=
TRUE
;
INT
nItem
=
infoPtr
->
nEditLabelItem
;
TRACE
(
"(pszText=%s, nItem=%d, isW=%d)
\n
"
,
debugtext_t
(
pszText
,
isW
),
nItem
,
isW
);
infoPtr
->
bEditing
=
FALSE
;
TRACE
(
"(pszText=%s, isW=%d)
\n
"
,
debugtext_t
(
pszText
,
isW
),
isW
);
if
(
!
(
lStyle
&
LVS_OWNERDATA
))
{
if
(
!
(
hdpaSubItems
=
(
HDPA
)
DPA_GetPtr
(
infoPtr
->
hdpaItems
,
nItem
)))
return
FALSE
;
if
(
!
(
lpItem
=
(
LISTVIEW_ITEM
*
)
DPA_GetPtr
(
hdpaSubItems
,
0
)))
infoPtr
->
bEditing
=
FALSE
;
return
FALSE
;
}
else
{
ZeroMemory
(
&
lvItemRef
,
sizeof
(
LISTVIEW_ITEM
));
item
.
iItem
=
nItem
;
item
.
iSubItem
=
0
;
item
.
mask
=
LVIF_PARAM
|
LVIF_STATE
;
item
.
stateMask
=
~
0
;
if
(
!
LISTVIEW_GetItemW
(
infoPtr
,
&
item
,
TRUE
))
return
FALSE
;
lvItemRef
.
hdr
.
iImage
=
item
.
iImage
;
lvItemRef
.
state
=
item
.
state
;
lvItemRef
.
lParam
=
item
.
lParam
;
lpItem
=
&
lvItemRef
;
}
ZeroMemory
(
&
dispInfo
,
sizeof
(
dispInfo
));
ZeroMemory
(
&
dispInfo
,
sizeof
(
dispInfo
));
dispInfo
.
item
.
mask
=
0
;
dispInfo
.
item
.
mask
=
LVIF_PARAM
|
LVIF_STATE
;
dispInfo
.
item
.
iItem
=
nItem
;
dispInfo
.
item
.
iItem
=
infoPtr
->
nEditLabelItem
;
dispInfo
.
item
.
state
=
lpItem
->
state
;
dispInfo
.
item
.
iSubItem
=
0
;
dispInfo
.
item
.
stateMask
=
0
;
/* FIXME: why not copy the state mask in here? */
dispInfo
.
item
.
stateMask
=
~
0
;
dispInfo
.
item
.
pszText
=
pszText
;
if
(
!
LISTVIEW_GetItemW
(
infoPtr
,
&
dispInfo
.
item
,
TRUE
))
return
FALSE
;
dispInfo
.
item
.
cchTextMax
=
textlenT
(
pszText
,
isW
);
dispInfo
.
item
.
pszText
=
pszText
;
dispInfo
.
item
.
iImage
=
lpItem
->
hdr
.
iImage
;
dispInfo
.
item
.
cchTextMax
=
textlenT
(
pszText
,
isW
);
dispInfo
.
item
.
lParam
=
lpItem
->
lParam
;
/* Do we need to update the Item Text */
/* Do we need to update the Item Text */
if
(
!
notify_dispinfoT
(
infoPtr
,
LVN_ENDLABELEDITW
,
&
dispInfo
,
isW
))
return
FALSE
;
if
(
notify_dispinfoT
(
infoPtr
,
LVN_ENDLABELEDITW
,
&
dispInfo
,
isW
))
if
(
!
pszText
)
return
TRUE
;
if
(
lpItem
->
hdr
.
pszText
!=
LPSTR_TEXTCALLBACKW
&&
!
(
lStyle
&
LVS_OWNERDATA
))
bResult
=
textsetptrT
(
&
lpItem
->
hdr
.
pszText
,
pszText
,
isW
);
return
bResult
;
ZeroMemory
(
&
dispInfo
,
sizeof
(
dispInfo
));
dispInfo
.
item
.
mask
=
LVIF_TEXT
;
dispInfo
.
item
.
iItem
=
infoPtr
->
nEditLabelItem
;
dispInfo
.
item
.
iSubItem
=
0
;
dispInfo
.
item
.
pszText
=
pszText
;
dispInfo
.
item
.
cchTextMax
=
textlenT
(
pszText
,
isW
);
return
LISTVIEW_SetItemT
(
infoPtr
,
&
dispInfo
.
item
,
isW
);
}
}
/***
/***
...
@@ -4129,92 +4105,54 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, LPWSTR pszText, BOOL
...
@@ -4129,92 +4105,54 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, LPWSTR pszText, BOOL
*/
*/
static
HWND
LISTVIEW_EditLabelT
(
LISTVIEW_INFO
*
infoPtr
,
INT
nItem
,
BOOL
isW
)
static
HWND
LISTVIEW_EditLabelT
(
LISTVIEW_INFO
*
infoPtr
,
INT
nItem
,
BOOL
isW
)
{
{
NMLVDISPINFOW
dispInfo
;
WCHAR
szDispText
[
DISP_TEXT_SIZE
]
=
{
0
};
RECT
rect
;
NMLVDISPINFOW
dispInfo
;
LISTVIEW_ITEM
*
lpItem
;
RECT
rect
;
HWND
hedit
;
HDPA
hdpaSubItems
;
WCHAR
szDispText
[
DISP_TEXT_SIZE
];
LVITEMW
lvItem
;
LISTVIEW_ITEM
lvItemRef
;
LONG
lStyle
=
infoPtr
->
dwStyle
;
if
(
~
infoPtr
->
dwStyle
&
LVS_EDITLABELS
)
TRACE
(
"(nItem=%d, isW=%d)
\n
"
,
nItem
,
isW
);
return
FALSE
;
infoPtr
->
nEditLabelItem
=
nItem
;
if
(
~
infoPtr
->
dwStyle
&
LVS_EDITLABELS
)
return
0
;
TRACE
(
"(nItem=%d, isW=%d)
\n
"
,
nItem
,
isW
)
;
infoPtr
->
nEditLabelItem
=
nItem
;
/* Is the EditBox still there, if so remove it */
/* Is the EditBox still there, if so remove it */
if
(
infoPtr
->
hwndEdit
!=
0
)
if
(
infoPtr
->
hwndEdit
!=
0
)
{
{
SetFocus
(
infoPtr
->
hwndSelf
);
SetFocus
(
infoPtr
->
hwndSelf
);
infoPtr
->
hwndEdit
=
0
;
infoPtr
->
hwndEdit
=
0
;
}
}
LISTVIEW_SetSelection
(
infoPtr
,
nItem
);
LISTVIEW_SetItemFocus
(
infoPtr
,
nItem
);
if
(
!
(
lStyle
&
LVS_OWNERDATA
))
LISTVIEW_SetSelection
(
infoPtr
,
nItem
);
{
LISTVIEW_SetItemFocus
(
infoPtr
,
nItem
);
if
(
NULL
==
(
hdpaSubItems
=
(
HDPA
)
DPA_GetPtr
(
infoPtr
->
hdpaItems
,
nItem
)))
return
0
;
if
(
NULL
==
(
lpItem
=
(
LISTVIEW_ITEM
*
)
DPA_GetPtr
(
hdpaSubItems
,
0
)))
rect
.
left
=
LVIR_LABEL
;
return
0
;
if
(
!
LISTVIEW_GetItemRect
(
infoPtr
,
nItem
,
&
rect
))
return
0
;
}
else
ZeroMemory
(
&
dispInfo
,
sizeof
(
dispInfo
));
{
dispInfo
.
item
.
mask
=
LVIF_PARAM
|
LVIF_STATE
|
LVIF_TEXT
;
LVITEMW
item
;
dispInfo
.
item
.
iItem
=
nItem
;
item
.
iItem
=
nItem
;
dispInfo
.
item
.
iSubItem
=
0
;
item
.
iSubItem
=
0
;
dispInfo
.
item
.
stateMask
=
~
0
;
item
.
mask
=
LVIF_PARAM
|
LVIF_STATE
;
dispInfo
.
item
.
pszText
=
szDispText
;
item
.
stateMask
=
~
0
;
dispInfo
.
item
.
cchTextMax
=
DISP_TEXT_SIZE
;
if
(
!
LISTVIEW_GetItemW
(
infoPtr
,
&
item
,
TRUE
))
return
FALSE
;
if
(
!
LISTVIEW_GetItemT
(
infoPtr
,
&
dispInfo
.
item
,
FALSE
,
isW
))
return
0
;
lvItemRef
.
hdr
.
iImage
=
item
.
iImage
;
lvItemRef
.
state
=
item
.
state
;
infoPtr
->
hwndEdit
=
CreateEditLabelT
(
infoPtr
,
dispInfo
.
item
.
pszText
,
WS_VISIBLE
,
lvItemRef
.
lParam
=
item
.
lParam
;
rect
.
left
-
2
,
rect
.
top
-
1
,
0
,
rect
.
bottom
-
rect
.
top
+
2
,
isW
);
lpItem
=
&
lvItemRef
;
if
(
!
infoPtr
->
hwndEdit
)
return
0
;
}
if
(
notify_dispinfoT
(
infoPtr
,
LVN_BEGINLABELEDITW
,
&
dispInfo
,
isW
))
{
SendMessageW
(
infoPtr
->
hwndEdit
,
WM_CLOSE
,
0
,
0
);
infoPtr
->
hwndEdit
=
0
;
return
0
;
}
/* get information needed for drawing the item */
infoPtr
->
bEditing
=
TRUE
;
lvItem
.
mask
=
LVIF_TEXT
;
ShowWindow
(
infoPtr
->
hwndEdit
,
SW_NORMAL
);
lvItem
.
iItem
=
nItem
;
SetFocus
(
infoPtr
->
hwndEdit
);
lvItem
.
iSubItem
=
0
;
SendMessageW
(
infoPtr
->
hwndEdit
,
EM_SETSEL
,
0
,
-
1
);
lvItem
.
cchTextMax
=
DISP_TEXT_SIZE
;
return
infoPtr
->
hwndEdit
;
lvItem
.
pszText
=
szDispText
;
*
lvItem
.
pszText
=
'\0'
;
if
(
!
LISTVIEW_GetItemT
(
infoPtr
,
&
lvItem
,
FALSE
,
isW
))
return
FALSE
;
ZeroMemory
(
&
dispInfo
,
sizeof
(
dispInfo
));
dispInfo
.
item
.
mask
=
0
;
dispInfo
.
item
.
iItem
=
nItem
;
dispInfo
.
item
.
state
=
lpItem
->
state
;
dispInfo
.
item
.
stateMask
=
0
;
/* FIXME: why not copy the state mask in here? */
dispInfo
.
item
.
pszText
=
lvItem
.
pszText
;
dispInfo
.
item
.
cchTextMax
=
lstrlenW
(
lvItem
.
pszText
);
dispInfo
.
item
.
iImage
=
lpItem
->
hdr
.
iImage
;
dispInfo
.
item
.
lParam
=
lpItem
->
lParam
;
if
(
notify_dispinfoT
(
infoPtr
,
LVN_BEGINLABELEDITW
,
&
dispInfo
,
isW
))
return
0
;
rect
.
left
=
LVIR_LABEL
;
if
(
!
LISTVIEW_GetItemRect
(
infoPtr
,
nItem
,
&
rect
))
return
0
;
if
(
!
(
hedit
=
CreateEditLabelT
(
infoPtr
,
szDispText
,
WS_VISIBLE
,
rect
.
left
-
2
,
rect
.
top
-
1
,
0
,
rect
.
bottom
-
rect
.
top
+
2
,
isW
)))
return
0
;
infoPtr
->
hwndEdit
=
hedit
;
ShowWindow
(
infoPtr
->
hwndEdit
,
SW_NORMAL
);
infoPtr
->
bEditing
=
TRUE
;
SetFocus
(
infoPtr
->
hwndEdit
);
SendMessageW
(
infoPtr
->
hwndEdit
,
EM_SETSEL
,
0
,
-
1
);
return
infoPtr
->
hwndEdit
;
}
}
...
...
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