Enable/disable "Window" menu items in AUI MDI correctly.

Add EVT_UPDATE_UI handlers for "Close", "Close All" as well as "Next" and
"Previous" menu commands.

Closes #14102.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-03-15 13:49:54 +00:00
parent d361ea0db5
commit 9827ce9208
3 changed files with 32 additions and 0 deletions

View File

@ -493,6 +493,7 @@ All (GUI):
- Implement wxDV_ROW_LINES in generic wxDataViewCtrl (RedCAT).
- Added EVT_AUI_PANE_ACTIVATED event (Ronny Krüger).
- Added wxSplitterWindow::SetSashInvisible() (Armel Asselin).
- Enable/disable "Window" menu items in AUI MDI correctly (wsu).
GTK:

View File

@ -101,6 +101,7 @@ protected:
void AddWindowMenu(wxMenuBar *pMenuBar);
void DoHandleMenu(wxCommandEvent &event);
void DoHandleUpdateUI(wxUpdateUIEvent &event);
#endif // wxUSE_MENUS
virtual bool ProcessEvent(wxEvent& event);

View File

@ -56,6 +56,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIParentFrame, wxFrame)
BEGIN_EVENT_TABLE(wxAuiMDIParentFrame, wxFrame)
#if wxUSE_MENUS
EVT_MENU (wxID_ANY, wxAuiMDIParentFrame::DoHandleMenu)
EVT_UPDATE_UI (wxID_ANY, wxAuiMDIParentFrame::DoHandleUpdateUI)
#endif
END_EVENT_TABLE()
@ -347,6 +348,35 @@ void wxAuiMDIParentFrame::DoHandleMenu(wxCommandEvent& event)
event.Skip();
}
}
void wxAuiMDIParentFrame::DoHandleUpdateUI(wxUpdateUIEvent& event)
{
switch (event.GetId())
{
case wxWINDOWCLOSE:
case wxWINDOWCLOSEALL:
{
wxAuiMDIClientWindow* client_window = GetClientWindow();
wxCHECK_RET(client_window, wxS("Missing MDI Client Window"));
size_t pages = client_window->GetPageCount();
event.Enable(pages >= 1);
break;
}
case wxWINDOWNEXT:
case wxWINDOWPREV:
{
wxAuiMDIClientWindow* client_window = GetClientWindow();
wxCHECK_RET(client_window, wxS("Missing MDI Client Window"));
size_t pages = client_window->GetPageCount();
event.Enable(pages >= 2);
break;
}
default:
event.Skip();
}
}
#endif // wxUSE_MENUS
void wxAuiMDIParentFrame::DoGetClientSize(int* width, int* height) const