making sure

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2011-05-31 08:09:18 +00:00
parent 1ee1662007
commit 40a35c1f87
3 changed files with 19 additions and 9 deletions

View File

@ -79,7 +79,10 @@ void UMAInsertSubMenuItem( MenuRef menu , const wxString& title, wxFontEncoding
void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry )
{
if ( !entry )
{
SetMenuItemCommandKey(menu, item, false, 0);
return ;
}
UInt8 modifiers = 0 ;
SInt16 key = entry->GetKeyCode() ;

View File

@ -100,8 +100,12 @@ SEL wxOSXGetSelectorFromID(int menuId )
wxUnusedVar(menuItem);
if( impl )
{
if ( impl->GetWXPeer()->GetMenu()->HandleCommandUpdateStatus(impl->GetWXPeer()) )
return impl->GetWXPeer()->IsEnabled();
wxMenuItem* wxmenuitem = impl->GetWXPeer();
if ( wxmenuitem )
{
wxmenuitem->GetMenu()->HandleCommandUpdateStatus(wxmenuitem);
return wxmenuitem->IsEnabled();
}
}
return YES ;
}
@ -120,6 +124,12 @@ SEL wxOSXGetSelectorFromID(int menuId )
void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry* entry )
{
if ( entry == NULL )
{
[menuItem setKeyEquivalent:@""];
return;
}
unsigned int modifiers = 0 ;
int key = entry->GetKeyCode() ;
if ( key )
@ -256,9 +266,7 @@ public :
wxCFStringRef cfText(text);
[m_osxMenuItem setTitle:cfText.AsNSString()];
if ( entry )
wxMacCocoaMenuItemSetAccelerator( m_osxMenuItem, entry );
wxMacCocoaMenuItemSetAccelerator( m_osxMenuItem, entry );
}
bool DoDefault();
@ -342,8 +350,7 @@ wxMenuItemImpl* wxMenuItemImpl::Create( wxMenuItem* peer, wxMenu *pParentMenu,
}
else
{
if ( entry )
wxMacCocoaMenuItemSetAccelerator( menuitem, entry );
wxMacCocoaMenuItemSetAccelerator( menuitem, entry );
}
item = menuitem;
}

View File

@ -299,8 +299,8 @@ extern int wxOSXGetIdFromSelector(SEL action );
wxMenuItem* menuitem = mbar->FindItem(wxOSXGetIdFromSelector(action), &menu);
if ( menu != NULL && menuitem != NULL)
{
if ( menu->HandleCommandUpdateStatus(menuitem) )
return menuitem->IsEnabled();
menu->HandleCommandUpdateStatus(menuitem);
return menuitem->IsEnabled();
}
}
return YES;