Update tab management system

This commit is contained in:
Loic Guegan 2022-12-24 12:46:59 +01:00
parent 273610cb0f
commit 2d9730e216
8 changed files with 35 additions and 13 deletions

View file

@ -191,9 +191,9 @@ void MainWindow::NewGame(bool useFen) {
}
void MainWindow::OnNewGame(wxCommandEvent &event) {
std::shared_ptr<Game> *g = (std::shared_ptr<Game>*)event.GetClientData();
NewGame(*g);
delete g;
TabInfos *tab = (TabInfos*)event.GetClientData();
TabInfos *i=NewGame(tab->GetGame());
i->Link(tab);
}
void MainWindow::OnPageChange(wxAuiNotebookEvent &event) {
@ -215,8 +215,9 @@ void MainWindow::OnRefreshTabTitle(wxCommandEvent &event) {
}
}
void MainWindow::NewGame(std::shared_ptr<Game> game) {
TabInfos* MainWindow::NewGame(std::shared_ptr<Game> game) {
GameTab *gt = new GameTab((wxFrame *)notebook, game);
notebook->AddPage(gt, gt->GetLabel());
notebook->SetSelection(notebook->GetPageIndex(gt));
return(gt);
}