aboutsummaryrefslogtreecommitdiff
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
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();
}
}