Settings window is now a modal dialog.

This commit is contained in:
WrinklyNinja
2013-05-09 22:01:44 +01:00
parent 7f27d27b76
commit 8e3674a48e
3 changed files with 12 additions and 18 deletions
+1 -1
View File
@@ -598,7 +598,7 @@ void Launcher::OnViewLastReport(wxCommandEvent& event) {
void Launcher::OnOpenSettings(wxCommandEvent& event) {
SettingsFrame *settings = new SettingsFrame(this, translate("BOSS: Settings"), _settings);
settings->Show();
settings->ShowModal();
}
void Launcher::OnGameChange(wxCommandEvent& event) {
+10 -16
View File
@@ -25,14 +25,13 @@
#include "../globals.h"
#include <fstream>
BEGIN_EVENT_TABLE ( SettingsFrame, wxFrame )
EVT_BUTTON ( OPTION_OKExitSettings, SettingsFrame::OnQuit)
EVT_BUTTON ( OPTION_CancelExitSettings, SettingsFrame::OnQuit)
BEGIN_EVENT_TABLE ( SettingsFrame, wxDialog )
EVT_BUTTON ( wxID_OK, SettingsFrame::OnQuit)
END_EVENT_TABLE()
using namespace std;
SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings) : wxFrame(parent, wxID_ANY, title), _settings(settings) {
SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER), _settings(settings) {
//Initialise drop-down list contents.
wxString DebugVerbosity[] = {
@@ -72,9 +71,6 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
UpdateMasterlistBox = new wxCheckBox(this, wxID_ANY, translate("Update masterlist before sorting."));
wxButton * okBtn = new wxButton(this, OPTION_OKExitSettings, translate("OK"), wxDefaultPosition, wxSize(70, 30));
wxButton * cancelBtn = new wxButton(this, OPTION_CancelExitSettings, translate("Cancel"), wxDefaultPosition, wxSize(70, 30));
//Set up layout.
wxSizerFlags leftItem(0);
leftItem.Left();
@@ -119,20 +115,18 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
bigBox->Add(GridSizer, 0, wxEXPAND|wxALL, 10);
bigBox->Add(UpdateMasterlistBox, wholeItem);
bigBox->AddSpacer(10);
bigBox->AddStretchSpacer(1);
bigBox->Add(new wxStaticText(this, wxID_ANY, translate("Language changes will be applied after BOSS is restarted.")), wholeItem);
//Need to add 'OK' and 'Cancel' buttons.
wxBoxSizer * hbox = new wxBoxSizer(wxHORIZONTAL);
hbox->Add(okBtn);
hbox->Add(cancelBtn, 0, wxLEFT, 10);
wholeItem.Centre();
wxSizer * sizer = CreateSeparatedButtonSizer(wxOK|wxCANCEL);
//Now add TabHolder and OK button to window sizer.
bigBox->Add(hbox, wholeItem);
if (sizer != NULL)
bigBox->Add(sizer, 0, wxEXPAND|wxALIGN_CENTRE|wxLEFT|wxBOTTOM|wxRIGHT, 15);
//Initialise options with values. For checkboxes, they are off by default.
SetDefaultValues();
@@ -201,7 +195,7 @@ void SettingsFrame::SetDefaultValues() {
}
void SettingsFrame::OnQuit(wxCommandEvent& event) {
if (event.GetId() == OPTION_OKExitSettings) {
if (event.GetId() == wxID_OK) {
switch (GameChoice->GetSelection()) {
case 0:
@@ -253,5 +247,5 @@ void SettingsFrame::OnQuit(wxCommandEvent& event) {
out.close();
}
this->Close();
EndModal(0);
}
+1 -1
View File
@@ -28,7 +28,7 @@
#include <yaml-cpp/yaml.h>
#include <wx/listctrl.h>
class SettingsFrame : public wxFrame {
class SettingsFrame : public wxDialog {
public:
SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings);
void OnQuit(wxCommandEvent& event);