ENH: add options list for param dialog

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Ic2dc62fae487b8c167ccb6d53572cba0fbc727c9
(cherry picked from commit d599757bf8541e3be6cdd7aeb9a15599eced586b)
This commit is contained in:
xun.zhang 2025-01-17 12:59:15 +08:00 committed by Noisyfox
parent 819e11733a
commit 0ad660b1d3
2 changed files with 18 additions and 6 deletions

View file

@ -23,7 +23,7 @@ namespace Slic3r {
namespace GUI {
TipsDialog::TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key, long style)
TipsDialog::TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key, long style,std::map<wxStandardID,wxString> option_map)
: DPIDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX),
m_app_key(app_key)
{
@ -59,19 +59,31 @@ TipsDialog::TipsDialog(wxWindow *parent, const wxString &title, const wxString &
wxBoxSizer *m_sizer_right = new wxBoxSizer(wxHORIZONTAL);
if (style & wxOK) {
Button* btn = add_button(wxID_OK, _L("OK"), true);
wxString str = _L("OK");
if (auto iter = option_map.find(wxID_OK); iter != option_map.end())
str = iter->second;
Button* btn = add_button(wxID_OK, str, true);
m_sizer_right->Add(btn, 0, wxALL, FromDIP(5));
}
if (style & wxYES) {
Button *btn = add_button(wxID_YES, _L("Yes"), true);
wxString str = _L("Yes");
if (auto iter = option_map.find(wxID_YES); iter != option_map.end())
str = iter->second;
Button *btn = add_button(wxID_YES, str, true);
m_sizer_right->Add(btn, 0, wxALL, FromDIP(5));
}
if (style & wxNO) {
Button *btn = add_button(wxID_NO, _L("No"), false);
wxString str = _L("No");
if (auto iter = option_map.find(wxID_NO); iter != option_map.end())
str = iter->second;
Button *btn = add_button(wxID_NO, str, false);
m_sizer_right->Add(btn, 0, wxALL, FromDIP(5));
}
if (style & wxCANCEL) {
Button *btn = add_button(wxID_CANCEL, _L("Cancel"), false);
wxString str = _L("Cancel");
if (auto iter = option_map.find(wxID_CANCEL); iter != option_map.end())
str = iter->second;
Button *btn = add_button(wxID_CANCEL, str, false);
m_sizer_right->Add(btn, 0, wxALL, FromDIP(5));
}

View file

@ -48,7 +48,7 @@ private:
std::string m_app_key;
public:
TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key = "", long style = wxOK);
TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key = "", long style = wxOK, std::map<wxStandardID,wxString> option_map={});
Button *m_confirm{nullptr};
Button *m_cancel{nullptr};
wxPanel *m_top_line{nullptr};