- (id) initWithTitle:(NSString *)aString action:(SEL)aSelector keyEquivalent:(NSString *)charCode
{
- [super initWithTitle:aString action:aSelector keyEquivalent:charCode];
- return self;
+ self = [super initWithTitle:aString action:aSelector keyEquivalent:charCode];
+ return self;
}
- (void) clickedAction: (id) sender
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 ;
}
void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry* entry )
{
+ if ( entry == NULL )
+ {
+ [menuItem setKeyEquivalent:@""];
+ return;
+ }
+
unsigned int modifiers = 0 ;
int key = entry->GetKeyCode() ;
if ( key )
wxCFStringRef cfText(text);
[m_osxMenuItem setTitle:cfText.AsNSString()];
- if ( entry )
- wxMacCocoaMenuItemSetAccelerator( m_osxMenuItem, entry );
-
+ wxMacCocoaMenuItemSetAccelerator( m_osxMenuItem, entry );
}
bool DoDefault();
wxCFStringRef cfText(text);
SEL selector = nil;
bool targetSelf = false;
- if ( ! pParentMenu->GetNoEventsMode() && pSubMenu == NULL )
+ if ( (pParentMenu == NULL || !pParentMenu->GetNoEventsMode()) && pSubMenu == NULL )
{
selector = wxOSXGetSelectorFromID(menuid);
}
else
{
- if ( entry )
- wxMacCocoaMenuItemSetAccelerator( menuitem, entry );
+ wxMacCocoaMenuItemSetAccelerator( menuitem, entry );
}
item = menuitem;
}