Change Input Config Dialogs to have only one 'Close' button

This commit is contained in:
Julian Löhr 2016-08-16 02:29:44 +02:00
parent 5608815cc8
commit 1951df97db
2 changed files with 12 additions and 5 deletions

View File

@ -202,10 +202,15 @@ void InputConfigDialog::UpdateControlReferences()
} }
} }
void InputConfigDialog::ClickSave(wxCommandEvent& event) void InputConfigDialog::OnClose(wxCloseEvent& event)
{ {
m_config.SaveConfig(); m_config.SaveConfig();
event.Skip(); EndModal(wxID_OK);
}
void InputConfigDialog::OnCloseButton(wxCommandEvent& event)
{
Close();
} }
int ControlDialog::GetRangeSliderValue() const int ControlDialog::GetRangeSliderValue() const
@ -1097,11 +1102,12 @@ InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputConfig& config
UpdateDeviceComboBox(); UpdateDeviceComboBox();
UpdateProfileComboBox(); UpdateProfileComboBox();
Bind(wxEVT_BUTTON, &InputConfigDialog::ClickSave, this, wxID_OK); Bind(wxEVT_CLOSE_WINDOW, &InputConfigDialog::OnClose, this);
Bind(wxEVT_BUTTON, &InputConfigDialog::OnCloseButton, this, wxID_CLOSE);
wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL); wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL);
szr->Add(m_pad_notebook, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5); szr->Add(m_pad_notebook, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5);
szr->Add(CreateButtonSizer(wxOK | wxCANCEL | wxNO_DEFAULT), 0, wxEXPAND | wxALL, 5); szr->Add(CreateButtonSizer(wxCLOSE), 0, wxEXPAND | wxALL, 5);
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED); SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetSizerAndFit(szr); SetSizerAndFit(szr);

View File

@ -252,7 +252,8 @@ public:
InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name, InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name,
const int tab_num = 0); const int tab_num = 0);
void ClickSave(wxCommandEvent& event); void OnClose(wxCloseEvent& event);
void OnCloseButton(wxCommandEvent& event);
void UpdateDeviceComboBox(); void UpdateDeviceComboBox();
void UpdateProfileComboBox(); void UpdateProfileComboBox();