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
e3d53b47
Commit
e3d53b47
authored
Nov 15, 2005
by
Raphael Junqueira
Committed by
Alexandre Julliard
Nov 15, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement implement header callback support (HDN_GETDISPINFO notification):
- better factorisation - unicode fixes
parent
dfc83059
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
130 additions
and
8 deletions
+130
-8
header.c
dlls/comctl32/header.c
+130
-8
No files found.
dlls/comctl32/header.c
View file @
e3d53b47
...
...
@@ -601,6 +601,95 @@ HEADER_SendHeaderNotify (HWND hwnd, UINT code, INT iItem, INT mask)
(
WPARAM
)
nmhdr
.
hdr
.
idFrom
,
(
LPARAM
)
&
nmhdr
);
}
/**
* Send Disp Info notification.
* depends on NMHDDISPINFOW having same structure as NMHDDISPINFOA
* (so we handle the two cases only doing a specific cast for pszText).
*
* @param hwnd : hwnd header container handler
* @param mask : notification mask (usually HDI_TEXT or HDI_IMAGE)
* @param pDispInfo : NMHDDISPINFO structure (can be unicode or ansi)
* @param isW : TRUE if dispinfo is Unicode
*/
static
BOOL
HEADER_SendHeaderDispInfoNotify
(
HWND
hwnd
,
INT
iItem
,
INT
mask
,
LPHDITEMW
phdi
,
HEADER_ITEM
*
lpItem
,
BOOL
isW
)
{
HEADER_INFO
*
infoPtr
=
HEADER_GetInfoPtr
(
hwnd
);
BOOL
ret
;
BOOL
convertToAnsi
=
FALSE
;
BOOL
convertToUnicode
=
FALSE
;
BOOL
isUnicodeNotify
=
FALSE
;
NMHDDISPINFOW
dispInfo
;
if
(
mask
&
HDI_TEXT
)
{
convertToAnsi
=
(
isW
&&
infoPtr
->
nNotifyFormat
==
NFR_ANSI
);
convertToUnicode
=
(
!
isW
&&
infoPtr
->
nNotifyFormat
==
NFR_UNICODE
);
}
isUnicodeNotify
=
(
isW
&&
!
convertToAnsi
);
memset
(
&
dispInfo
,
0
,
sizeof
(
NMHDDISPINFOW
));
dispInfo
.
hdr
.
hwndFrom
=
hwnd
;
dispInfo
.
hdr
.
idFrom
=
GetWindowLongPtrW
(
hwnd
,
GWLP_ID
);
if
(
isUnicodeNotify
||
convertToUnicode
)
{
dispInfo
.
hdr
.
code
=
HDN_GETDISPINFOW
;
}
else
{
dispInfo
.
hdr
.
code
=
HDN_GETDISPINFOA
;
}
dispInfo
.
iItem
=
iItem
;
dispInfo
.
mask
=
mask
;
/*
dispInfo.pszText = Alloc(sizeof(WCHAR) * 260);
dispInfo.cchTextMax = 260;
*/
ret
=
(
BOOL
)
SendMessageW
(
infoPtr
->
hwndNotify
,
WM_NOTIFY
,
(
WPARAM
)
dispInfo
.
hdr
.
idFrom
,
(
LPARAM
)
&
dispInfo
);
TRACE
(
"SendMessage returns(mask:0x%x,str:%s,lParam:%p)
\n
"
,
dispInfo
.
mask
,
(
isUnicodeNotify
?
debugstr_w
(
dispInfo
.
pszText
)
:
(
LPSTR
)
dispInfo
.
pszText
),
(
void
*
)
dispInfo
.
lParam
);
if
(
dispInfo
.
mask
&
HDI_DI_SETITEM
)
{
if
(
dispInfo
.
mask
&
HDI_IMAGE
)
{
lpItem
->
iImage
=
dispInfo
.
iImage
;
}
if
(
dispInfo
.
mask
&
HDI_TEXT
)
{
if
(
isUnicodeNotify
||
convertToUnicode
)
Str_SetPtrW
(
&
lpItem
->
pszText
,
(
LPCWSTR
)
dispInfo
.
pszText
);
else
/*if (convertToAnsi || !isW)*/
Str_SetPtrAtoW
(
&
lpItem
->
pszText
,
(
LPCSTR
)
dispInfo
.
pszText
);
}
FIXME
(
"NMHDDISPINFO returns with flags HDI_DI_SETITEM
\n
"
);
}
if
(
NULL
!=
phdi
)
{
if
((
phdi
->
mask
&
mask
)
&
HDI_IMAGE
)
{
phdi
->
iImage
=
dispInfo
.
iImage
;
}
if
((
phdi
->
mask
&
mask
)
&
HDI_TEXT
)
{
if
(
isUnicodeNotify
)
Str_GetPtrW
((
LPCWSTR
)
dispInfo
.
pszText
,
phdi
->
pszText
,
phdi
->
cchTextMax
);
else
if
(
convertToUnicode
)
Str_GetPtrWtoA
((
LPCWSTR
)
dispInfo
.
pszText
,
(
LPSTR
)
phdi
->
pszText
,
phdi
->
cchTextMax
);
else
/*if (!isW) */
Str_GetPtrA
((
LPCSTR
)
dispInfo
.
pszText
,
(
LPSTR
)
phdi
->
pszText
,
phdi
->
cchTextMax
);
}
}
return
ret
;
}
static
BOOL
HEADER_SendClickNotify
(
HWND
hwnd
,
UINT
code
,
INT
iItem
)
...
...
@@ -743,17 +832,24 @@ HEADER_GetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
phdi
->
lParam
=
(
lpItem
!=
NULL
)
?
lpItem
->
lParam
:
0
;
if
(
phdi
->
mask
&
HDI_IMAGE
)
{
phdi
->
iImage
=
(
lpItem
!=
NULL
)
?
lpItem
->
iImage
:
0
;
if
(
lpItem
->
iImage
==
I_IMAGECALLBACK
)
{
HEADER_SendHeaderDispInfoNotify
(
hwnd
,
nItem
,
HDI_IMAGE
,
phdi
,
lpItem
,
bUnicode
);
}
}
if
(
phdi
->
mask
&
HDI_ORDER
)
phdi
->
iOrder
=
(
lpItem
!=
NULL
)
?
lpItem
->
iOrder
:
0
;
if
(
phdi
->
mask
&
HDI_TEXT
)
{
if
(
lpItem
==
NULL
)
*
phdi
->
pszText
=
0
;
if
(
lpItem
==
NULL
)
*
phdi
->
pszText
=
0
;
/* null pointer check */
else
if
(
lpItem
->
pszText
==
LPSTR_TEXTCALLBACKW
)
/* covers == TEXTCALLBACKA too */
phdi
->
pszText
=
LPSTR_TEXTCALLBACKW
;
{
HEADER_SendHeaderDispInfoNotify
(
hwnd
,
nItem
,
HDI_TEXT
,
phdi
,
lpItem
,
bUnicode
);
}
else
{
if
(
bUnicode
)
...
...
@@ -936,20 +1032,33 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
lpItem
->
lParam
=
phdi
->
lParam
;
if
(
phdi
->
mask
&
HDI_IMAGE
)
{
if
(
phdi
->
iImage
!=
I_IMAGECALLBACK
)
{
lpItem
->
iImage
=
phdi
->
iImage
;
}
else
{
lpItem
->
iImage
=
phdi
->
iImage
;
HEADER_SendHeaderDispInfoNotify
(
hwnd
,
nItem
,
HDI_IMAGE
,
NULL
,
lpItem
,
bUnicode
);
}
}
if
(
phdi
->
mask
&
HDI_TEXT
)
{
if
(
!
phdi
->
pszText
)
/* null pointer check */
phdi
->
pszText
=
'\0'
;
if
(
!
phdi
->
pszText
)
phdi
->
pszText
=
'\0'
;
/* null pointer check */
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
;
{
lpItem
->
pszText
=
phdi
->
pszText
;
HEADER_SendHeaderDispInfoNotify
(
hwnd
,
nItem
,
HDI_TEXT
,
NULL
,
lpItem
,
bUnicode
);
}
lpItem
->
fmt
|=
HDF_STRING
;
}
...
...
@@ -1058,7 +1167,17 @@ HEADER_SetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
lpItem
->
cxy
=
phdi
->
cxy
;
if
(
phdi
->
mask
&
HDI_IMAGE
)
{
if
(
phdi
->
iImage
!=
I_IMAGECALLBACK
)
{
lpItem
->
iImage
=
phdi
->
iImage
;
}
else
{
lpItem
->
iImage
=
phdi
->
iImage
;
HEADER_SendHeaderDispInfoNotify
(
hwnd
,
nItem
,
HDI_IMAGE
,
NULL
,
lpItem
,
bUnicode
);
}
}
if
(
phdi
->
mask
&
HDI_TEXT
)
{
...
...
@@ -1078,7 +1197,10 @@ HEADER_SetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
}
}
else
lpItem
->
pszText
=
LPSTR_TEXTCALLBACKW
;
{
lpItem
->
pszText
=
phdi
->
pszText
;
HEADER_SendHeaderDispInfoNotify
(
hwnd
,
nItem
,
HDI_TEXT
,
NULL
,
lpItem
,
bUnicode
);
}
}
if
(
phdi
->
mask
&
HDI_ORDER
)
...
...
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