]> git.saurik.com Git - wxWidgets.git/commitdiff
mdi menu updates fixed (after SF 1012653)
authorChris Elliott <biol75@york.ac.uk>
Wed, 1 Sep 2004 09:16:21 +0000 (09:16 +0000)
committerChris Elliott <biol75@york.ac.uk>
Wed, 1 Sep 2004 09:16:21 +0000 (09:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28985 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/frame.h
include/wx/msw/mdi.h
src/msw/mdi.cpp

index cc09dfbcb473bbdec0e77ee03562dbd8e2e56de2..adb10c54a0b43c4ec8ab44c5b1f40d5ad45efbb4 100644 (file)
@@ -157,7 +157,7 @@ public:
 
     // send wxUpdateUIEvents for all menu items in the menubar,
     // or just for menu if non-NULL
-    void DoMenuUpdates(wxMenu* menu = NULL);
+    virtual void DoMenuUpdates(wxMenu* menu = NULL);
 #endif // wxUSE_MENUS
 
     // do the UI update processing for this window
index 714c0975925bbf47046d066544bd9ff69896e61a..a6fc56445b67746d4a9338aa649fc12ab1e4785d 100644 (file)
@@ -69,7 +69,8 @@ public:
     // MDI windows menu
     wxMenu* GetWindowMenu() const { return m_windowMenu; };
     void SetWindowMenu(wxMenu* menu) ;
-
+    virtual void DoMenuUpdates(wxMenu* menu = NULL);
+    
     // MDI operations
     // --------------
     virtual void Cascade();
index b1d924d27dacc1598cb24b205c654f053f658c8e..4bbb0a2b560ddb44910e41ec62500e7f7f54e2f2 100644 (file)
@@ -300,6 +300,34 @@ void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
     }
 }
 
+void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu)
+{
+    wxMDIChildFrame *child = GetActiveChild();
+    if ( child )
+    {
+        wxEvtHandler* source = child->GetEventHandler();
+        wxMenuBar* bar = child->GetMenuBar();
+
+        if (menu)
+        {
+            menu->UpdateUI(source);
+        }
+        else
+        {
+            if ( bar != NULL )
+            {
+                int nCount = bar->GetMenuCount();
+                for (int n = 0; n < nCount; n++)
+                bar->GetMenu(n)->UpdateUI(source);
+            }
+        }
+    }
+    else
+    {
+        wxFrameBase::DoMenuUpdates(menu);
+    }
+}
+
 void wxMDIParentFrame::OnSize(wxSizeEvent&)
 {
     if ( GetClientWindow() )