From 29f330f307e35acf9dba3a8456dec330ef578dd7 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 25 Dec 2022 19:30:23 +0100 Subject: Update tab management system --- src/MainWindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/MainWindow.cpp') diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index a0e2ce6..7e50150 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -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(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){ -- cgit v1.2.3