ENH:add "forward" function in MsgDialog

jira: STUDIO-9971
Change-Id: I699912b4d18cb52aec2badf64a4655d20559ed7c
(cherry picked from commit f608327a108c1eece45ee75bde0c3aa35974f166)
This commit is contained in:
zhou.xu
2025-01-23 12:15:17 +08:00
committed by Noisyfox
parent f2a5ff26d5
commit b477a9e3c0
6 changed files with 66 additions and 31 deletions

View File

@@ -23,15 +23,16 @@
#include "GUI_App.hpp"
#define DESIGN_INPUT_SIZE wxSize(FromDIP(100), -1)
#define MSG_DLG_MAX_SIZE wxSize(FromDIP(700), -1)
namespace Slic3r {
namespace GUI {
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, const wxString &forward_str)
: DPIDialog(parent ? parent : dynamic_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, title, wxDefaultPosition, wxSize(360, -1),wxDEFAULT_DIALOG_STYLE)
, boldfont(wxGetApp().normal_font())
, content_sizer(new wxBoxSizer(wxVERTICAL))
, btn_sizer(new wxBoxSizer(wxHORIZONTAL))
, btn_sizer(new wxBoxSizer(wxHORIZONTAL))
, m_forward_str(forward_str)
{
boldfont.SetWeight(wxFONTWEIGHT_BOLD);
SetBackgroundColour(0xFFFFFF);
@@ -191,7 +192,14 @@ Button* MsgDialog::get_button(wxWindowID btn_id){
void MsgDialog::apply_style(long style)
{
if (style & wxOK) add_button(wxID_OK, true, _L("OK"));
if (style & wxFORWARD)
add_button(wxFORWARD, true, _L("Go to") + " " + m_forward_str);
if (style & wxOK) {
if (style & wxFORWARD) { add_button(wxID_OK, false, _L("Later")); }
else {
add_button(wxID_OK, true, _L("OK"));
}
}
if (style & wxYES) add_button(wxID_YES, true, _L("Yes"));
if (style & wxNO) add_button(wxID_NO, false,_L("No"));
if (style & wxCANCEL) add_button(wxID_CANCEL, false, _L("Cancel"));
@@ -204,9 +212,10 @@ void MsgDialog::apply_style(long style)
void MsgDialog::finalize()
{
wxGetApp().UpdateDlgDarkUI(this);
Layout();
Fit();
CenterOnParent();
wxGetApp().UpdateDlgDarkUI(this);
}
@@ -334,12 +343,13 @@ WarningDialog::WarningDialog(wxWindow *parent,
MessageDialog::MessageDialog(wxWindow* parent,
const wxString& message,
const wxString& caption/* = wxEmptyString*/,
long style/* = wxOK*/)
: MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s info"), SLIC3R_APP_FULL_NAME) : caption, wxEmptyString, style)
long style /* = wxOK*/,
const wxString &forward_str /* = wxEmptyString*/)
: MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s info"), SLIC3R_APP_FULL_NAME) : caption, wxEmptyString, style, wxBitmap(),forward_str)
{
add_msg_content(this, content_sizer, message);
SetMaxSize(MSG_DLG_MAX_SIZE);
finalize();
wxGetApp().UpdateDlgDarkUI(this);
}