Commit fcd63df4 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

comctl32/button: Support BS_PUSHLIKE for themed check boxes and radio buttons.

parent ed06aa2f
...@@ -393,11 +393,22 @@ static int get_draw_state(const BUTTON_INFO *infoPtr) ...@@ -393,11 +393,22 @@ static int get_draw_state(const BUTTON_INFO *infoPtr)
{ CBS_CHECKEDNORMAL, CBS_CHECKEDDISABLED, CBS_CHECKEDHOT, CBS_CHECKEDPRESSED, CBS_CHECKEDNORMAL }, { CBS_CHECKEDNORMAL, CBS_CHECKEDDISABLED, CBS_CHECKEDHOT, CBS_CHECKEDPRESSED, CBS_CHECKEDNORMAL },
{ CBS_MIXEDNORMAL, CBS_MIXEDDISABLED, CBS_MIXEDHOT, CBS_MIXEDPRESSED, CBS_MIXEDNORMAL } { CBS_MIXEDNORMAL, CBS_MIXEDDISABLED, CBS_MIXEDHOT, CBS_MIXEDPRESSED, CBS_MIXEDNORMAL }
}; };
static const int pushlike_cb_states[3][DRAW_STATE_COUNT] =
{
{ PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_NORMAL },
{ PBS_PRESSED, PBS_PRESSED, PBS_HOT, PBS_PRESSED, PBS_PRESSED },
{ PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_NORMAL }
};
static const int rb_states[2][DRAW_STATE_COUNT] = static const int rb_states[2][DRAW_STATE_COUNT] =
{ {
{ RBS_UNCHECKEDNORMAL, RBS_UNCHECKEDDISABLED, RBS_UNCHECKEDHOT, RBS_UNCHECKEDPRESSED, RBS_UNCHECKEDNORMAL }, { RBS_UNCHECKEDNORMAL, RBS_UNCHECKEDDISABLED, RBS_UNCHECKEDHOT, RBS_UNCHECKEDPRESSED, RBS_UNCHECKEDNORMAL },
{ RBS_CHECKEDNORMAL, RBS_CHECKEDDISABLED, RBS_CHECKEDHOT, RBS_CHECKEDPRESSED, RBS_CHECKEDNORMAL } { RBS_CHECKEDNORMAL, RBS_CHECKEDDISABLED, RBS_CHECKEDHOT, RBS_CHECKEDPRESSED, RBS_CHECKEDNORMAL }
}; };
static const int pushlike_rb_states[2][DRAW_STATE_COUNT] =
{
{ PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_NORMAL },
{ PBS_PRESSED, PBS_PRESSED, PBS_HOT, PBS_PRESSED, PBS_PRESSED }
};
static const int gb_states[DRAW_STATE_COUNT] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL }; static const int gb_states[DRAW_STATE_COUNT] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL };
LONG style = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); LONG style = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
UINT type = get_button_type(style); UINT type = get_button_type(style);
...@@ -430,10 +441,12 @@ static int get_draw_state(const BUTTON_INFO *infoPtr) ...@@ -430,10 +441,12 @@ static int get_draw_state(const BUTTON_INFO *infoPtr)
case BS_AUTOCHECKBOX: case BS_AUTOCHECKBOX:
case BS_3STATE: case BS_3STATE:
case BS_AUTO3STATE: case BS_AUTO3STATE:
return cb_states[check_state][state]; return style & BS_PUSHLIKE ? pushlike_cb_states[check_state][state]
: cb_states[check_state][state];
case BS_RADIOBUTTON: case BS_RADIOBUTTON:
case BS_AUTORADIOBUTTON: case BS_AUTORADIOBUTTON:
return rb_states[check_state][state]; return style & BS_PUSHLIKE ? pushlike_rb_states[check_state][state]
: rb_states[check_state][state];
case BS_GROUPBOX: case BS_GROUPBOX:
return gb_states[state]; return gb_states[state];
default: default:
...@@ -2763,8 +2776,15 @@ static void CB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in ...@@ -2763,8 +2776,15 @@ static void CB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in
int text_offset; int text_offset;
SIZE box_size; SIZE box_size;
HRGN region; HRGN region;
HRESULT hr;
if (dwStyle & BS_PUSHLIKE)
{
PB_ThemedPaint(theme, infoPtr, hDC, state, dtFlags, focused);
return;
}
HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf); hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
font = CreateFontIndirectW(&lf); font = CreateFontIndirectW(&lf);
if (!font) if (!font)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment