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
3eccdfcc
Commit
3eccdfcc
authored
May 16, 2006
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
May 16, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: header: Automatically set some format fields.
parent
bc83ae9f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
header.c
dlls/comctl32/header.c
+11
-0
header.c
dlls/comctl32/tests/header.c
+65
-0
No files found.
dlls/comctl32/header.c
View file @
3eccdfcc
...
@@ -1156,8 +1156,19 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
...
@@ -1156,8 +1156,19 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
ZeroMemory
(
lpItem
,
sizeof
(
HEADER_ITEM
));
ZeroMemory
(
lpItem
,
sizeof
(
HEADER_ITEM
));
HEADER_StoreHDItemInHeader
(
lpItem
,
phdi
,
bUnicode
);
HEADER_StoreHDItemInHeader
(
lpItem
,
phdi
,
bUnicode
);
/* set automatically some format bits */
if
(
phdi
->
mask
&
HDI_TEXT
)
if
(
phdi
->
mask
&
HDI_TEXT
)
lpItem
->
fmt
|=
HDF_STRING
;
lpItem
->
fmt
|=
HDF_STRING
;
else
lpItem
->
fmt
&=
~
HDF_STRING
;
if
(
lpItem
->
hbm
!=
NULL
)
lpItem
->
fmt
|=
HDF_BITMAP
;
else
lpItem
->
fmt
&=
~
HDF_BITMAP
;
if
(
phdi
->
mask
&
HDI_IMAGE
)
lpItem
->
fmt
|=
HDF_IMAGE
;
lpItem
->
iOrder
=
iOrder
;
lpItem
->
iOrder
=
iOrder
;
...
...
dlls/comctl32/tests/header.c
View file @
3eccdfcc
...
@@ -130,6 +130,15 @@ static LONG getItem(HWND hdex, int idx, LPSTR textBuffer)
...
@@ -130,6 +130,15 @@ static LONG getItem(HWND hdex, int idx, LPSTR textBuffer)
return
(
LONG
)
SendMessage
(
hdex
,
HDM_GETITEMA
,
(
WPARAM
)
idx
,
(
LPARAM
)
&
hdItem
);
return
(
LONG
)
SendMessage
(
hdex
,
HDM_GETITEMA
,
(
WPARAM
)
idx
,
(
LPARAM
)
&
hdItem
);
}
}
static
void
addReadDelItem
(
HWND
hdex
,
HDITEMA
*
phdiCreate
,
int
maskRead
,
HDITEMA
*
phdiRead
)
{
ok
(
SendMessage
(
hdex
,
HDM_INSERTITEMA
,
(
WPARAM
)
0
,
(
LPARAM
)
phdiCreate
)
!=-
1
,
"Adding item failed
\n
"
);
ZeroMemory
(
phdiRead
,
sizeof
(
HDITEMA
));
phdiRead
->
mask
=
maskRead
;
ok
(
SendMessage
(
hdex
,
HDM_GETITEMA
,
(
WPARAM
)
0
,
(
LPARAM
)
phdiRead
)
!=
0
,
"Getting item data failed
\n
"
);
ok
(
SendMessage
(
hdex
,
HDM_DELETEITEM
,
(
WPARAM
)
0
,
(
LPARAM
)
0
)
!=
0
,
"Deleteing item failed
\n
"
);
}
static
HWND
create_header_control
(
void
)
static
HWND
create_header_control
(
void
)
{
{
HWND
handle
;
HWND
handle
;
...
@@ -207,6 +216,59 @@ static const WCHAR pszUniTestW[] = {'T','S','T',0};
...
@@ -207,6 +216,59 @@ static const WCHAR pszUniTestW[] = {'T','S','T',0};
ok(res == i, "Got Item Count as %ld\n", res);\
ok(res == i, "Got Item Count as %ld\n", res);\
}
}
static
void
check_auto_format
(
void
)
{
HDITEMA
hdiCreate
;
HDITEMA
hdiRead
;
ZeroMemory
(
&
hdiCreate
,
sizeof
(
HDITEMA
));
/* Windows implicitly sets some format bits in INSERTITEM */
/* HDF_STRING is automaticaly set and cleared for no text */
hdiCreate
.
mask
=
HDI_TEXT
|
HDI_WIDTH
|
HDI_FORMAT
;
hdiCreate
.
pszText
=
"Test"
;
hdiCreate
.
cxy
=
100
;
hdiCreate
.
fmt
=
HDF_CENTER
;
addReadDelItem
(
hWndHeader
,
&
hdiCreate
,
HDI_FORMAT
,
&
hdiRead
);
ok
(
hdiRead
.
fmt
==
(
HDF_STRING
|
HDF_CENTER
),
"HDF_STRING not set automatically (fmt=%x)
\n
"
,
hdiRead
.
fmt
);
hdiCreate
.
mask
=
HDI_WIDTH
|
HDI_FORMAT
;
hdiCreate
.
pszText
=
"Test"
;
hdiCreate
.
fmt
=
HDF_CENTER
|
HDF_STRING
;
addReadDelItem
(
hWndHeader
,
&
hdiCreate
,
HDI_FORMAT
,
&
hdiRead
);
ok
(
hdiRead
.
fmt
==
(
HDF_CENTER
),
"HDF_STRING should be automatically cleared (fmt=%x)
\n
"
,
hdiRead
.
fmt
);
/* HDF_BITMAP is automatically set and cleared for a NULL bitmap or no bitmap */
hdiCreate
.
mask
=
HDI_BITMAP
|
HDI_WIDTH
|
HDI_FORMAT
;
hdiCreate
.
hbm
=
CreateBitmap
(
16
,
16
,
1
,
8
,
NULL
);
hdiCreate
.
fmt
=
HDF_CENTER
;
addReadDelItem
(
hWndHeader
,
&
hdiCreate
,
HDI_FORMAT
,
&
hdiRead
);
ok
(
hdiRead
.
fmt
==
(
HDF_BITMAP
|
HDF_CENTER
),
"HDF_BITMAP not set automatically (fmt=%x)
\n
"
,
hdiRead
.
fmt
);
DeleteObject
(
hdiCreate
.
hbm
);
hdiCreate
.
hbm
=
NULL
;
hdiCreate
.
fmt
=
HDF_CENTER
|
HDF_BITMAP
;
addReadDelItem
(
hWndHeader
,
&
hdiCreate
,
HDI_FORMAT
,
&
hdiRead
);
ok
(
hdiRead
.
fmt
==
HDF_CENTER
,
"HDF_BITMAP not cleared automatically for NULL bitmap (fmt=%x)
\n
"
,
hdiRead
.
fmt
);
hdiCreate
.
mask
=
HDI_WIDTH
|
HDI_FORMAT
;
hdiCreate
.
fmt
=
HDF_CENTER
|
HDF_BITMAP
;
addReadDelItem
(
hWndHeader
,
&
hdiCreate
,
HDI_FORMAT
,
&
hdiRead
);
ok
(
hdiRead
.
fmt
==
HDF_CENTER
,
"HDF_BITMAP not cleared automatically for no bitmap (fmt=%x)
\n
"
,
hdiRead
.
fmt
);
/* HDF_IMAGE is automatically set but not cleared */
hdiCreate
.
mask
=
HDI_IMAGE
|
HDI_WIDTH
|
HDI_FORMAT
;
hdiCreate
.
iImage
=
17
;
addReadDelItem
(
hWndHeader
,
&
hdiCreate
,
HDI_FORMAT
,
&
hdiRead
);
ok
(
hdiRead
.
fmt
==
(
HDF_IMAGE
|
HDF_CENTER
),
"HDF_IMAGE not set automatically (fmt=%x)
\n
"
,
hdiRead
.
fmt
);
hdiCreate
.
mask
=
HDI_WIDTH
|
HDI_FORMAT
;
hdiCreate
.
fmt
=
HDF_CENTER
|
HDF_IMAGE
;
hdiCreate
.
iImage
=
0
;
addReadDelItem
(
hWndHeader
,
&
hdiCreate
,
HDI_FORMAT
,
&
hdiRead
);
ok
(
hdiRead
.
fmt
==
(
HDF_CENTER
|
HDF_IMAGE
),
"HDF_IMAGE shouldn't be cleared automatically (fmt=%x)
\n
"
,
hdiRead
.
fmt
);
}
static
void
test_header_control
(
void
)
static
void
test_header_control
(
void
)
{
{
LONG
res
;
LONG
res
;
...
@@ -278,6 +340,9 @@ static void test_header_control (void)
...
@@ -278,6 +340,9 @@ static void test_header_control (void)
/* unexpected notifies cleared by notifies_received in setItem */
/* unexpected notifies cleared by notifies_received in setItem */
delItem
(
hWndHeader
,
0
);
delItem
(
hWndHeader
,
0
);
check_auto_format
();
TEST_GET_ITEMCOUNT
(
6
);
res
=
delItem
(
hWndHeader
,
5
);
res
=
delItem
(
hWndHeader
,
5
);
ok
(
res
==
1
,
"Deleting Out of Range item should fail with 1 (%ld)
\n
"
,
res
);
ok
(
res
==
1
,
"Deleting Out of Range item should fail with 1 (%ld)
\n
"
,
res
);
res
=
delItem
(
hWndHeader
,
-
2
);
res
=
delItem
(
hWndHeader
,
-
2
);
...
...
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