A lot of changes, finished Settings dialog.

This commit is contained in:
2015-06-19 12:39:52 +03:00
parent 6a6814fb9f
commit 378655c361
9 changed files with 103 additions and 28 deletions

50
wxCrossGen/fsettings.hpp Normal file
View File

@@ -0,0 +1,50 @@
#ifndef FSETTINGS_HPP
#define FSETTINGS_HPP
#include <wx/wx.h>
#include "fbgui/fbgui.h"
class SettingsDialog: public VSettingsDialog {
public:
void onDictPathClick(wxCommandEvent& event);
void onCancelClick(wxCommandEvent& event) {
EndModal(wxID_CANCEL);
}
void onOkClick(wxCommandEvent& event);
SettingsDialog( wxWindow* parent ) : VSettingsDialog(parent) {};
wxString getDictPath() {
return tDictPath->GetValue();
}
void setDictPath(wxString path) {
tDictPath->SetValue(path);
}
};
void SettingsDialog::onDictPathClick(wxCommandEvent& event) {
wxFileDialog dlgOpen(this, _("Open dictionary file"), wxEmptyString, wxEmptyString,
_("Files of dictionaris (*.txt)|*.txt"), wxFD_OPEN|wxFD_FILE_MUST_EXIST);
if ( dlgOpen.ShowModal() == wxID_CANCEL )
return;
wxFileInputStream input_stream(dlgOpen.GetPath());
if ( !input_stream.IsOk() ) {
wxMessageBox(_("Cannot open dictionary file ") + dlgOpen.GetPath(), _("Error"), wxICON_ERROR);
return;
}
tDictPath->SetValue(dlgOpen.GetPath());
}
void SettingsDialog::onOkClick(wxCommandEvent& event) {
wxFileInputStream input_stream(tDictPath->GetValue());
if ( !input_stream.IsOk() ) {
wxMessageBox(_("Cannot open dictionary file ") + tDictPath->GetValue(), _("Error"), wxICON_ERROR);
return;
}
EndModal(wxID_OK);
}
#endif