Committing PresetEditor.cpp

This commit is contained in:
Joseph Lenox 2018-06-06 18:22:50 -05:00
parent 109fdce8c8
commit f59b6bea42

View File

@ -0,0 +1,61 @@
#include "Dialogs/PresetEditor.hpp"
#include "misc_ui.hpp"
#include <wx/bookctrl.h>
namespace Slic3r { namespace GUI {
PresetEditor::PresetEditor(wxWindow* parent, t_config_option_keys options) :
wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL) {
this->_sizer = new wxBoxSizer(wxHORIZONTAL);
this->SetSizer(this->_sizer);
wxSizer* left_sizer { new wxBoxSizer(wxVERTICAL) };
{
// choice menu
this->_presets_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxSize(left_col_width, -1));
this->_presets_choice->SetFont(small_font());
// buttons
this->_btn_save_preset = new wxBitmapButton(this, wxID_ANY, wxBitmap(var("disk.png"), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
this->_btn_delete_preset = new wxBitmapButton(this, wxID_ANY, wxBitmap(var("delete.png"), wxBITMAP_TYPE_PNG), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
this->set_tooltips();
this->_btn_delete_preset->Disable();
wxBoxSizer* hsizer {new wxBoxSizer(wxHORIZONTAL)};
left_sizer->Add(hsizer, 0, wxEXPAND | wxBOTTOM, 5);
hsizer->Add(this->_presets_choice, 1, wxRIGHT | wxALIGN_CENTER_VERTICAL, 3);
hsizer->Add(this->_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL);
hsizer->Add(this->_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL);
}
// tree
this->_treectrl = new wxTreeCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(left_col_width, -1), wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_SUNKEN | wxWANTS_CHARS);
left_sizer->Add(this->_treectrl, 1, wxEXPAND);
this->_icons = new wxImageList(16, 16, 1);
this->_treectrl->AssignImageList(this->_icons);
this->_iconcount = - 1;
this->_treectrl->AddRoot("root");
this->_treectrl->SetIndent(0);
this->disable_tree_sel_changed_event = false;
/// bind a lambda for the event EVT_TREE_SEL_CHANGED
/// bind a lambda for the event EVT_KEY_DOWN
/// bind a lambda for the event EVT_CHOICE
/// bind a lambda for the event EVT_KEY_DOWN
/// bind a lambda for the event EVT_BUTTON from btn_save_preset
/// bind a lambda for the event EVT_BUTTON from btn_delete_preset
}
}} // namespace Slic3r::GUI