mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-06 00:45:12 +08: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:
parent
bff2e18b63
commit
178b889c68
@ -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
|
||||
|
@ -193,7 +193,7 @@ public:
|
||||
}
|
||||
|
||||
wxString GetCheckBoxText() const { return m_checkBoxText; }
|
||||
bool IsCheckBoxChecked() const { return m_checkBoxValue; }
|
||||
bool IsCheckBoxChecked() const;
|
||||
|
||||
// This part o fcode isported from the "wx\msgdlg.h"
|
||||
using wxMD = wxMessageDialogBase;
|
||||
|
Loading…
x
Reference in New Issue
Block a user