X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/396e9eb8e296a2e128efa16c88c7899275b454ec..7447d53c35249d42128d6243c90998f03882859a:/src/msw/mdi.cpp diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 6dd3e63db5..8b0ab4e871 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -190,7 +190,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent, msflags &= ~WS_HSCROLL; if ( !wxWindow::MSWCreate(wxApp::GetRegisteredClassName(wxT("wxMDIFrame")), - title.wx_str(), + title.t_str(), pos, size, msflags, exflags) ) @@ -317,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) @@ -369,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(); @@ -786,8 +795,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, if ( !(style & wxFULL_REPAINT_ON_RESIZE) ) className += wxApp::GetNoRedrawClassSuffix(); - mcs.szClass = className.wx_str(); - mcs.szTitle = title.wx_str(); + mcs.szClass = className.t_str(); + mcs.szTitle = title.t_str(); mcs.hOwner = wxGetInstance(); if (x != wxDefaultCoord) mcs.x = x; @@ -1112,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; @@ -1365,7 +1374,7 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF while (node) { wxWindow *child = node->GetData(); - if (child->IsKindOf(CLASSINFO(wxMDIChildFrame))) + if (wxDynamicCast(child, wxMDIChildFrame)) { ::RedrawWindow(GetHwndOf(child), NULL, @@ -1464,7 +1473,7 @@ void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin) inserted = true; ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)menuWin, - wxString(wxGetTranslation(WINDOW_MENU_LABEL)).wx_str()); + wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str()); break; } } @@ -1473,7 +1482,7 @@ void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin) { ::AppendMenu(hmenu, MF_POPUP, (UINT_PTR)menuWin, - wxString(wxGetTranslation(WINDOW_MENU_LABEL)).wx_str()); + wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str()); } }