Update tab management system

This commit is contained in:
Loic Guegan 2022-12-25 19:30:23 +01:00
parent 5df6e9395c
commit 29f330f307
9 changed files with 83 additions and 3 deletions

View file

@ -53,6 +53,7 @@ MainWindow::MainWindow()
Bind(wxEVT_MENU, &MainWindow::OnMenuItemClick, this, wxID_ANY);
Bind(REFRESH_ENGINE_LIST, &MainWindow::OnRefreshEngineList, this, wxID_ANY);
Bind(CLOSE_LINKED_TAB, &MainWindow::OnCloseTabLinkedTo, this, wxID_ANY);
Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSED, &MainWindow::OnAuiNotebookPageClosed, this, wxID_ANY);
// Add new game tab by default
NewGame(std::shared_ptr<Game>(new Game()));
@ -66,10 +67,19 @@ void MainWindow::AddPage(wxWindow* window, TabInfos* infos){
window->SetClientData(infos);
notebook->AddPage(window, window->GetLabel());
notebook->SetSelection(notebook->GetPageIndex(window));
// Refresh tab that require knowledge on other tabs
for(auto i: wxGetApp().ListTabInfos()){i->Refresh();}
}
void MainWindow::OnAuiNotebookPageClosed(wxAuiNotebookEvent& event){
// Refresh tab that require knowledge on other tabs
for(auto i: wxGetApp().ListTabInfos()){i->Refresh();}
}
void MainWindow::OnCloseTabEvent(wxCommandEvent &event) {
notebook->DeletePage(notebook->GetSelection());
// Refresh tab that require knowledge on other tabs
for(auto i: wxGetApp().ListTabInfos()){i->Refresh();}
}
void MainWindow::OnCloseTabLinkedTo(wxCommandEvent &event){