New CheckBox: Set image margin for checkbox with a label

+ RichMessageDialog: Call update of the checkbox, when label is set.[Fix for SPE-2035]
This commit is contained in:
YuSanka 2023-11-14 09:39:59 +01:00
parent 33cd9b9dbe
commit 2e07572498
3 changed files with 8 additions and 3 deletions

View File

@ -301,8 +301,10 @@ int RichMessageDialog::ShowModal()
{
if (m_checkBoxText.IsEmpty())
m_checkBox->Hide();
else
else {
m_checkBox->SetLabelText(m_checkBoxText);
m_checkBox->Update();
}
Layout();
return wxDialog::ShowModal();

View File

@ -4,8 +4,9 @@
BitmapToggleButton::BitmapToggleButton(wxWindow* parent, const wxString& label, wxWindowID id)
{
const long style = wxBORDER_NONE | wxBU_EXACTFIT | wxBU_LEFT;
if (label.IsEmpty())
wxBitmapToggleButton::Create(parent, id, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxBU_EXACTFIT);
wxBitmapToggleButton::Create(parent, id, wxNullBitmap, wxDefaultPosition, wxDefaultSize, style);
else {
#ifdef __linux__
wxSize label_size = parent->GetTextExtent(label);
@ -14,7 +15,7 @@ BitmapToggleButton::BitmapToggleButton(wxWindow* parent, const wxString& label,
wxSize def_size = wxDefaultSize;
#endif
// Call Create() from wxToggleButton instead of wxBitmapToggleButton to allow add Label text under Linux
wxToggleButton::Create(parent, id, label, wxDefaultPosition, def_size, wxBORDER_NONE | wxBU_EXACTFIT);
wxToggleButton::Create(parent, id, label, wxDefaultPosition, def_size, style);
}
#ifdef __WXMSW__

View File

@ -54,6 +54,8 @@ void CheckBox::update()
updateBitmap(e);
#endif
if (GetBitmapMargins().GetWidth() == 0 && !GetLabelText().IsEmpty())
SetBitmapMargins(4, 0);
update_size();
}