protect separators against inappropriate state changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -103,6 +103,9 @@ void wxMenuItem::UpdateItemStatus()
|
|||||||
if ( !m_parentMenu )
|
if ( !m_parentMenu )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
|
if ( IsSeparator() )
|
||||||
|
return ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId)
|
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId)
|
||||||
{
|
{
|
||||||
@@ -111,6 +114,7 @@ void wxMenuItem::UpdateItemStatus()
|
|||||||
else
|
else
|
||||||
EnableMenuCommand( NULL , kHICommandPreferences ) ;
|
EnableMenuCommand( NULL , kHICommandPreferences ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macExitMenuItemId)
|
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macExitMenuItemId)
|
||||||
{
|
{
|
||||||
if ( !IsEnabled() )
|
if ( !IsEnabled() )
|
||||||
@@ -119,6 +123,7 @@ void wxMenuItem::UpdateItemStatus()
|
|||||||
EnableMenuCommand( NULL , kHICommandQuit ) ;
|
EnableMenuCommand( NULL , kHICommandQuit ) ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
||||||
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
||||||
@@ -154,7 +159,6 @@ void wxMenuItem::UpdateItemText()
|
|||||||
delete entry ;
|
delete entry ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxMenuItem::Enable(bool bDoEnable)
|
void wxMenuItem::Enable(bool bDoEnable)
|
||||||
{
|
{
|
||||||
if (( m_isEnabled != bDoEnable
|
if (( m_isEnabled != bDoEnable
|
||||||
@@ -174,6 +178,7 @@ void wxMenuItem::Enable(bool bDoEnable)
|
|||||||
UpdateItemStatus() ;
|
UpdateItemStatus() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuItem::UncheckRadio()
|
void wxMenuItem::UncheckRadio()
|
||||||
{
|
{
|
||||||
if ( m_isChecked )
|
if ( m_isChecked )
|
||||||
@@ -185,7 +190,7 @@ void wxMenuItem::UncheckRadio()
|
|||||||
|
|
||||||
void wxMenuItem::Check(bool bDoCheck)
|
void wxMenuItem::Check(bool bDoCheck)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") );
|
wxCHECK_RET( IsCheckable() && !IsSeparator(), wxT("only checkable items may be checked") );
|
||||||
|
|
||||||
if ( m_isChecked != bDoCheck )
|
if ( m_isChecked != bDoCheck )
|
||||||
{
|
{
|
||||||
@@ -203,8 +208,7 @@ void wxMenuItem::Check(bool bDoCheck)
|
|||||||
_T("menuitem not found in the menu items list?") );
|
_T("menuitem not found in the menu items list?") );
|
||||||
|
|
||||||
// get the radio group range
|
// get the radio group range
|
||||||
int start,
|
int start, end;
|
||||||
end;
|
|
||||||
|
|
||||||
if ( m_isRadioGroupStart )
|
if ( m_isRadioGroupStart )
|
||||||
{
|
{
|
||||||
@@ -224,9 +228,8 @@ void wxMenuItem::Check(bool bDoCheck)
|
|||||||
for ( int n = start; n <= end && node; n++ )
|
for ( int n = start; n <= end && node; n++ )
|
||||||
{
|
{
|
||||||
if ( n != pos )
|
if ( n != pos )
|
||||||
{
|
|
||||||
((wxMenuItem*)node->GetData())->UncheckRadio();
|
((wxMenuItem*)node->GetData())->UncheckRadio();
|
||||||
}
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user