diff options
author | Vojtech Kral <vojtech@kral.hk> | 2018-10-04 12:12:55 +0300 |
---|---|---|
committer | Vojtech Kral <vojtech@kral.hk> | 2018-10-08 18:41:37 +0300 |
commit | 1f926964ee0d93ce0044c75f76aee52d5db15dfd (patch) | |
tree | d0144ebfe36b958bfab615e7019d84c6f3b489a2 /src/slic3r/GUI/GUI_Utils.cpp | |
parent | 99fe5761d8fca6349b924cb5c02198aed39ddb94 (diff) |
WIP: Plater, build fixes
Diffstat (limited to 'src/slic3r/GUI/GUI_Utils.cpp')
-rw-r--r-- | src/slic3r/GUI/GUI_Utils.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/slic3r/GUI/GUI_Utils.cpp b/src/slic3r/GUI/GUI_Utils.cpp new file mode 100644 index 000000000..b8cd60944 --- /dev/null +++ b/src/slic3r/GUI/GUI_Utils.cpp @@ -0,0 +1,54 @@ +#include "GUI_Utils.hpp" + +#include <wx/sizer.h> +#include <wx/panel.h> +#include <wx/checkbox.h> + + +namespace Slic3r { +namespace GUI { + + +CheckboxFileDialog::CheckboxFileDialog(wxWindow *parent, + const wxString &checkbox_label, + bool checkbox_value, + const wxString &message, + const wxString &default_dir, + const wxString &default_file, + const wxString &wildcard, + long style, + const wxPoint &pos, + const wxSize &size, + const wxString &name +) + : wxFileDialog(parent, message, default_dir, default_file, wildcard, style, pos, size, name) + , cbox(nullptr) +{ + if (checkbox_label.IsEmpty()) { + return; + } + + extra_control_creator = [this, checkbox_label](wxWindow *parent) -> wxWindow* { + wxPanel* panel = new wxPanel(parent, -1); + wxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); + this->cbox = new wxCheckBox(panel, wxID_HIGHEST + 1, checkbox_label); + this->cbox->SetValue(true); + sizer->AddSpacer(5); + sizer->Add(this->cbox, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, 5); + panel->SetSizer(sizer); + sizer->SetSizeHints(panel); + + return panel; + }; + + SetExtraControlCreator(*extra_control_creator.target<ExtraControlCreatorFunction>()); +} + +bool CheckboxFileDialog::get_checkbox_value() const +{ + return this->cbox != nullptr ? cbox->IsChecked() : false; +} + + +} +} |