NEW:add dont show again button on msgdialog
Change-Id: Id532ba9c10f01863dbe0f0319e9c9fd509a818fe
This commit is contained in:
parent
1c4ed26b81
commit
b685cbf37c
|
@ -26,6 +26,7 @@
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
wxDEFINE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent);
|
||||||
|
|
||||||
MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &headline, long style, wxBitmap bitmap)
|
MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &headline, long style, wxBitmap bitmap)
|
||||||
: DPIDialog(parent ? parent : dynamic_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, title, wxDefaultPosition, wxSize(360, -1),wxDEFAULT_DIALOG_STYLE)
|
: DPIDialog(parent ? parent : dynamic_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, title, wxDefaultPosition, wxSize(360, -1),wxDEFAULT_DIALOG_STYLE)
|
||||||
|
@ -59,6 +60,10 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
|
||||||
btn_sizer->AddStretchSpacer();
|
btn_sizer->AddStretchSpacer();
|
||||||
|
|
||||||
main_sizer->Add(topsizer, 1, wxEXPAND);
|
main_sizer->Add(topsizer, 1, wxEXPAND);
|
||||||
|
|
||||||
|
m_dsa_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
btn_sizer->Add(m_dsa_sizer,1,wxEXPAND,0);
|
||||||
|
btn_sizer->Add(0, 0, 1, wxEXPAND, 5);
|
||||||
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BORDER);
|
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BORDER);
|
||||||
|
|
||||||
apply_style(style);
|
apply_style(style);
|
||||||
|
@ -71,6 +76,34 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
|
||||||
for (auto mb : m_buttons) { delete mb.second->buttondata ; delete mb.second; }
|
for (auto mb : m_buttons) { delete mb.second->buttondata ; delete mb.second; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MsgDialog::show_dsa_button()
|
||||||
|
{
|
||||||
|
m_checkbox_dsa = new CheckBox(this);
|
||||||
|
m_dsa_sizer->Add(m_checkbox_dsa, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
|
||||||
|
m_checkbox_dsa->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& e) {
|
||||||
|
auto event = wxCommandEvent(EVT_CHECKBOX_CHANGE);
|
||||||
|
event.SetInt(m_checkbox_dsa->GetValue()?1:0);
|
||||||
|
event.SetEventObject(this);
|
||||||
|
wxPostEvent(this, event);
|
||||||
|
e.Skip();
|
||||||
|
});
|
||||||
|
|
||||||
|
auto m_text_dsa = new wxStaticText(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_dsa_sizer->Add(m_text_dsa, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
|
||||||
|
m_text_dsa->SetFont(::Label::Body_13);
|
||||||
|
m_text_dsa->SetForegroundColour(wxColour(0x32,0x3A,0x3D));
|
||||||
|
btn_sizer->Layout();
|
||||||
|
//Fit();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MsgDialog::get_checkbox_state()
|
||||||
|
{
|
||||||
|
if (m_checkbox_dsa) {
|
||||||
|
return m_checkbox_dsa->GetValue();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void MsgDialog::on_dpi_changed(const wxRect &suggested_rect)
|
void MsgDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||||
{
|
{
|
||||||
if (m_buttons.size() > 0) {
|
if (m_buttons.size() > 0) {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
#include <wx/statline.h>
|
#include <wx/statline.h>
|
||||||
#include "Widgets/Button.hpp"
|
#include "Widgets/Button.hpp"
|
||||||
|
#include "Widgets/CheckBox.hpp"
|
||||||
#include "BBLStatusBar.hpp"
|
#include "BBLStatusBar.hpp"
|
||||||
#include "BBLStatusBarSend.hpp"
|
#include "BBLStatusBarSend.hpp"
|
||||||
|
|
||||||
|
@ -59,7 +60,9 @@ struct MsgDialog : DPIDialog
|
||||||
MsgDialog &operator=(const MsgDialog &) = delete;
|
MsgDialog &operator=(const MsgDialog &) = delete;
|
||||||
virtual ~MsgDialog();
|
virtual ~MsgDialog();
|
||||||
|
|
||||||
virtual void on_dpi_changed(const wxRect &suggested_rect);
|
void show_dsa_button();
|
||||||
|
bool get_checkbox_state();
|
||||||
|
virtual void on_dpi_changed(const wxRect& suggested_rect);
|
||||||
void SetButtonLabel(wxWindowID btn_id, const wxString& label, bool set_focus = false);
|
void SetButtonLabel(wxWindowID btn_id, const wxString& label, bool set_focus = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -84,10 +87,12 @@ protected:
|
||||||
wxFont boldfont;
|
wxFont boldfont;
|
||||||
wxBoxSizer *content_sizer;
|
wxBoxSizer *content_sizer;
|
||||||
wxBoxSizer *btn_sizer;
|
wxBoxSizer *btn_sizer;
|
||||||
|
wxBoxSizer *m_dsa_sizer;
|
||||||
wxStaticBitmap *logo;
|
wxStaticBitmap *logo;
|
||||||
MsgButtonsHash m_buttons;
|
MsgButtonsHash m_buttons;
|
||||||
|
CheckBox* m_checkbox_dsa{nullptr};
|
||||||
};
|
};
|
||||||
|
wxDECLARE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent);
|
||||||
|
|
||||||
// Generic error dialog, used for displaying exceptions
|
// Generic error dialog, used for displaying exceptions
|
||||||
class ErrorDialog : public MsgDialog
|
class ErrorDialog : public MsgDialog
|
||||||
|
|
Loading…
Reference in New Issue