diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-08 17:45:37 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2023-01-08 17:45:37 +0100 |
| commit | 335547e081261e9b8c3622b698de5b6273af2bb8 (patch) | |
| tree | 44aebdb6a787c264ae40939864c1d7ea6e0d343c | |
| parent | c046216e10875e9e07a924fd1ccfd15b06229bb6 (diff) | |
Tabs can be marked as dirty
| -rw-r--r-- | src/MainWindow.cpp | 5 | ||||
| -rw-r--r-- | src/ochess.hpp | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index f468723..281edd8 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -66,6 +66,11 @@ MainWindow::MainWindow() void MainWindow::OnAuiNotebookPageCheck(wxAuiNotebookEvent& event){ // TODO: Ask the user before closing //event.Veto(); + int selection=event.GetSelection(); + TabInfos *t=dynamic_cast<TabInfos *>(notebook->GetPage(selection)); + if(t->is_dirty){ + wxLogDebug("Tab was dirty"); + } } void MainWindow::AddPage(wxWindow* window, TabInfos* infos){ diff --git a/src/ochess.hpp b/src/ochess.hpp index 4b1b867..434ca72 100644 --- a/src/ochess.hpp +++ b/src/ochess.hpp @@ -53,7 +53,9 @@ public: long linked_id; /// @brief Set to true if this tab is attach to another one (c.f linked_id) bool is_linked; - TabInfos(Type type_) : type(type_), id(tab_count), is_linked(false) { tab_count++; } + /// @brief True if current tab is dirty + bool is_dirty; + TabInfos(Type type_) : type(type_), id(tab_count), is_linked(false), is_dirty(false) { tab_count++; } void Link(TabInfos *tab); virtual void Refresh(){}; /// @brief Call when tab is linked to another one |
