Unlike the preferences item which should only be enabled if it exists and is enabled, the quit item should be enabled unless it both exists and is disabled, otherwise Quit will not be enabled unless the application specifically adds wxID_EXIT. This should fix David's bug but still retain the old functionality. [ modified previously committed patch 1160343 ]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32851 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Hock 2005-03-16 16:03:17 +00:00
parent 9f995cfd1c
commit 3e275c2d1d

View File

@ -675,10 +675,14 @@ void wxMenuBar::MacInstallMenuBar()
else
EnableMenuCommand( NULL , kHICommandPreferences ) ;
}
// Unlike preferences which may or may not exist, the Quit item should be always
// enabled unless it is added by the application and then disabled, otherwise
// a program would be required to add an item with wxID_EXIT in order to get the
// Quit menu item to be enabled, which seems a bit burdensome.
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macExitMenuItemId)
{
wxMenuItem *item = FindItem( wxApp::s_macExitMenuItemId , NULL ) ;
if ( item == NULL || !(item->IsEnabled()) )
if ( item != NULL && !(item->IsEnabled()) )
DisableMenuCommand( NULL , kHICommandQuit ) ;
else
EnableMenuCommand( NULL , kHICommandQuit ) ;