X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc2fe7b20452a860c781b15c91ebb8c447ff137d..96c9640205933ad0673d5af2c96af0816c50160c:/src/msw/mdi.cpp?ds=inline diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 104ea7a9d8..dd19650db6 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -138,6 +138,14 @@ END_EVENT_TABLE() // the children // =========================================================================== +void wxMDIParentFrame::Init() +{ +#if wxUSE_MENUS && wxUSE_ACCEL + // the default menu doesn't have any accelerators (even if we have it) + m_accelWindowMenu = NULL; +#endif // wxUSE_MENUS && wxUSE_ACCEL +} + bool wxMDIParentFrame::Create(wxWindow *parent, wxWindowID id, const wxString& title, @@ -162,11 +170,6 @@ bool wxMDIParentFrame::Create(wxWindow *parent, m_windowMenu->Append(wxID_MDI_WINDOW_PREV, _("&Previous")); } -#if wxUSE_MENUS && wxUSE_ACCEL - // the default menu doesn't have any accelerators (even if we have it) - m_accelWindowMenu = NULL; -#endif // wxUSE_MENUS && wxUSE_ACCEL - if (!parent) wxTopLevelWindows.Append(this); @@ -314,13 +317,23 @@ void wxMDIParentFrame::RemoveMDIChild(wxMDIChildFrame * WXUNUSED(child)) void wxMDIParentFrame::AddWindowMenu() { if ( m_windowMenu ) + { + // For correct handling of the events from this menu we also must + // attach it to the menu bar. + m_windowMenu->Attach(GetMenuBar()); + MDIInsertWindowMenu(GetClientWindow(), m_hMenu, GetMDIWindowMenu(this)); + } } void wxMDIParentFrame::RemoveWindowMenu() { if ( m_windowMenu ) + { MDIRemoveWindowMenu(GetClientWindow(), m_hMenu); + + m_windowMenu->Detach(); + } } void wxMDIParentFrame::UpdateWindowMenu(bool enable) @@ -366,8 +379,7 @@ void wxMDIParentFrame::SetWindowMenu(wxMenu* menu) } #if wxUSE_ACCEL - delete m_accelWindowMenu; - m_accelWindowMenu = NULL; + wxDELETE(m_accelWindowMenu); if ( menu && menu->HasAccels() ) m_accelWindowMenu = menu->CreateAccelTable(); @@ -571,19 +583,6 @@ WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message, processed = true; break; - - case WM_ERASEBKGND: - processed = true; - - // we erase background ourselves - rc = true; - break; - - case WM_SIZE: - // though we don't (usually) resize the MDI client to exactly fit - // the client area we need to pass this one to DefFrameProc to - // allow the children to show - break; } if ( !processed ) @@ -696,7 +695,7 @@ bool wxMDIParentFrame::TryBefore(wxEvent& event) if ( event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED ) { wxMDIChildFrame * const child = GetActiveChild(); - if ( child && child->ProcessEventHere(event) ) + if ( child && child->ProcessWindowEventLocally(event) ) return true; } @@ -1122,7 +1121,7 @@ bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), WXHMENU hMenuParent = parent->m_hMenu; - // activate the the parent menu only when there is no other child + // activate the parent menu only when there is no other child // that has been activated if ( hMenuParent && !hwndAct ) hMenuToSet = hMenuParent;