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
89a49182
Commit
89a49182
authored
Oct 28, 2005
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Oct 28, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unify HEADER_InsertItem[A/W] into one function.
parent
923a9e47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
132 deletions
+14
-132
header.c
dlls/comctl32/header.c
+14
-132
No files found.
dlls/comctl32/header.c
View file @
89a49182
...
...
@@ -914,13 +914,11 @@ HEADER_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
static
LRESULT
HEADER_InsertItem
A
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
HEADER_InsertItem
T
(
HWND
hwnd
,
INT
nItem
,
LPHDITEMW
phdi
,
BOOL
bUnicode
)
{
HEADER_INFO
*
infoPtr
=
HEADER_GetInfoPtr
(
hwnd
);
HDITEMA
*
phdi
=
(
HDITEMA
*
)
lParam
;
INT
nItem
=
(
INT
)
wParam
;
HEADER_ITEM
*
lpItem
;
INT
len
,
iOrder
;
INT
iOrder
;
UINT
i
;
if
((
phdi
==
NULL
)
||
(
nItem
<
0
))
...
...
@@ -988,28 +986,12 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
phdi
->
mask
&
HDI_WIDTH
)
lpItem
->
cxy
=
phdi
->
cxy
;
if
(
phdi
->
mask
&
HDI_TEXT
)
{
if
(
!
phdi
->
pszText
)
/* null pointer check */
phdi
->
pszText
=
""
;
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKA
)
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
phdi
->
pszText
,
-
1
,
NULL
,
0
);
lpItem
->
pszText
=
Alloc
(
len
*
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
phdi
->
pszText
,
-
1
,
lpItem
->
pszText
,
len
);
}
else
lpItem
->
pszText
=
LPSTR_TEXTCALLBACKW
;
}
if
(
phdi
->
mask
&
HDI_FORMAT
)
lpItem
->
fmt
=
phdi
->
fmt
;
if
(
lpItem
->
fmt
==
0
)
lpItem
->
fmt
=
HDF_LEFT
;
if
(
!
(
lpItem
->
fmt
&
HDF_STRING
)
&&
(
phdi
->
mask
&
HDI_TEXT
))
{
lpItem
->
fmt
|=
HDF_STRING
;
}
if
(
phdi
->
mask
&
HDI_BITMAP
)
lpItem
->
hbm
=
phdi
->
hbm
;
...
...
@@ -1019,118 +1001,20 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
phdi
->
mask
&
HDI_IMAGE
)
lpItem
->
iImage
=
phdi
->
iImage
;
lpItem
->
iOrder
=
iOrder
;
HEADER_SetItemBounds
(
hwnd
);
InvalidateRect
(
hwnd
,
NULL
,
FALSE
);
return
nItem
;
}
static
LRESULT
HEADER_InsertItemW
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HEADER_INFO
*
infoPtr
=
HEADER_GetInfoPtr
(
hwnd
);
HDITEMW
*
phdi
=
(
HDITEMW
*
)
lParam
;
INT
nItem
=
(
INT
)
wParam
;
HEADER_ITEM
*
lpItem
;
INT
len
,
iOrder
;
UINT
i
;
if
((
phdi
==
NULL
)
||
(
nItem
<
0
))
return
-
1
;
if
(
nItem
>
infoPtr
->
uNumItem
)
nItem
=
infoPtr
->
uNumItem
;
iOrder
=
(
phdi
->
mask
&
HDI_ORDER
)
?
phdi
->
iOrder
:
nItem
;
if
(
infoPtr
->
uNumItem
==
0
)
{
infoPtr
->
items
=
Alloc
(
sizeof
(
HEADER_ITEM
));
infoPtr
->
order
=
Alloc
(
sizeof
(
INT
));
infoPtr
->
uNumItem
++
;
}
else
{
HEADER_ITEM
*
oldItems
=
infoPtr
->
items
;
INT
*
oldOrder
=
infoPtr
->
order
;
infoPtr
->
uNumItem
++
;
infoPtr
->
items
=
Alloc
(
sizeof
(
HEADER_ITEM
)
*
infoPtr
->
uNumItem
);
if
(
nItem
==
0
)
{
memcpy
(
&
infoPtr
->
items
[
1
],
&
oldItems
[
0
],
(
infoPtr
->
uNumItem
-
1
)
*
sizeof
(
HEADER_ITEM
));
}
else
{
/* pre insert copy */
if
(
nItem
>
0
)
{
memcpy
(
&
infoPtr
->
items
[
0
],
&
oldItems
[
0
],
nItem
*
sizeof
(
HEADER_ITEM
));
}
/* post insert copy */
if
(
nItem
<
infoPtr
->
uNumItem
-
1
)
{
memcpy
(
&
infoPtr
->
items
[
nItem
+
1
],
&
oldItems
[
nItem
],
(
infoPtr
->
uNumItem
-
nItem
-
1
)
*
sizeof
(
HEADER_ITEM
));
}
}
infoPtr
->
order
=
Alloc
(
infoPtr
->
uNumItem
*
sizeof
(
INT
));
memcpy
(
infoPtr
->
order
,
oldOrder
,
iOrder
*
sizeof
(
INT
));
infoPtr
->
order
[
iOrder
]
=
nItem
;
memcpy
(
&
infoPtr
->
order
[
iOrder
+
1
],
&
oldOrder
[
iOrder
],
(
infoPtr
->
uNumItem
-
iOrder
-
1
)
*
sizeof
(
INT
));
Free
(
oldItems
);
Free
(
oldOrder
);
}
for
(
i
=
0
;
i
<
infoPtr
->
uNumItem
;
i
++
)
if
(
phdi
->
mask
&
HDI_TEXT
)
{
if
(
i
!=
iOrder
&&
infoPtr
->
order
[
i
]
>=
nItem
)
infoPtr
->
order
[
i
]
++
;
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
=
infoPtr
->
order
[
i
];
}
lpItem
=
&
infoPtr
->
items
[
nItem
];
lpItem
->
bDown
=
FALSE
;
if
(
phdi
->
mask
&
HDI_WIDTH
)
lpItem
->
cxy
=
phdi
->
cxy
;
if
(
phdi
->
mask
&
HDI_TEXT
)
{
WCHAR
wide_null_char
=
0
;
if
(
!
phdi
->
pszText
)
/* null pointer check */
phdi
->
pszText
=
&
wide_null_char
;
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
{
len
=
strlenW
(
phdi
->
pszText
);
lpItem
->
pszText
=
Alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
lpItem
->
pszText
,
phdi
->
pszText
);
}
else
lpItem
->
pszText
=
LPSTR_TEXTCALLBACKW
;
}
if
(
phdi
->
mask
&
HDI_FORMAT
)
lpItem
->
fmt
=
phdi
->
fmt
;
if
(
lpItem
->
fmt
==
0
)
lpItem
->
fmt
=
HDF_LEFT
;
if
(
!
(
lpItem
->
fmt
&
HDF_STRING
)
&&
(
phdi
->
mask
&
HDI_TEXT
))
{
lpItem
->
fmt
|=
HDF_STRING
;
}
if
(
phdi
->
mask
&
HDI_BITMAP
)
lpItem
->
hbm
=
phdi
->
hbm
;
if
(
phdi
->
mask
&
HDI_LPARAM
)
lpItem
->
lParam
=
phdi
->
lParam
;
phdi
->
pszText
=
'\0'
;
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
/* covers != TEXTCALLBACKA too */
if
(
bUnicode
)
Str_SetPtrW
(
&
lpItem
->
pszText
,
phdi
->
pszText
);
else
Str_SetPtrAtoW
(
&
lpItem
->
pszText
,
(
LPSTR
)
phdi
->
pszText
);
else
lpItem
->
pszText
=
LPSTR_TEXTCALLBACKW
;
if
(
phdi
->
mask
&
HDI_IMAGE
)
lpItem
->
iImage
=
phdi
->
iImage
;
lpItem
->
fmt
|=
HDF_STRING
;
}
lpItem
->
iOrder
=
iOrder
;
...
...
@@ -1830,10 +1714,8 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return
HEADER_HitTest
(
hwnd
,
wParam
,
lParam
);
case
HDM_INSERTITEMA
:
return
HEADER_InsertItemA
(
hwnd
,
wParam
,
lParam
);
case
HDM_INSERTITEMW
:
return
HEADER_InsertItem
W
(
hwnd
,
wParam
,
lParam
);
return
HEADER_InsertItem
T
(
hwnd
,
(
INT
)
wParam
,
(
LPHDITEMW
)
lParam
,
msg
==
HDM_INSERTITEMW
);
case
HDM_LAYOUT
:
return
HEADER_Layout
(
hwnd
,
wParam
,
lParam
);
...
...
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