mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 20:40:41 +08:00
pages is PresetPage, not wxString
This commit is contained in:
parent
a9b6946066
commit
d8d7119f47
@ -21,6 +21,8 @@
|
|||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
class PresetPage;
|
||||||
|
|
||||||
class PresetEditor : public wxPanel {
|
class PresetEditor : public wxPanel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -39,6 +41,7 @@ public:
|
|||||||
wxSizer* sizer() { return _sizer; };
|
wxSizer* sizer() { return _sizer; };
|
||||||
PresetEditor(wxWindow* parent, t_config_option_keys options = {});
|
PresetEditor(wxWindow* parent, t_config_option_keys options = {});
|
||||||
PresetEditor() : PresetEditor(nullptr, {}) {};
|
PresetEditor() : PresetEditor(nullptr, {}) {};
|
||||||
|
std::shared_ptr<Preset> current_preset;
|
||||||
|
|
||||||
bool prompt_unsaved_changes();
|
bool prompt_unsaved_changes();
|
||||||
void select_preset_by_name(const wxString& name, bool force = false);
|
void select_preset_by_name(const wxString& name, bool force = false);
|
||||||
@ -51,6 +54,7 @@ public:
|
|||||||
std::function<void ()> on_value_change {};
|
std::function<void ()> on_value_change {};
|
||||||
|
|
||||||
config_ptr config;
|
config_ptr config;
|
||||||
|
PresetPage* add_options_page(const wxString& _title, const wxString& _icon = "");
|
||||||
|
|
||||||
virtual wxString title() = 0;
|
virtual wxString title() = 0;
|
||||||
virtual std::string name() = 0;
|
virtual std::string name() = 0;
|
||||||
@ -65,8 +69,9 @@ protected:
|
|||||||
wxChoice* _presets_choice {nullptr};
|
wxChoice* _presets_choice {nullptr};
|
||||||
int _iconcount {-1};
|
int _iconcount {-1};
|
||||||
|
|
||||||
std::vector<wxString> _pages {};
|
/// Vector of PresetPage pointers; trust wxWidgets RTTI to avoid leaks
|
||||||
|
std::vector<PresetPage*> _pages {};
|
||||||
|
|
||||||
const unsigned int left_col_width {150};
|
const unsigned int left_col_width {150};
|
||||||
void _update_tree();
|
void _update_tree();
|
||||||
void load_presets();
|
void load_presets();
|
||||||
@ -231,5 +236,22 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class PresetPage : wxScrolledWindow {
|
||||||
|
public:
|
||||||
|
PresetPage(wxWindow* parent, wxString _title, int _iconID) :
|
||||||
|
wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
|
||||||
|
title(_title), iconID(_iconID) {
|
||||||
|
this->vsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
this->SetSizer(this->vsizer);
|
||||||
|
this->SetScrollRate(ui_settings->scroll_step(), ui_settings->scroll_step());
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
wxSizer* vsizer {nullptr};
|
||||||
|
wxString title {""};
|
||||||
|
int iconID {0};
|
||||||
|
};
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
#endif // PRESETEDITOR_HPP
|
#endif // PRESETEDITOR_HPP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user