aboutsummaryrefslogtreecommitdiff
path: root/src/ochess.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ochess.hpp')
-rw-r--r--src/ochess.hpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/ochess.hpp b/src/ochess.hpp
new file mode 100644
index 0000000..687d44f
--- /dev/null
+++ b/src/ochess.hpp
@@ -0,0 +1,57 @@
+#pragma once
+
+#include <wx/wxprec.h>
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include "binres/binres.hpp"
+#include <wx/app.h>
+#include <wx/config.h>
+#include <wx/filefn.h> // Check file exists etc
+#include <wx/log.h>
+
+#define MAINWIN ((MainWindow *)wxGetApp().GetTopWindow())
+
+#define SHOW_DIALOG_ERROR(message) \
+ { \
+ wxMessageDialog *dial = new wxMessageDialog( \
+ NULL, wxT(message), wxT("Error"), wxOK | wxICON_ERROR); \
+ dial->ShowModal(); \
+ }
+
+#define REQUIRE_FILE(file) \
+ { \
+ if (!wxFileExists(file)) { \
+ Abort(std::string("File ") + file + std::string(" not found")); \
+ } \
+ }
+
+#define CONFIG_OPEN(name) wxConfig *name = new wxConfig("ochess")
+#define CONFIG_CLOSE(name) delete name
+
+/**
+ * @brief Main application
+ *
+ */
+class MyApp : public wxApp {
+public:
+ virtual bool OnInit();
+};
+
+wxDECLARE_APP(MyApp);
+
+///@brief Abort ochess with a message
+void Abort(std::string msg);
+
+/**
+ * @brief Attach informations to the application tabs
+ *
+ */
+class TabInfos {
+public:
+ typedef enum Type { GAME, NONE } Type;
+ Type type;
+ TabInfos(Type type_) : type(type_) {}
+ virtual void ApplyPreferences() = 0;
+};