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
841d41bd
Commit
841d41bd
authored
Oct 19, 2016
by
Huw Davies
Committed by
Alexandre Julliard
Oct 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Add support for the sort arrows.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
23dbdab4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
19 deletions
+79
-19
header.c
dlls/comctl32/header.c
+79
-19
No files found.
dlls/comctl32/header.c
View file @
841d41bd
...
...
@@ -326,6 +326,48 @@ HEADER_DrawItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *
}
}
/* Create a region for the sort arrow with its bounding rect's top-left
co-ord x,y and its height h. */
static
HRGN
create_sort_arrow
(
INT
x
,
INT
y
,
INT
h
,
BOOL
is_up
)
{
char
buffer
[
256
];
RGNDATA
*
data
=
(
RGNDATA
*
)
buffer
;
DWORD
size
=
FIELD_OFFSET
(
RGNDATA
,
Buffer
[
h
*
sizeof
(
RECT
)]);
INT
i
,
yinc
=
1
;
HRGN
rgn
;
if
(
size
>
sizeof
(
buffer
))
{
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
data
)
return
NULL
;
}
data
->
rdh
.
dwSize
=
sizeof
(
data
->
rdh
);
data
->
rdh
.
iType
=
RDH_RECTANGLES
;
data
->
rdh
.
nCount
=
0
;
data
->
rdh
.
nRgnSize
=
h
*
sizeof
(
RECT
);
if
(
!
is_up
)
{
y
+=
h
-
1
;
yinc
=
-
1
;
}
x
+=
h
-
1
;
/* set x to the centre */
for
(
i
=
0
;
i
<
h
;
i
++
,
y
+=
yinc
)
{
RECT
*
rect
=
(
RECT
*
)
data
->
Buffer
+
data
->
rdh
.
nCount
;
rect
->
left
=
x
-
i
;
rect
->
top
=
y
;
rect
->
right
=
x
+
i
+
1
;
rect
->
bottom
=
y
+
1
;
data
->
rdh
.
nCount
++
;
}
rgn
=
ExtCreateRegion
(
NULL
,
size
,
data
);
if
(
data
!=
(
RGNDATA
*
)
buffer
)
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
rgn
;
}
static
INT
HEADER_DrawItem
(
HEADER_INFO
*
infoPtr
,
HDC
hdc
,
INT
iItem
,
BOOL
bHotTrack
,
LRESULT
lCDFlags
)
{
...
...
@@ -413,10 +455,11 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
INT
cx
,
tx
,
ix
,
bx
;
UINT
cw
,
tw
,
iw
,
bw
;
INT
img_cx
,
img_cy
;
INT
sort_w
,
sort_x
,
sort_h
;
BITMAP
bmp
;
HEADER_PrepareCallbackItems
(
infoPtr
,
iItem
,
HDI_TEXT
|
HDI_IMAGE
);
cw
=
iw
=
bw
=
0
;
cw
=
iw
=
bw
=
sort_w
=
sort_h
=
0
;
rw
=
r
.
right
-
r
.
left
;
rh
=
r
.
bottom
-
r
.
top
;
...
...
@@ -435,23 +478,28 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
cw
=
textRect
.
right
-
textRect
.
left
+
2
*
infoPtr
->
iMargin
;
}
if
((
phdi
->
fmt
&
HDF_IMAGE
)
&&
ImageList_GetIconSize
(
infoPtr
->
himl
,
&
img_cx
,
&
img_cy
))
{
iw
=
img_cx
+
2
*
infoPtr
->
iMargin
;
x
=
&
ix
;
w
=
&
iw
;
}
if
((
phdi
->
fmt
&
HDF_BITMAP
)
&&
(
phdi
->
hbm
))
{
GetObjectW
(
phdi
->
hbm
,
sizeof
(
BITMAP
),
&
bmp
);
bw
=
bmp
.
bmWidth
+
2
*
infoPtr
->
iMargin
;
if
(
!
iw
)
{
x
=
&
bx
;
w
=
&
bw
;
}
}
if
(
phdi
->
fmt
&
(
HDF_SORTUP
|
HDF_SORTDOWN
))
{
sort_h
=
MulDiv
(
infoPtr
->
nHeight
-
VERT_BORDER
,
4
,
13
);
sort_w
=
2
*
sort_h
-
1
+
infoPtr
->
iMargin
*
2
;
cw
+=
sort_w
;
}
else
{
/* sort arrows take precedent over images/bitmaps */
if
((
phdi
->
fmt
&
HDF_IMAGE
)
&&
ImageList_GetIconSize
(
infoPtr
->
himl
,
&
img_cx
,
&
img_cy
))
{
iw
=
img_cx
+
2
*
infoPtr
->
iMargin
;
x
=
&
ix
;
w
=
&
iw
;
}
if
(
bw
||
iw
)
cw
+=
*
w
;
if
((
phdi
->
fmt
&
HDF_BITMAP
)
&&
(
phdi
->
hbm
))
{
GetObjectW
(
phdi
->
hbm
,
sizeof
(
BITMAP
),
&
bmp
);
bw
=
bmp
.
bmWidth
+
2
*
infoPtr
->
iMargin
;
if
(
!
iw
)
{
x
=
&
bx
;
w
=
&
bw
;
}
}
if
(
bw
||
iw
)
cw
+=
*
w
;
}
/* align cx using the unclipped cw */
if
((
phdi
->
fmt
&
HDF_JUSTIFYMASK
)
==
HDF_LEFT
)
...
...
@@ -470,7 +518,10 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
tx
=
cx
+
infoPtr
->
iMargin
;
/* since cw might have changed we have to recalculate tw */
tw
=
cw
-
infoPtr
->
iMargin
*
2
;
tw
-=
sort_w
;
sort_x
=
cx
+
tw
+
infoPtr
->
iMargin
*
3
;
if
(
iw
||
bw
)
{
tw
-=
*
w
;
if
(
phdi
->
fmt
&
HDF_BITMAP_ON_RIGHT
)
{
...
...
@@ -494,11 +545,20 @@ HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESU
bx
=
cx
+
cw
+
infoPtr
->
iMargin
;
}
if
(
iw
||
bw
)
{
if
(
sort_w
||
iw
||
bw
)
{
HDC
hClipDC
=
GetDC
(
infoPtr
->
hwndSelf
);
HRGN
hClipRgn
=
CreateRectRgn
(
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
);
SelectClipRgn
(
hClipDC
,
hClipRgn
);
if
(
sort_w
)
{
HRGN
arrow
=
create_sort_arrow
(
sort_x
,
r
.
top
+
(
rh
-
sort_h
)
/
2
,
sort_h
,
phdi
->
fmt
&
HDF_SORTUP
);
if
(
arrow
)
{
FillRgn
(
hClipDC
,
arrow
,
GetSysColorBrush
(
COLOR_GRAYTEXT
)
);
DeleteObject
(
arrow
);
}
}
if
(
bw
)
{
HDC
hdcBitmap
=
CreateCompatibleDC
(
hClipDC
);
SelectObject
(
hdcBitmap
,
phdi
->
hbm
);
...
...
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