mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +02:00
49 lines
No EOL
1.2 KiB
C++
49 lines
No EOL
1.2 KiB
C++
#include "ochess.hpp"
|
|
#include "MainWindow.hpp"
|
|
#include "base_tab/BaseTab.hpp"
|
|
|
|
bool MyApp::OnInit() {
|
|
wxImage::AddHandler(new wxPNGHandler);
|
|
|
|
MainWindow *frame = new MainWindow();
|
|
frame->Show(true);
|
|
return true;
|
|
}
|
|
|
|
std::vector<TabInfos *> MyApp::ListTabInfos() {
|
|
std::vector<TabInfos *> tinfos;
|
|
wxAuiNotebook *notebook=((MainWindow *)this->GetTopWindow())->notebook;
|
|
for (int i = 0; i < notebook->GetPageCount(); i++) {
|
|
tinfos.push_back(dynamic_cast<TabInfos *>(notebook->GetPage(i)));
|
|
}
|
|
return (tinfos);
|
|
}
|
|
|
|
void MyApp::NewGame(TabInfos *tabsrc,std::shared_ptr<Game> g){
|
|
MainWindow *w=((MainWindow *)this->GetTopWindow());
|
|
TabInfos *i=w->NewGame(g);
|
|
i->Link(tabsrc); // Link opened game to tabsrc
|
|
}
|
|
|
|
void MyApp::NewGame(std::shared_ptr<Game> g){
|
|
MainWindow *w=((MainWindow *)this->GetTopWindow());
|
|
w->NewGame(g);
|
|
}
|
|
|
|
|
|
|
|
wxIMPLEMENT_APP(MyApp);
|
|
|
|
void Abort(std::string msg) {
|
|
wxMessageDialog *dial = new wxMessageDialog(NULL, wxString(msg), wxT("Error"),
|
|
wxOK | wxICON_ERROR);
|
|
dial->ShowModal();
|
|
wxLogFatalError(wxString(msg));
|
|
}
|
|
|
|
long TabInfos::tab_count=0;
|
|
void TabInfos::Link(TabInfos *tab){
|
|
this->is_linked=true;
|
|
this->linked_id=tab->id;
|
|
this->OnLink();
|
|
} |