+ wxLogTrace(wxTRACE_COCOA,wxT("wxFrame::wxMenuItemAction"));
+ wxMenuItem *item = wxMenuItem::GetFromCocoa(menuItem);
+ wxCHECK_RET(item,wxT("wxMenuItemAction received but no wxMenuItem exists!"));
+
+ wxMenu *menu = item->GetMenu();
+ wxCHECK_RET(menu,wxT("wxMenuItemAction received but wxMenuItem is not in a wxMenu!"));
+
+ // Since we're handling the delegate messages there's a very good chance
+ // we'll receive a menu action from an item with a nil target.
+ wxMenuBar *menubar = menu->GetMenuBar();
+ if(menubar)
+ {
+ wxFrame *frame = menubar->GetFrame();
+ wxASSERT_MSG(frame==this, wxT("Received wxMenuItemAction in NSWindow delegate from a menu item attached to a different frame."));
+ frame->ProcessCommand(item->GetId());
+ }
+ else
+ wxLogDebug(wxT("Received wxMenuItemAction in NSWindow delegate from an unknown menu item."));