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
ae0d3630
Commit
ae0d3630
authored
Jun 06, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 08, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/listview: Position edit box after notification.
parent
c98dc0da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
27 deletions
+32
-27
listview.c
dlls/comctl32/listview.c
+31
-27
listview.c
dlls/comctl32/tests/listview.c
+1
-0
No files found.
dlls/comctl32/listview.c
View file @
ae0d3630
...
...
@@ -418,7 +418,7 @@ static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *, INT, const LVITEMW *);
static
LRESULT
LISTVIEW_VScroll
(
LISTVIEW_INFO
*
,
INT
,
INT
,
HWND
);
static
LRESULT
LISTVIEW_HScroll
(
LISTVIEW_INFO
*
,
INT
,
INT
,
HWND
);
static
BOOL
LISTVIEW_EnsureVisible
(
LISTVIEW_INFO
*
,
INT
,
BOOL
);
static
HWND
CreateEditLabelT
(
LISTVIEW_INFO
*
,
LPCWSTR
,
DWORD
,
INT
,
INT
,
INT
,
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
);
...
...
@@ -5055,7 +5055,11 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
WCHAR
szDispText
[
DISP_TEXT_SIZE
]
=
{
0
};
NMLVDISPINFOW
dispInfo
;
RECT
rect
;
SIZE
sz
;
HWND
hwndSelf
=
infoPtr
->
hwndSelf
;
HDC
hdc
;
HFONT
hOldFont
=
NULL
;
TEXTMETRICW
textMetric
;
TRACE
(
"(nItem=%d, isW=%d)
\n
"
,
nItem
,
isW
);
...
...
@@ -5088,8 +5092,7 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
dispInfo
.
item
.
cchTextMax
=
DISP_TEXT_SIZE
;
if
(
!
LISTVIEW_GetItemT
(
infoPtr
,
&
dispInfo
.
item
,
isW
))
return
0
;
infoPtr
->
hwndEdit
=
CreateEditLabelT
(
infoPtr
,
dispInfo
.
item
.
pszText
,
WS_VISIBLE
,
rect
.
left
-
2
,
rect
.
top
-
1
,
0
,
rect
.
bottom
-
rect
.
top
+
2
,
isW
);
infoPtr
->
hwndEdit
=
CreateEditLabelT
(
infoPtr
,
dispInfo
.
item
.
pszText
,
WS_VISIBLE
,
isW
);
if
(
!
infoPtr
->
hwndEdit
)
return
0
;
if
(
notify_dispinfoT
(
infoPtr
,
LVN_BEGINLABELEDITW
,
&
dispInfo
,
isW
))
...
...
@@ -5101,6 +5104,27 @@ static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
return
0
;
}
/* Now position and display edit box */
hdc
=
GetDC
(
infoPtr
->
hwndSelf
);
/* Select the font to get appropriate metric dimensions */
if
(
infoPtr
->
hFont
!=
0
)
hOldFont
=
SelectObject
(
hdc
,
infoPtr
->
hFont
);
/* Get String Length in pixels */
GetTextExtentPoint32W
(
hdc
,
dispInfo
.
item
.
pszText
,
lstrlenW
(
dispInfo
.
item
.
pszText
),
&
sz
);
/* Add Extra spacing for the next character */
GetTextMetricsW
(
hdc
,
&
textMetric
);
sz
.
cx
+=
(
textMetric
.
tmMaxCharWidth
*
2
);
if
(
infoPtr
->
hFont
!=
0
)
SelectObject
(
hdc
,
hOldFont
);
ReleaseDC
(
infoPtr
->
hwndSelf
,
hdc
);
MoveWindow
(
infoPtr
->
hwndEdit
,
rect
.
left
-
2
,
rect
.
top
-
1
,
sz
.
cx
,
rect
.
bottom
-
rect
.
top
+
2
,
FALSE
);
ShowWindow
(
infoPtr
->
hwndEdit
,
SW_NORMAL
);
SetFocus
(
infoPtr
->
hwndEdit
);
SendMessageW
(
infoPtr
->
hwndEdit
,
EM_SETSEL
,
0
,
-
1
);
...
...
@@ -10735,41 +10759,21 @@ static LRESULT CALLBACK EditLblWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
*
* RETURN:
*/
static
HWND
CreateEditLabelT
(
LISTVIEW_INFO
*
infoPtr
,
LPCWSTR
text
,
DWORD
style
,
INT
x
,
INT
y
,
INT
width
,
INT
height
,
BOOL
isW
)
static
HWND
CreateEditLabelT
(
LISTVIEW_INFO
*
infoPtr
,
LPCWSTR
text
,
DWORD
style
,
BOOL
isW
)
{
WCHAR
editName
[
5
]
=
{
'E'
,
'd'
,
'i'
,
't'
,
'\0'
};
HWND
hedit
;
SIZE
sz
;
HDC
hdc
;
HDC
hOldFont
=
0
;
TEXTMETRICW
textMetric
;
HINSTANCE
hinst
=
(
HINSTANCE
)
GetWindowLongPtrW
(
infoPtr
->
hwndSelf
,
GWLP_HINSTANCE
);
TRACE
(
"(text=%s, ..., isW=%d)
\n
"
,
debugtext_t
(
text
,
isW
),
isW
);
style
|=
WS_CHILDWINDOW
|
WS_CLIPSIBLINGS
|
ES_LEFT
|
ES_AUTOHSCROLL
|
WS_BORDER
;
hdc
=
GetDC
(
infoPtr
->
hwndSelf
);
/* Select the font to get appropriate metric dimensions */
if
(
infoPtr
->
hFont
!=
0
)
hOldFont
=
SelectObject
(
hdc
,
infoPtr
->
hFont
);
/*Get String Length in pixels */
GetTextExtentPoint32W
(
hdc
,
text
,
lstrlenW
(
text
),
&
sz
);
/*Add Extra spacing for the next character */
GetTextMetricsW
(
hdc
,
&
textMetric
);
sz
.
cx
+=
(
textMetric
.
tmMaxCharWidth
*
2
);
if
(
infoPtr
->
hFont
!=
0
)
SelectObject
(
hdc
,
hOldFont
);
ReleaseDC
(
infoPtr
->
hwndSelf
,
hdc
);
/* Window will be resized and positioned after LVN_BEGINLABELEDIT */
if
(
isW
)
hedit
=
CreateWindowW
(
editName
,
text
,
style
,
x
,
y
,
sz
.
cx
,
height
,
infoPtr
->
hwndSelf
,
0
,
hinst
,
0
);
hedit
=
CreateWindowW
(
editName
,
text
,
style
,
0
,
0
,
0
,
0
,
infoPtr
->
hwndSelf
,
0
,
hinst
,
0
);
else
hedit
=
CreateWindowA
(
"Edit"
,
(
LPCSTR
)
text
,
style
,
x
,
y
,
sz
.
cx
,
height
,
infoPtr
->
hwndSelf
,
0
,
hinst
,
0
);
hedit
=
CreateWindowA
(
"Edit"
,
(
LPCSTR
)
text
,
style
,
0
,
0
,
0
,
0
,
infoPtr
->
hwndSelf
,
0
,
hinst
,
0
);
if
(
!
hedit
)
return
0
;
...
...
dlls/comctl32/tests/listview.c
View file @
ae0d3630
...
...
@@ -207,6 +207,7 @@ static const struct message editbox_create_pos[] = {
{
WM_WINDOWPOSCHANGED
,
sent
},
{
WM_MOVE
,
sent
|
defwinproc
},
{
WM_SIZE
,
sent
|
defwinproc
},
/* the rest is todo */
{
WM_WINDOWPOSCHANGING
,
sent
},
{
WM_WINDOWPOSCHANGED
,
sent
},
{
0
}
...
...
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