wxAuiMDI* now more accurately respects normal mdi event sequence
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
049333c242
commit
c5e2ca7c52
@ -255,6 +255,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
void PageChanged(int old_selection, int new_selection);
|
void PageChanged(int old_selection, int new_selection);
|
||||||
|
void OnPageClose(wxAuiNotebookEvent& event);
|
||||||
void OnPageChanged(wxAuiNotebookEvent& event);
|
void OnPageChanged(wxAuiNotebookEvent& event);
|
||||||
void OnSize(wxSizeEvent& evt);
|
void OnSize(wxSizeEvent& evt);
|
||||||
|
|
||||||
|
@ -433,11 +433,16 @@ bool wxAuiMDIChildFrame::Destroy()
|
|||||||
|
|
||||||
if (pParentFrame->GetActiveChild() == this)
|
if (pParentFrame->GetActiveChild() == this)
|
||||||
{
|
{
|
||||||
|
// deactivate ourself
|
||||||
|
wxActivateEvent event(wxEVT_ACTIVATE, false, GetId());
|
||||||
|
event.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
pParentFrame->SetActiveChild(NULL);
|
pParentFrame->SetActiveChild(NULL);
|
||||||
pParentFrame->SetChildMenuBar(NULL);
|
pParentFrame->SetChildMenuBar(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t page_count = pClientWindow->GetPageCount();
|
size_t page_count = pClientWindow->GetPageCount();
|
||||||
for (size_t pos = 0; pos < page_count; pos++)
|
for (size_t pos = 0; pos < page_count; pos++)
|
||||||
{
|
{
|
||||||
if (pClientWindow->GetPage(pos) == this)
|
if (pClientWindow->GetPage(pos) == this)
|
||||||
@ -650,6 +655,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIClientWindow, wxAuiNotebook)
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxAuiMDIClientWindow, wxAuiNotebook)
|
BEGIN_EVENT_TABLE(wxAuiMDIClientWindow, wxAuiNotebook)
|
||||||
EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxAuiMDIClientWindow::OnPageChanged)
|
EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxAuiMDIClientWindow::OnPageChanged)
|
||||||
|
EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, wxAuiMDIClientWindow::OnPageClose)
|
||||||
EVT_SIZE(wxAuiMDIClientWindow::OnSize)
|
EVT_SIZE(wxAuiMDIClientWindow::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@ -699,13 +705,15 @@ void wxAuiMDIClientWindow::PageChanged(int old_selection, int new_selection)
|
|||||||
if (old_selection == new_selection)
|
if (old_selection == new_selection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
// don't do anything if the new page is already active
|
// don't do anything if the new page is already active
|
||||||
if (new_selection != -1)
|
if (new_selection != -1)
|
||||||
{
|
{
|
||||||
wxAuiMDIChildFrame* child = (wxAuiMDIChildFrame*)GetPage(new_selection);
|
wxAuiMDIChildFrame* child = (wxAuiMDIChildFrame*)GetPage(new_selection);
|
||||||
if (child->GetMDIParentFrame()->GetActiveChild() == child)
|
if (child->GetMDIParentFrame()->GetActiveChild() == child)
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// notify old active child that it has been deactivated
|
// notify old active child that it has been deactivated
|
||||||
if (old_selection != -1)
|
if (old_selection != -1)
|
||||||
@ -734,12 +742,26 @@ void wxAuiMDIClientWindow::PageChanged(int old_selection, int new_selection)
|
|||||||
active_child->GetMDIParentFrame()->SetChildMenuBar(active_child);
|
active_child->GetMDIParentFrame()->SetChildMenuBar(active_child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxAuiMDIClientWindow::OnPageClose(wxAuiNotebookEvent& evt)
|
||||||
|
{
|
||||||
|
wxAuiMDIChildFrame* wnd;
|
||||||
|
wnd = static_cast<wxAuiMDIChildFrame*>(GetPage(evt.GetSelection()));
|
||||||
|
|
||||||
|
wnd->Close();
|
||||||
|
|
||||||
|
// regardless of the result of wnd->Close(), we've
|
||||||
|
// already taken care of the close operations, so
|
||||||
|
// suppress further processing
|
||||||
|
evt.Veto();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAuiMDIClientWindow::OnPageChanged(wxAuiNotebookEvent& evt)
|
void wxAuiMDIClientWindow::OnPageChanged(wxAuiNotebookEvent& evt)
|
||||||
{
|
{
|
||||||
PageChanged(evt.GetOldSelection(), evt.GetSelection());
|
PageChanged(evt.GetOldSelection(), evt.GetSelection());
|
||||||
evt.Skip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAuiMDIClientWindow::OnSize(wxSizeEvent& evt)
|
void wxAuiMDIClientWindow::OnSize(wxSizeEvent& evt)
|
||||||
|
Loading…
Reference in New Issue
Block a user