FIX: focus state of CheckBox

Change-Id: Iceac4b9877a07e4517250255203c2e0ecdbc34ac
This commit is contained in:
chunmao.guo 2022-07-29 13:29:09 +08:00 committed by Lane.Wei
parent ec59446e44
commit 807cc2236d
7 changed files with 38 additions and 16 deletions

View file

@ -4,12 +4,15 @@
CheckBox::CheckBox(wxWindow* parent)
: wxBitmapToggleButton(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE)
, m_on(this, "check_on", 16)
, m_half(this, "check_half", 16)
, m_off(this, "check_off", 16)
, m_on_disabled(this, "check_on_disabled", 16)
, m_half_disabled(this, "check_half_disabled", 16)
, m_off_disabled(this, "check_off_disabled", 16)
, m_on(this, "check_on", 18)
, m_half(this, "check_half", 18)
, m_off(this, "check_off", 18)
, m_on_disabled(this, "check_on_disabled", 18)
, m_half_disabled(this, "check_half_disabled", 18)
, m_off_disabled(this, "check_off_disabled", 18)
, m_on_focused(this, "check_on_focused", 18)
, m_half_focused(this, "check_half_focused", 18)
, m_off_focused(this, "check_off_focused", 18)
{
//SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
if (parent)
@ -42,6 +45,10 @@ void CheckBox::Rescale()
void CheckBox::update()
{
SetBitmap((m_half_checked ? m_half : GetValue() ? m_on : m_off).bmp());
SetBitmapLabel((m_half_checked ? m_half : GetValue() ? m_on : m_off).bmp());
SetBitmapDisabled((m_half_checked ? m_half_disabled : GetValue() ? m_on_disabled : m_off_disabled).bmp());
SetBitmapFocus((m_half_checked ? m_half_focused : GetValue() ? m_on_focused : m_off_focused).bmp());
SetBitmapCurrent((m_half_checked ? m_half_focused : GetValue() ? m_on_focused : m_off_focused).bmp());
}
CheckBox::State CheckBox::GetNormalState() const { return State_Normal; }