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
f21a968d
Commit
f21a968d
authored
Feb 10, 2015
by
Mark Harmstone
Committed by
Alexandre Julliard
Feb 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Draw the focus rect on themed checkboxes.
parent
b8d3f1fe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
7 deletions
+37
-7
theme_button.c
dlls/comctl32/theme_button.c
+37
-7
No files found.
dlls/comctl32/theme_button.c
View file @
f21a968d
...
...
@@ -47,7 +47,7 @@ typedef enum
STATE_DEFAULTED
}
ButtonState
;
typedef
void
(
*
pfThemedPaint
)(
HTHEME
theme
,
HWND
hwnd
,
HDC
hdc
,
ButtonState
drawState
,
UINT
dtFlags
);
typedef
void
(
*
pfThemedPaint
)(
HTHEME
theme
,
HWND
hwnd
,
HDC
hdc
,
ButtonState
drawState
,
UINT
dtFlags
,
BOOL
focused
);
static
UINT
get_drawtext_flags
(
DWORD
style
,
DWORD
ex_style
)
{
...
...
@@ -100,7 +100,7 @@ static inline WCHAR *get_button_text(HWND hwnd)
return
text
;
}
static
void
PB_draw
(
HTHEME
theme
,
HWND
hwnd
,
HDC
hDC
,
ButtonState
drawState
,
UINT
dtFlags
)
static
void
PB_draw
(
HTHEME
theme
,
HWND
hwnd
,
HDC
hDC
,
ButtonState
drawState
,
UINT
dtFlags
,
BOOL
focused
)
{
static
const
int
states
[]
=
{
PBS_NORMAL
,
PBS_DISABLED
,
PBS_HOT
,
PBS_PRESSED
,
PBS_DEFAULTED
};
...
...
@@ -125,7 +125,7 @@ static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
if
(
hPrevFont
)
SelectObject
(
hDC
,
hPrevFont
);
}
static
void
CB_draw
(
HTHEME
theme
,
HWND
hwnd
,
HDC
hDC
,
ButtonState
drawState
,
UINT
dtFlags
)
static
void
CB_draw
(
HTHEME
theme
,
HWND
hwnd
,
HDC
hDC
,
ButtonState
drawState
,
UINT
dtFlags
,
BOOL
focused
)
{
static
const
int
cb_states
[
3
][
5
]
=
{
...
...
@@ -143,8 +143,7 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
static
const
int
cb_size
=
13
;
RECT
bgRect
,
textRect
;
HFONT
font
=
(
HFONT
)
SendMessageW
(
hwnd
,
WM_GETFONT
,
0
,
0
);
HFONT
hPrevFont
=
font
?
SelectObject
(
hDC
,
font
)
:
NULL
;
HFONT
font
,
hPrevFont
=
NULL
;
LRESULT
checkState
=
SendMessageW
(
hwnd
,
BM_GETCHECK
,
0
,
0
);
DWORD
dwStyle
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
int
part
=
((
dwStyle
&
BUTTON_TYPE
)
==
BS_RADIOBUTTON
)
||
((
dwStyle
&
BUTTON_TYPE
)
==
BS_AUTORADIOBUTTON
)
...
...
@@ -154,6 +153,21 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
?
cb_states
[
checkState
][
drawState
]
:
rb_states
[
checkState
][
drawState
];
WCHAR
*
text
=
get_button_text
(
hwnd
);
LOGFONTW
lf
;
BOOL
created_font
=
FALSE
;
HRESULT
hr
=
GetThemeFont
(
theme
,
hDC
,
part
,
state
,
TMT_FONT
,
&
lf
);
if
(
SUCCEEDED
(
hr
))
{
font
=
CreateFontIndirectW
(
&
lf
);
if
(
!
font
)
TRACE
(
"Failed to create font
\n
"
);
else
{
TRACE
(
"font = %s
\n
"
,
debugstr_w
(
lf
.
lfFaceName
));
hPrevFont
=
SelectObject
(
hDC
,
font
);
created_font
=
TRUE
;
}
}
else
font
=
(
HFONT
)
SendMessageW
(
hwnd
,
WM_GETFONT
,
0
,
0
);
GetClientRect
(
hwnd
,
&
bgRect
);
GetThemeBackgroundContentRect
(
theme
,
hDC
,
part
,
state
,
&
bgRect
,
&
textRect
);
...
...
@@ -172,13 +186,29 @@ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UIN
if
(
text
)
{
DrawThemeText
(
theme
,
hDC
,
part
,
state
,
text
,
lstrlenW
(
text
),
dtFlags
,
0
,
&
textRect
);
if
(
focused
)
{
RECT
focusRect
;
focusRect
=
textRect
;
DrawTextW
(
hDC
,
text
,
lstrlenW
(
text
),
&
focusRect
,
dtFlags
|
DT_CALCRECT
);
if
(
focusRect
.
right
<
textRect
.
right
)
focusRect
.
right
++
;
focusRect
.
bottom
=
textRect
.
bottom
;
DrawFocusRect
(
hDC
,
&
focusRect
);
}
HeapFree
(
GetProcessHeap
(),
0
,
text
);
}
if
(
created_font
)
DeleteObject
(
font
);
if
(
hPrevFont
)
SelectObject
(
hDC
,
hPrevFont
);
}
static
void
GB_draw
(
HTHEME
theme
,
HWND
hwnd
,
HDC
hDC
,
ButtonState
drawState
,
UINT
dtFlags
)
static
void
GB_draw
(
HTHEME
theme
,
HWND
hwnd
,
HDC
hDC
,
ButtonState
drawState
,
UINT
dtFlags
,
BOOL
focused
)
{
static
const
int
states
[]
=
{
GBS_NORMAL
,
GBS_DISABLED
,
GBS_NORMAL
,
GBS_NORMAL
,
GBS_NORMAL
};
...
...
@@ -281,7 +311,7 @@ static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC)
else
drawState
=
STATE_DISABLED
;
hDC
=
hParamDC
?
hParamDC
:
BeginPaint
(
hwnd
,
&
ps
);
paint
(
theme
,
hwnd
,
hDC
,
drawState
,
dtFlags
);
paint
(
theme
,
hwnd
,
hDC
,
drawState
,
dtFlags
,
state
&
BST_FOCUS
);
if
(
!
hParamDC
)
EndPaint
(
hwnd
,
&
ps
);
return
TRUE
;
}
...
...
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