ochess/src/preferences/EditorPrefs.hpp

52 lines
1.4 KiB
C++
Raw Normal View History

2022-02-23 19:41:50 +01:00
#include "ochess.hpp"
#include <wx/combobox.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/preferences.h>
#include <wx/spinctrl.h>
#include <wx/stdpaths.h>
2022-02-28 13:02:27 +01:00
class EditorPrefsPanel : public PrefsEditor {
2022-02-23 19:41:50 +01:00
public:
2022-02-28 13:02:27 +01:00
EditorPrefsPanel(wxWindow *parent) : PrefsEditor(parent) {
2022-02-23 19:41:50 +01:00
// Bind(wxEVT_SPINCTRL, &BoardPrefsPanel::OnConfChange, this, wxID_ANY);
}
void OnConfChange(wxCommandEvent &event) {
}
virtual bool TransferDataToWindow() {
CONFIG_OPEN(config);
row_size->SetValue(config->Read("editor/row_size", 50));
col_size->SetValue(config->Read("editor/col_size", 100));
show_move_icons->SetValue(config->Read("editor/show_move_icons", true));
CONFIG_CLOSE(config);
2022-02-23 19:41:50 +01:00
return true;
}
void ApplyPreferences() {
CONFIG_OPEN(config);
config->Write("editor/row_size", row_size->GetValue());
config->Write("editor/col_size", col_size->GetValue());
config->Write("editor/show_move_icons", show_move_icons->GetValue());
CONFIG_CLOSE(config);
2022-02-23 19:41:50 +01:00
}
virtual bool TransferDataFromWindow() {
ApplyPreferences();
MAINWIN->ApplyPreferences();
2022-02-23 19:41:50 +01:00
return (true);
}
};
class EditorPrefs : public wxPreferencesPage {
public:
virtual wxString GetName() const { return "Editor"; }
virtual wxBitmap GetLargeIcon() {
return wxArtProvider::GetBitmap(wxART_HELP, wxART_TOOLBAR);
}
virtual wxWindow *CreateWindow(wxWindow *parent) {
return new EditorPrefsPanel(parent);
}
};