From a7ce24249640ca5e17ed89203e6a9c70dd01e706 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 13 Jun 2018 22:06:49 -0500 Subject: [PATCH] pages is PresetPage, not wxString --- src/GUI/Dialogs/PresetEditor.hpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/GUI/Dialogs/PresetEditor.hpp b/src/GUI/Dialogs/PresetEditor.hpp index f39a5ad1f..ec8ce6afc 100644 --- a/src/GUI/Dialogs/PresetEditor.hpp +++ b/src/GUI/Dialogs/PresetEditor.hpp @@ -21,6 +21,8 @@ using namespace std::string_literals; namespace Slic3r { namespace GUI { +class PresetPage; + class PresetEditor : public wxPanel { public: @@ -39,6 +41,7 @@ public: wxSizer* sizer() { return _sizer; }; PresetEditor(wxWindow* parent, t_config_option_keys options = {}); PresetEditor() : PresetEditor(nullptr, {}) {}; + std::shared_ptr current_preset; bool prompt_unsaved_changes(); void select_preset_by_name(const wxString& name, bool force = false); @@ -51,6 +54,7 @@ public: std::function on_value_change {}; config_ptr config; + PresetPage* add_options_page(const wxString& _title, const wxString& _icon = ""); virtual wxString title() = 0; virtual std::string name() = 0; @@ -65,8 +69,9 @@ protected: wxChoice* _presets_choice {nullptr}; int _iconcount {-1}; - std::vector _pages {}; - + /// Vector of PresetPage pointers; trust wxWidgets RTTI to avoid leaks + std::vector _pages {}; + const unsigned int left_col_width {150}; void _update_tree(); 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 #endif // PRESETEDITOR_HPP