gui: improve RichMessageDialog (#5371)

* gui: improve RichMessageDialog

Current implementation of RichMessageDialog creates and pushes
extra checkbox widget into button button sizer which already filled in
with wxEXPAND items. That pushes position of newly added checkbox to the
left-most position which makes it invisibe for some users.

Optimize implementation of RichMessageDialog using m_checkbox_dsa of
MessageDialog instead of creating a new one. As a result, position of
the checkbox is right below the main text section.
This commit is contained in:
Dima Buzdyk authored and GitHub committed 2024-05-18 22:31:25 +08:00
1 parent bff2e18b63
commit 178b889c68
2 files changed
+13 -12

No files matched your search

+12 -11
View File
@@ -383,26 +383,27 @@ RichMessageDialog::RichMessageDialog(wxWindow* parent,
: MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s info"), SLIC3R_APP_FULL_NAME) : caption, wxEmptyString, style)
{
add_msg_content(this, content_sizer, message);
m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText);
wxGetApp().UpdateDarkUI(m_checkBox);
m_checkBox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) { m_checkBoxValue = m_checkBox->GetValue(); });
btn_sizer->Insert(0, m_checkBox, wxALIGN_CENTER_VERTICAL);
finalize();
}
int RichMessageDialog::ShowModal()
{
if (m_checkBoxText.IsEmpty())
m_checkBox->Hide();
else
m_checkBox->SetLabelText(m_checkBoxText);
if (!m_checkBoxText.IsEmpty()) {
show_dsa_button(m_checkBoxText);
m_checkbox_dsa->SetValue(m_checkBoxValue);
}
Layout();
return wxDialog::ShowModal();
}
bool RichMessageDialog::IsCheckBoxChecked() const
{
if (m_checkbox_dsa)
return m_checkbox_dsa->GetValue();
return m_checkBoxValue;
}
#endif
// InfoDialog