]> git.saurik.com Git - wxWidgets.git/commitdiff
Undo "Forward events to active child at MSW, not wx, level in wxMDIParentFrame."
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 23 Jun 2013 13:07:55 +0000 (13:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 23 Jun 2013 13:07:55 +0000 (13:07 +0000)
Unfortunately, forwarding MSW messages only takes care of the menu events but
not the toolbar ones -- which should be handled in the same way but were not.

So restore the old behaviour, the problem with menu items disabled in the
parent frame but enabled in the child one will be fixed differently.

This reverts r73927.

See #14314.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index afef0664a4b7567c071aac1622a11a7da612c141..caf235fd56a68ec7578df102d48bf70b0cdef00d 100644 (file)
@@ -110,6 +110,9 @@ public:
 #endif // wxUSE_MENUS
 
 protected:
+    // override to pass menu/toolbar events to the active child first
+    virtual bool TryBefore(wxEvent& event);
+
 #if wxUSE_MENUS_NATIVE
     virtual void InternalSetMenuBar();
 #endif // wxUSE_MENUS_NATIVE
index 6ecd832ea5358c012073253ea7880d6c77789540..db1997bdd6f7aa465e8c0ddb420e27aeddd86ae7 100644 (file)
@@ -577,19 +577,6 @@ WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message,
                     MSWDefWindowProc(message, wParam, lParam);
                     processed = true;
                 }
-                else // Not a system command.
-                {
-                    // Menu (and toolbar) events should be sent to the active
-                    // child first and only be processed by the parent frame if
-                    // they're not handled there.
-                    if ( wxMDIChildFrame* child = GetActiveChild() )
-                    {
-                        processed = child->MSWHandleMessage(&rc,
-                                                            message,
-                                                            wParam,
-                                                            lParam);
-                    }
-                }
             }
             break;
 
@@ -708,6 +695,20 @@ void wxMDIParentFrame::OnMDICommand(wxCommandEvent& event)
 
 #endif // wxUSE_MENUS
 
+bool wxMDIParentFrame::TryBefore(wxEvent& event)
+{
+    // menu (and toolbar) events should be sent to the active child frame
+    // first, if any
+    if ( event.GetEventType() == wxEVT_MENU )
+    {
+        wxMDIChildFrame * const child = GetActiveChild();
+        if ( child && child->ProcessWindowEventLocally(event) )
+            return true;
+    }
+
+    return wxMDIParentFrameBase::TryBefore(event);
+}
+
 WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message,
                                         WXWPARAM wParam,
                                         WXLPARAM lParam)