void wxMDIParentFrame::SetWindowMenu(wxMenu* menu) { if ( menu != m_windowMenu ) { // We may not be showing the window menu currently if we don't have any // children, and in this case we shouldn't remove/add it back right now. const bool hasWindowMenu = GetActiveChild() != NULL; if ( hasWindowMenu ) RemoveWindowMenu(); delete m_windowMenu; m_windowMenu = menu; if ( hasWindowMenu ) AddWindowMenu(); } #if wxUSE_ACCEL wxDELETE(m_accelWindowMenu); if ( menu && menu->HasAccels() ) m_accelWindowMenu = menu->CreateAccelTable(); #endif // wxUSE_ACCEL }
void wxGenericMDIParentFrame::SetMenuBar(wxMenuBar *pMenuBar) { // Remove the Window menu from the old menu bar RemoveWindowMenu(GetMenuBar()); // Add the Window menu to the new menu bar. AddWindowMenu(pMenuBar); wxFrame::SetMenuBar(pMenuBar); }
void wxMDIParentFrame::InternalSetMenuBar() { if ( GetActiveChild() ) { AddWindowMenu(); } else // we don't have any MDI children yet { // wait until we do to add the window menu but do set the main menu for // now (this is done by AddWindowMenu() as a side effect) MDISetMenu(GetClientWindow(), (HMENU)m_hMenu, NULL); } }
void wxAuiMDIParentFrame::SetWindowMenu(wxMenu* pMenu) { // Replace the window menu from the currently loaded menu bar. wxMenuBar *pMenuBar = GetMenuBar(); if (m_pWindowMenu) { RemoveWindowMenu(pMenuBar); wxDELETE(m_pWindowMenu); } if (pMenu) { m_pWindowMenu = pMenu; AddWindowMenu(pMenuBar); } }
void wxMDIParentFrame::AddMDIChild(wxMDIChildFrame * WXUNUSED(child)) { switch ( GetChildFramesCount() ) { case 1: // first MDI child was just added, we need to insert the window // menu now if we have it AddWindowMenu(); // and disable the items which can't be used until we have more // than one child UpdateWindowMenu(false); break; case 2: // second MDI child was added, enable the menu items which were // disabled because they didn't make sense for a single window UpdateWindowMenu(true); break; } }
void wxMDIParentFrame::SetWindowMenu(wxMenu* menu) { if ( menu != m_windowMenu ) { // notice that Remove/AddWindowMenu() are safe to call even when // m_windowMenu is NULL RemoveWindowMenu(); delete m_windowMenu; m_windowMenu = menu; AddWindowMenu(); } #if wxUSE_ACCEL wxDELETE(m_accelWindowMenu); if ( menu && menu->HasAccels() ) m_accelWindowMenu = menu->CreateAccelTable(); #endif // wxUSE_ACCEL }