X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a29fe70bc90b08b4f0bd4c23c1d12ad17cbbed2..7d6a4d96961eac84d05db8bb24c64d39003f6e54:/src/aui/tabmdi.cpp diff --git a/src/aui/tabmdi.cpp b/src/aui/tabmdi.cpp index 2059d90941..e54e2d97f0 100644 --- a/src/aui/tabmdi.cpp +++ b/src/aui/tabmdi.cpp @@ -38,6 +38,7 @@ #endif //WX_PRECOMP #include "wx/stockitem.h" +#include "wx/aui/dockart.h" enum MDI_MENU_ID { @@ -56,6 +57,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 +349,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