]> git.saurik.com Git - wxWidgets.git/commitdiff
Enable/disable "Window" menu items in AUI MDI correctly.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 15 Mar 2012 13:49:54 +0000 (13:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 15 Mar 2012 13:49:54 +0000 (13:49 +0000)
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

docs/changes.txt
include/wx/aui/tabmdi.h
src/aui/tabmdi.cpp

index ef7179451501fe2fbf13aa563d5f39ca057e7684..819d20a225e1f10b8200e31f384ed0f10585342a 100644 (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:
index 45e30473c777db4730303a5139fca56d8a10b21a..f24a2d22ce327aad496392bd03ca1a30eb1921fe 100644 (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);
index 2059d90941afd35dd88c3a78d395aa4a246ba6ce..881104291da770c5a08a5ffe3ffe9ea90fc33ea4 100644 (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