aboutsummaryrefslogtreecommitdiff
path: root/src/ochess.hpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-02-23 18:11:55 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-02-23 18:11:55 +0100
commitce941c146aea7925bded6b9d2a0d0559d3156ad3 (patch)
tree4c52e02600e3fd127bfb28b3e974d45541ec9e4e /src/ochess.hpp
Create repository
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;
+};