diff --git a/src/fc2dconfig.cpp b/src/fc2dconfig.cpp index 199109b..9210ed3 100644 --- a/src/fc2dconfig.cpp +++ b/src/fc2dconfig.cpp @@ -22,6 +22,7 @@ class ConfigurationFrame : public wxFrame { std::vector modelVec; wxCheckBox* useHaarCheckBox; wxChoice* modelNameChoice; + void OnApply(wxCommandEvent& event); void OnExit(wxCommandEvent& event); }; @@ -55,21 +56,27 @@ ConfigurationFrame::ConfigurationFrame() : wxFrame(NULL, wxID_ANY, "Configure " modelNameChoice = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, modelVec.size(), modelArray); // TODO: cancel button to exit without saving settings - wxButton* okButton = new wxButton(panel, wxID_OK, "OK"); + wxButton* cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel"); + wxButton* applyButton = new wxButton(panel, wxID_APPLY, "Apply settings"); + + wxBoxSizer* bottomButtonSizer = new wxBoxSizer(wxHORIZONTAL); + bottomButtonSizer->Add(cancelButton, 0, wxALL, 5); + bottomButtonSizer->Add(applyButton, 0, wxALL, 5); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(placeholderText, 0, wxALL | wxALIGN_LEFT, 10); sizer->Add(useHaarCheckBox, 0, wxALL | wxALIGN_LEFT, 5); sizer->Add(modelNameChoice, 0, wxALL | wxALIGN_LEFT, 5); sizer->AddStretchSpacer(1); - sizer->Add(okButton, 0, wxALIGN_RIGHT | wxALL, 10); + sizer->Add(bottomButtonSizer, 0, wxALIGN_RIGHT | wxALL, 10); panel->SetSizerAndFit(sizer); - Bind(wxEVT_BUTTON, &ConfigurationFrame::OnExit, this, wxID_OK); + Bind(wxEVT_BUTTON, &ConfigurationFrame::OnApply, this, wxID_APPLY); + Bind(wxEVT_BUTTON, &ConfigurationFrame::OnExit, this, wxID_CANCEL); } -void ConfigurationFrame::OnExit(wxCommandEvent& event) { +void ConfigurationFrame::OnApply(wxCommandEvent& event) { // write options to config file std::ofstream configFile; configFile.open(prefixCustom + "config.toml"); @@ -83,3 +90,7 @@ void ConfigurationFrame::OnExit(wxCommandEvent& event) { Close(true); } + +void ConfigurationFrame::OnExit(wxCommandEvent& event) { + Close(true); +}