mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user