#pragma once #include #ifndef WX_PRECOMP #include #endif #include "binres/binres.hpp" #include "gui.h" #include #include #include #include // Check file exists etc #include #include #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 SHOW_DIALOG_INFO(message) {wxMessageBox( wxT(message) );} #define SHOW_DIALOG_BUSY(message) {wxBusyInfo wait(message);} #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 class Game; class GameBase; /** * @brief Attach informations to the application tabs * */ class TabInfos { static long tab_count; public: typedef enum Type { GAME, BASE, ENGINE, NONE } Type; Type type; /// @brief Each tab has an associated unique id long id; /// @brief Specify to which tab id this tab is linked (e.g: database to linked to game tab) long linked_id; /// @brief Set to true if this tab is attach to another one (c.f linked_id) bool is_linked; TabInfos(Type type_) : type(type_), id(tab_count), is_linked(false) { tab_count++; wxLogDebug("Tabid=%d",(int)id); } void Link(TabInfos *tab); virtual void Refresh(){}; virtual void ApplyPreferences() {}; virtual std::shared_ptr GetGame() = 0; virtual std::shared_ptr GetBase() = 0; }; /** * @brief Main application * */ class MyApp : public wxApp { public: virtual bool OnInit(); std::vector ListTabInfos(); }; wxDECLARE_APP(MyApp); ///@brief Abort ochess with a message void Abort(std::string msg);