aboutsummaryrefslogtreecommitdiff
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-09 10:30:17 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-09 10:30:17 +0100
commite686937ce9df0ac938b5e23727b335efa53a81b7 (patch)
tree163b869fc3f11c668085a27b1255d2a59e9a72e1 /src/MainWindow.cpp
parentf1a54fd165251b1f2296f5845d31198f9b0198d9 (diff)
Prompt the user before closing dirty tabs
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 281edd8..6202889 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -64,12 +64,16 @@ 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");
+ wxMessageDialog *dial = new wxMessageDialog(NULL,
+ wxT("This tab contains data that are not saved. Are you sure you want to close it?"), wxT("Information"),
+ wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
+ if(dial->ShowModal() == wxID_YES)
+ event.Allow();
+ else
+ event.Veto();
}
}