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
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)
...
@@ -1207,11 +1207,9 @@ HEADER_SetBitmapMargin(HWND hwnd, WPARAM wParam)
}
}
static
LRESULT
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
);
HEADER_INFO
*
infoPtr
=
HEADER_GetInfoPtr
(
hwnd
);
HDITEMA
*
phdi
=
(
HDITEMA
*
)
lParam
;
INT
nItem
=
(
INT
)
wParam
;
HEADER_ITEM
*
lpItem
;
HEADER_ITEM
*
lpItem
;
if
(
phdi
==
NULL
)
if
(
phdi
==
NULL
)
...
@@ -1221,7 +1219,8 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -1221,7 +1219,8 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE
(
"[nItem=%d]
\n
"
,
nItem
);
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
;
return
FALSE
;
lpItem
=
&
infoPtr
->
items
[
nItem
];
lpItem
=
&
infoPtr
->
items
[
nItem
];
...
@@ -1234,113 +1233,33 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -1234,113 +1233,33 @@ HEADER_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
phdi
->
mask
&
HDI_LPARAM
)
if
(
phdi
->
mask
&
HDI_LPARAM
)
lpItem
->
lParam
=
phdi
->
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
)
if
(
phdi
->
mask
&
HDI_WIDTH
)
lpItem
->
cxy
=
phdi
->
cxy
;
lpItem
->
cxy
=
phdi
->
cxy
;
if
(
phdi
->
mask
&
HDI_IMAGE
)
if
(
phdi
->
mask
&
HDI_IMAGE
)
lpItem
->
iImage
=
phdi
->
iImage
;
lpItem
->
iImage
=
phdi
->
iImage
;
if
(
phdi
->
mask
&
HDI_ORDER
)
if
(
phdi
->
mask
&
HDI_TEXT
)
{
{
INT
i
,
nMin
,
nMax
;
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
/* covers != TEXTCALLBACKA too */
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
++
)
{
{
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
=
infoPtr
->
order
[
i
];
if
(
lpItem
->
pszText
)
}
{
}
Free
(
lpItem
->
pszText
);
lpItem
->
pszText
=
NULL
;
HEADER_SendHeaderNotify
(
hwnd
,
HDN_ITEMCHANGEDA
,
nItem
,
phdi
->
mask
);
}
if
(
phdi
->
pszText
)
HEADER_SetItemBounds
(
hwnd
);
{
if
(
bUnicode
)
InvalidateRect
(
hwnd
,
NULL
,
FALSE
);
Str_SetPtrW
(
&
lpItem
->
pszText
,
phdi
->
pszText
);
else
return
TRUE
;
Str_SetPtrAtoW
(
&
lpItem
->
pszText
,
(
LPSTR
)
phdi
->
pszText
);
}
}
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
);
}
}
}
else
else
lpItem
->
pszText
=
LPSTR_TEXTCALLBACKW
;
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
)
if
(
phdi
->
mask
&
HDI_ORDER
)
{
{
INT
i
,
nMin
,
nMax
;
INT
i
,
nMin
,
nMax
;
...
@@ -1366,7 +1285,8 @@ HEADER_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -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
);
HEADER_SetItemBounds
(
hwnd
);
...
@@ -1932,10 +1852,8 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
...
@@ -1932,10 +1852,8 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return
HEADER_SetImageList
(
hwnd
,
(
HIMAGELIST
)
lParam
);
return
HEADER_SetImageList
(
hwnd
,
(
HIMAGELIST
)
lParam
);
case
HDM_SETITEMA
:
case
HDM_SETITEMA
:
return
HEADER_SetItemA
(
hwnd
,
wParam
,
lParam
);
case
HDM_SETITEMW
:
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
:
case
HDM_SETORDERARRAY
:
return
HEADER_SetOrderArray
(
hwnd
,
wParam
,
lParam
);
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