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
d9ebf196
Commit
d9ebf196
authored
Sep 06, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 08, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/header: Implement HDS_NOSIZING style with tests.
parent
ecda6af3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
5 deletions
+87
-5
header.c
dlls/comctl32/header.c
+12
-5
header.c
dlls/comctl32/tests/header.c
+75
-0
No files found.
dlls/comctl32/header.c
View file @
d9ebf196
...
...
@@ -218,6 +218,14 @@ HEADER_PrevItem(const HEADER_INFO *infoPtr, INT iItem)
return
HEADER_OrderToIndex
(
infoPtr
,
HEADER_IndexToOrder
(
infoPtr
,
iItem
)
-
1
);
}
/* TRUE when item is not resizable with dividers,
note that valid index should be supplied */
static
inline
BOOL
HEADER_IsItemFixed
(
const
HEADER_INFO
*
infoPtr
,
INT
iItem
)
{
return
(
infoPtr
->
dwStyle
&
HDS_NOSIZING
)
||
(
infoPtr
->
items
[
iItem
].
fmt
&
HDF_FIXEDWIDTH
);
}
static
void
HEADER_SetItemBounds
(
HEADER_INFO
*
infoPtr
)
{
...
...
@@ -624,7 +632,7 @@ HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFl
rcTest
=
rect
;
rcTest
.
right
=
rcTest
.
left
+
DIVIDER_WIDTH
;
if
(
PtInRect
(
&
rcTest
,
*
lpPt
))
{
if
(
infoPtr
->
items
[
HEADER_PrevItem
(
infoPtr
,
iCount
)].
fmt
&
HDF_FIXEDWIDTH
)
if
(
HEADER_IsItemFixed
(
infoPtr
,
HEADER_PrevItem
(
infoPtr
,
iCount
))
)
{
*
pFlags
|=
HHT_ONHEADER
;
*
pItem
=
iCount
;
...
...
@@ -647,8 +655,7 @@ HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFl
}
rcTest
=
rect
;
rcTest
.
left
=
rcTest
.
right
-
DIVIDER_WIDTH
;
if
(
!
(
infoPtr
->
items
[
iCount
].
fmt
&
HDF_FIXEDWIDTH
)
&&
PtInRect
(
&
rcTest
,
*
lpPt
))
if
(
!
HEADER_IsItemFixed
(
infoPtr
,
iCount
)
&&
PtInRect
(
&
rcTest
,
*
lpPt
))
{
*
pFlags
|=
HHT_ONDIVIDER
;
*
pItem
=
iCount
;
...
...
@@ -664,7 +671,7 @@ HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFl
}
/* check for last divider part (on nowhere) */
if
(
!
(
infoPtr
->
items
[
infoPtr
->
uNumItem
-
1
].
fmt
&
HDF_FIXEDWIDTH
))
if
(
!
HEADER_IsItemFixed
(
infoPtr
,
infoPtr
->
uNumItem
-
1
))
{
rect
=
infoPtr
->
items
[
infoPtr
->
uNumItem
-
1
].
rect
;
rect
.
left
=
rect
.
right
;
...
...
@@ -678,7 +685,7 @@ HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFl
}
else
{
*
pFlags
|=
HHT_ONDIVIDER
;
*
pItem
=
infoPtr
->
uNumItem
-
1
;
*
pItem
=
infoPtr
->
uNumItem
-
1
;
TRACE
(
"ON DIVIDER %d
\n
"
,
*
pItem
);
return
;
}
...
...
dlls/comctl32/tests/header.c
View file @
d9ebf196
...
...
@@ -1264,6 +1264,80 @@ static void test_hdf_fixedwidth(HWND hParent)
DestroyWindow
(
hChild
);
}
static
void
test_hds_nosizing
(
HWND
hParent
)
{
HWND
hChild
;
HDITEM
hdItem
;
DWORD
ret
;
RECT
rect
;
HDHITTESTINFO
ht
;
hChild
=
create_custom_header_control
(
hParent
,
FALSE
);
hdItem
.
mask
=
HDI_WIDTH
;
hdItem
.
cxy
=
80
;
ret
=
SendMessage
(
hChild
,
HDM_INSERTITEM
,
0
,
(
LPARAM
)
&
hdItem
);
expect
(
0
,
ret
);
/* HDS_NOSIZING only blocks hittesting */
ret
=
GetWindowLong
(
hChild
,
GWL_STYLE
);
SetWindowLong
(
hChild
,
GWL_STYLE
,
ret
|
HDS_NOSIZING
);
/* try to change width with mouse gestures */
rect
.
right
=
rect
.
bottom
=
0
;
SendMessage
(
hChild
,
HDM_GETITEMRECT
,
0
,
(
LPARAM
)
&
rect
);
ok
(
rect
.
right
!=
0
,
"Expected not zero width
\n
"
);
ok
(
rect
.
bottom
!=
0
,
"Expected not zero height
\n
"
);
SendMessage
(
hChild
,
WM_LBUTTONDOWN
,
0
,
MAKELPARAM
(
rect
.
right
,
rect
.
bottom
/
2
));
SendMessage
(
hChild
,
WM_MOUSEMOVE
,
0
,
MAKELPARAM
(
rect
.
right
+
20
,
rect
.
bottom
/
2
));
SendMessage
(
hChild
,
WM_LBUTTONUP
,
0
,
MAKELPARAM
(
rect
.
right
+
20
,
rect
.
bottom
/
2
));
SendMessage
(
hChild
,
HDM_GETITEMRECT
,
0
,
(
LPARAM
)
&
rect
);
if
(
hdItem
.
cxy
!=
rect
.
right
)
{
win_skip
(
"HDS_NOSIZING style not supported
\n
"
);
DestroyWindow
(
hChild
);
return
;
}
/* this style doesn't set HDF_FIXEDWIDTH for items */
hdItem
.
mask
=
HDI_FORMAT
;
ret
=
SendMessage
(
hChild
,
HDM_GETITEM
,
0
,
(
LPARAM
)
&
hdItem
);
expect
(
TRUE
,
ret
);
ok
(
!
(
hdItem
.
fmt
&
HDF_FIXEDWIDTH
),
"Unexpected HDF_FIXEDWIDTH
\n
"
);
/* try to adjust with message */
hdItem
.
mask
=
HDI_WIDTH
;
hdItem
.
cxy
=
90
;
ret
=
SendMessage
(
hChild
,
HDM_SETITEM
,
0
,
(
LPARAM
)
&
hdItem
);
expect
(
TRUE
,
ret
);
rect
.
right
=
0
;
SendMessage
(
hChild
,
HDM_GETITEMRECT
,
0
,
(
LPARAM
)
&
rect
);
expect
(
90
,
rect
.
right
);
/* hittesting doesn't report ondivider flags for HDS_NOSIZING */
ht
.
pt
.
x
=
rect
.
right
-
1
;
ht
.
pt
.
y
=
rect
.
bottom
/
2
;
SendMessage
(
hChild
,
HDM_HITTEST
,
0
,
(
LPARAM
)
&
ht
);
expect
(
HHT_ONHEADER
,
ht
.
flags
);
/* try to adjust with message */
ret
=
GetWindowLong
(
hChild
,
GWL_STYLE
);
SetWindowLong
(
hChild
,
GWL_STYLE
,
ret
&
~
HDS_NOSIZING
);
ht
.
pt
.
x
=
90
;
ht
.
pt
.
y
=
rect
.
bottom
/
2
;
SendMessage
(
hChild
,
HDM_HITTEST
,
0
,
(
LPARAM
)
&
ht
);
expect
(
HHT_ONDIVIDER
,
ht
.
flags
);
DestroyWindow
(
hChild
);
}
#define TEST_NMCUSTOMDRAW(draw_stage, item_spec, lparam, _left, _top, _right, _bottom) \
ok(nm->dwDrawStage == draw_stage, "Invalid dwDrawStage %d vs %d\n", draw_stage, nm->dwDrawStage); \
if (item_spec != -1) \
...
...
@@ -1660,6 +1734,7 @@ START_TEST(header)
/* comctl32 version 6 tests start here */
test_hdf_fixedwidth
(
parent_hwnd
);
test_hds_nosizing
(
parent_hwnd
);
unload_v6_module
(
ctx_cookie
);
...
...
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