aboutsummaryrefslogtreecommitdiff
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-12-24 12:46:59 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-12-24 12:46:59 +0100
commit2d9730e216976103daea64a8df047d5f0dffd5f7 (patch)
tree894454165b388167c077619c0a0388338c828c05 /src/MainWindow.cpp
parent273610cb0f848fd99f9b9769f0d60b6e2df590ed (diff)
Update tab management system
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 2243f86..8b6e0fe 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -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);
}