disable the "Next" and "Previous" commands in the window menu if we have a single child only; update the copyright
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,10 +2,11 @@
|
|||||||
// Name: src/msw/mdi.cpp
|
// Name: src/msw/mdi.cpp
|
||||||
// Purpose: MDI classes for wxMSW
|
// Purpose: MDI classes for wxMSW
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by: Vadim Zeitlin on 2008-11-04 to use the base classes
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) 1998 Julian Smart
|
||||||
|
// (c) 2008-2009 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -249,21 +250,44 @@ int wxMDIParentFrame::GetChildFramesCount() const
|
|||||||
|
|
||||||
void wxMDIParentFrame::AddMDIChild(wxMDIChildFrame * WXUNUSED(child))
|
void wxMDIParentFrame::AddMDIChild(wxMDIChildFrame * WXUNUSED(child))
|
||||||
{
|
{
|
||||||
if ( GetChildFramesCount() == 1 )
|
switch ( GetChildFramesCount() )
|
||||||
{
|
{
|
||||||
// first MDI child added, we need to insert the window menu now if we
|
case 1:
|
||||||
// have it
|
// first MDI child was just added, we need to insert the window
|
||||||
AddWindowMenu();
|
// 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::RemoveMDIChild(wxMDIChildFrame * WXUNUSED(child))
|
void wxMDIParentFrame::RemoveMDIChild(wxMDIChildFrame * WXUNUSED(child))
|
||||||
{
|
{
|
||||||
if ( GetChildFramesCount() == 1 )
|
switch ( GetChildFramesCount() )
|
||||||
{
|
{
|
||||||
// last MDI child is being removed, remove the now unnecessary window
|
case 1:
|
||||||
// menu too
|
// last MDI child is being removed, remove the now unnecessary
|
||||||
RemoveWindowMenu();
|
// window menu too
|
||||||
|
RemoveWindowMenu();
|
||||||
|
|
||||||
|
// there is no need to call UpdateWindowMenu(true) here so this is
|
||||||
|
// not quite symmetric to AddMDIChild() above
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// only one MDI child is going to remain, disable the menu commands
|
||||||
|
// which don't make sense for a single child window
|
||||||
|
UpdateWindowMenu(false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,6 +307,15 @@ void wxMDIParentFrame::RemoveWindowMenu()
|
|||||||
MDIRemoveWindowMenu(GetClientWindow(), m_hMenu);
|
MDIRemoveWindowMenu(GetClientWindow(), m_hMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxMDIParentFrame::UpdateWindowMenu(bool enable)
|
||||||
|
{
|
||||||
|
if ( m_windowMenu )
|
||||||
|
{
|
||||||
|
m_windowMenu->Enable(IDM_WINDOWNEXT, enable);
|
||||||
|
m_windowMenu->Enable(IDM_WINDOWPREV, enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if wxUSE_MENUS_NATIVE
|
#if wxUSE_MENUS_NATIVE
|
||||||
|
|
||||||
void wxMDIParentFrame::InternalSetMenuBar()
|
void wxMDIParentFrame::InternalSetMenuBar()
|
||||||
|
Reference in New Issue
Block a user