]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
WinCE fixes (in case a WinCE-friendly backend gets written one day)
[wxWidgets.git] / src / msw / mdi.cpp
index 51ab9de541f54197a11ba121136b3867adaebfe2..c61e986fa4e0b7d8833b541e696df1a24d6e9af9 100644 (file)
@@ -807,6 +807,11 @@ bool wxMDIChildFrame::Show(bool show)
     if ( show )
         ::BringWindowToTop(GetHwnd());
 
+    // we need to refresh the MDI frame window menu to include (or exclude if
+    // we've been hidden) this frame
+    wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+    MDISetMenu(parent->GetClientWindow(), NULL, NULL);
+
     return true;
 }
 
@@ -1160,7 +1165,9 @@ WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXL
 
 bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
 {
-    return wxFrame::MSWTranslateMessage(msg);
+    // we must pass the parent frame to ::TranslateAccelerator(), otherwise it
+    // doesn't do its job correctly for MDI child menus
+    return MSWDoTranslateMessage((wxMDIChildFrame *)GetParent(), msg);
 }
 
 // ---------------------------------------------------------------------------
@@ -1373,8 +1380,16 @@ void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
 
 static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow)
 {
-    ::SendMessage(GetWinHwnd(win), WM_MDISETMENU,
-                  (WPARAM)hmenuFrame, (LPARAM)hmenuWindow);
+    if ( hmenuFrame || hmenuWindow )
+    {
+        if ( !::SendMessage(GetWinHwnd(win),
+                            WM_MDISETMENU,
+                            (WPARAM)hmenuFrame,
+                            (LPARAM)hmenuWindow) )
+        {
+            wxLogLastError(_T("SendMessage(WM_MDISETMENU)"));
+        }
+    }
 
     // update menu bar of the parent window
     wxWindow *parent = win->GetParent();