implemented page close event for wxAuiNotebook

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Benjamin Williams
2006-11-06 15:05:08 +00:00
parent 5d3aeb0f57
commit 3fd8c98854
3 changed files with 34 additions and 1 deletions

View File

@@ -138,6 +138,7 @@ private:
void OnRestorePerspective(wxCommandEvent& evt);
void OnSettings(wxCommandEvent& evt);
void OnAllowNotebookDnD(wxAuiNotebookEvent& evt);
void OnNotebookPageClose(wxAuiNotebookEvent& evt);
void OnExit(wxCommandEvent& evt);
void OnAbout(wxCommandEvent& evt);
@@ -619,6 +620,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
MyFrame::OnRestorePerspective)
EVT_AUI_PANECLOSE(MyFrame::OnPaneClose)
EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, MyFrame::OnAllowNotebookDnD)
EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, MyFrame::OnNotebookPageClose)
END_EVENT_TABLE()
@@ -1208,6 +1210,20 @@ void MyFrame::OnRestorePerspective(wxCommandEvent& evt)
m_mgr.LoadPerspective(m_perspectives.Item(evt.GetId() - ID_FirstPerspective));
}
void MyFrame::OnNotebookPageClose(wxAuiNotebookEvent& evt)
{
wxAuiNotebook* ctrl = (wxAuiNotebook*)evt.GetEventObject();
if (ctrl->GetPage(evt.GetSelection())->IsKindOf(CLASSINFO(wxHtmlWindow)))
{
int res = wxMessageBox(wxT("Are you sure you want to close/hide this notebook page?"),
wxT("wxAUI"),
wxYES_NO,
this);
if (res != wxYES)
evt.Veto();
}
}
void MyFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& evt)
{
// for the purpose of this test application, explicitly