Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
05905cc5
Commit
05905cc5
authored
Oct 27, 2005
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Oct 27, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unify HEADER_SetItem[A/W] into one function.
parent
56aa241b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
103 deletions
+21
-103
header.c
dlls/comctl32/header.c
+21
-103
No files found.
dlls/comctl32/header.c
View file @
05905cc5
...
...
@@ -1207,11 +1207,9 @@ HEADER_SetBitmapMargin(HWND hwnd, WPARAM wParam)
}
static
LRESULT
HEADER_SetItem
A
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
HEADER_SetItem
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
;
if
(
phdi
==
NULL
)
...
...
@@ -1221,7 +1219,8 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE
(
"[nItem=%d]
\n
"
,
nItem
);
if
(
HEADER_SendHeaderNotify
(
hwnd
,
HDN_ITEMCHANGINGA
,
nItem
,
phdi
->
mask
))
if
(
HEADER_SendHeaderNotify
(
hwnd
,
bUnicode
?
HDN_ITEMCHANGINGW
:
HDN_ITEMCHANGINGA
,
nItem
,
phdi
->
mask
))
return
FALSE
;
lpItem
=
&
infoPtr
->
items
[
nItem
];
...
...
@@ -1234,113 +1233,33 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
phdi
->
mask
&
HDI_LPARAM
)
lpItem
->
lParam
=
phdi
->
lParam
;
if
(
phdi
->
mask
&
HDI_TEXT
)
{
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKA
)
{
if
(
lpItem
->
pszText
)
{
Free
(
lpItem
->
pszText
);
lpItem
->
pszText
=
NULL
;
}
if
(
phdi
->
pszText
)
{
INT
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_WIDTH
)
lpItem
->
cxy
=
phdi
->
cxy
;
if
(
phdi
->
mask
&
HDI_IMAGE
)
lpItem
->
iImage
=
phdi
->
iImage
;
if
(
phdi
->
mask
&
HDI_ORDER
)
{
INT
i
,
nMin
,
nMax
;
if
(
lpItem
->
iOrder
<
phdi
->
iOrder
)
{
memmove
(
&
infoPtr
->
order
[
lpItem
->
iOrder
],
&
infoPtr
->
order
[
lpItem
->
iOrder
+
1
],
(
phdi
->
iOrder
-
lpItem
->
iOrder
)
*
sizeof
(
INT
));
}
if
(
phdi
->
iOrder
<
lpItem
->
iOrder
)
{
memmove
(
&
infoPtr
->
order
[
phdi
->
iOrder
+
1
],
&
infoPtr
->
order
[
phdi
->
iOrder
],
(
lpItem
->
iOrder
-
phdi
->
iOrder
)
*
sizeof
(
INT
));
}
infoPtr
->
order
[
phdi
->
iOrder
]
=
nItem
;
nMin
=
min
(
lpItem
->
iOrder
,
phdi
->
iOrder
);
nMax
=
max
(
lpItem
->
iOrder
,
phdi
->
iOrder
);
for
(
i
=
nMin
;
i
<=
nMax
;
i
++
)
if
(
phdi
->
mask
&
HDI_TEXT
)
{
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
/* covers != TEXTCALLBACKA too */
{
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
=
infoPtr
->
order
[
i
];
}
}
HEADER_SendHeaderNotify
(
hwnd
,
HDN_ITEMCHANGEDA
,
nItem
,
phdi
->
mask
);
HEADER_SetItemBounds
(
hwnd
);
InvalidateRect
(
hwnd
,
NULL
,
FALSE
);
return
TRUE
;
}
static
LRESULT
HEADER_SetItemW
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HEADER_INFO
*
infoPtr
=
HEADER_GetInfoPtr
(
hwnd
);
HDITEMW
*
phdi
=
(
HDITEMW
*
)
lParam
;
INT
nItem
=
(
INT
)
wParam
;
HEADER_ITEM
*
lpItem
;
if
(
phdi
==
NULL
)
return
FALSE
;
if
((
nItem
<
0
)
||
(
nItem
>=
(
INT
)
infoPtr
->
uNumItem
))
return
FALSE
;
TRACE
(
"[nItem=%d]
\n
"
,
nItem
);
if
(
HEADER_SendHeaderNotify
(
hwnd
,
HDN_ITEMCHANGINGW
,
nItem
,
phdi
->
mask
))
return
FALSE
;
lpItem
=
&
infoPtr
->
items
[
nItem
];
if
(
phdi
->
mask
&
HDI_BITMAP
)
lpItem
->
hbm
=
phdi
->
hbm
;
if
(
phdi
->
mask
&
HDI_FORMAT
)
lpItem
->
fmt
=
phdi
->
fmt
;
if
(
phdi
->
mask
&
HDI_LPARAM
)
lpItem
->
lParam
=
phdi
->
lParam
;
if
(
phdi
->
mask
&
HDI_TEXT
)
{
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
{
if
(
lpItem
->
pszText
)
{
Free
(
lpItem
->
pszText
);
lpItem
->
pszText
=
NULL
;
}
if
(
phdi
->
pszText
)
{
INT
len
=
strlenW
(
phdi
->
pszText
);
lpItem
->
pszText
=
Alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
lpItem
->
pszText
,
phdi
->
pszText
);
}
if
(
lpItem
->
pszText
)
{
Free
(
lpItem
->
pszText
);
lpItem
->
pszText
=
NULL
;
}
if
(
phdi
->
pszText
)
{
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_WIDTH
)
lpItem
->
cxy
=
phdi
->
cxy
;
if
(
phdi
->
mask
&
HDI_IMAGE
)
lpItem
->
iImage
=
phdi
->
iImage
;
if
(
phdi
->
mask
&
HDI_ORDER
)
{
INT
i
,
nMin
,
nMax
;
...
...
@@ -1366,7 +1285,8 @@ HEADER_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
}
}
HEADER_SendHeaderNotify
(
hwnd
,
HDN_ITEMCHANGEDW
,
nItem
,
phdi
->
mask
);
HEADER_SendHeaderNotify
(
hwnd
,
bUnicode
?
HDN_ITEMCHANGEDW
:
HDN_ITEMCHANGEDA
,
nItem
,
phdi
->
mask
);
HEADER_SetItemBounds
(
hwnd
);
...
...
@@ -1932,10 +1852,8 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return
HEADER_SetImageList
(
hwnd
,
(
HIMAGELIST
)
lParam
);
case
HDM_SETITEMA
:
return
HEADER_SetItemA
(
hwnd
,
wParam
,
lParam
);
case
HDM_SETITEMW
:
return
HEADER_SetItem
W
(
hwnd
,
wParam
,
lParam
);
return
HEADER_SetItem
T
(
hwnd
,
(
INT
)
wParam
,
(
LPHDITEMW
)
lParam
,
msg
==
HDM_SETITEMW
);
case
HDM_SETORDERARRAY
:
return
HEADER_SetOrderArray
(
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