From: Stefan Csomor Date: Wed, 2 Mar 2011 15:43:42 +0000 (+0000) Subject: supporting more key equivalents for display, fixing setHidden: method warning X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9c894932284cac53d9cd8d8b2f16308bc65f44d6 supporting more key equivalents for display, fixing setHidden: method warning git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/menuitem.mm b/src/osx/cocoa/menuitem.mm index 8599af3a61..ee55d575df 100644 --- a/src/osx/cocoa/menuitem.mm +++ b/src/osx/cocoa/menuitem.mm @@ -145,71 +145,59 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry* { switch ( key ) { -/* - // standard function keys from here - case WXK_TAB : - modifiers |= NSFunctionKeyMask ; - shortcut = NSTabCharacter ; - break ; - - case kEnterCharCode : - modifiers |= NSFunctionKeyMask ; - cocoaKey = NSTabCharacter ; - break ; - - case WXK_RETURN : - modifiers |= NSFunctionKeyMask ; - cocoaKey = NSTabCharacter ; - break ; - - case WXK_ESCAPE : - modifiers |= NSFunctionKeyMask ; - cocoaKey = kEscapeCharCode ; - break ; - - case WXK_SPACE : - shortcut = ' ' ; - break ; - - case WXK_CLEAR : - cocoaKey = kClearCharCode ; + modifiers |= NSFunctionKeyMask; + shortcut = NSDeleteCharacter ; break ; case WXK_PAGEUP : - cocoaKey = kPageUpCharCode ; + modifiers |= NSFunctionKeyMask; + shortcut = NSPageUpFunctionKey ; break ; case WXK_PAGEDOWN : - cocoaKey = kPageDownCharCode ; + modifiers |= NSFunctionKeyMask; + shortcut = NSPageDownFunctionKey ; break ; case WXK_LEFT : - cocoaKey = kLeftArrowCharCode ; + modifiers |= NSNumericPadKeyMask | NSFunctionKeyMask; + shortcut = NSLeftArrowFunctionKey ; break ; case WXK_UP : - cocoaKey = kUpArrowCharCode ; + modifiers |= NSNumericPadKeyMask | NSFunctionKeyMask; + shortcut = NSUpArrowFunctionKey ; break ; case WXK_RIGHT : - cocoaKey = kRightArrowCharCode ; + modifiers |= NSNumericPadKeyMask | NSFunctionKeyMask; + shortcut = NSRightArrowFunctionKey ; break ; case WXK_DOWN : - cocoaKey = kDownArrowCharCode ; + modifiers |= NSNumericPadKeyMask | NSFunctionKeyMask; + shortcut = NSDownArrowFunctionKey ; break ; case WXK_HOME : - cocoaKey = kHomeCharCode ; + modifiers |= NSFunctionKeyMask; + shortcut = NSHomeFunctionKey ; break ; case WXK_END : - cocoaKey = kEndCharCode ; + modifiers |= NSFunctionKeyMask; + shortcut = NSEndFunctionKey ; break ; -*/ - // TODO Test all above with their function key equiv. - // from NSEvent.h + + case WXK_NUMPAD_ENTER : + shortcut = NSEnterCharacter; + break; + + case WXK_BACK : + case WXK_RETURN : + case WXK_TAB : + case WXK_ESCAPE : default : if(entry->GetFlags() & wxACCEL_SHIFT) shortcut = toupper(key); @@ -224,6 +212,10 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry* } } +@interface NSMenuItem(PossibleMethods) +- (void)setHidden:(BOOL)hidden; +@end + class wxMenuItemCocoaImpl : public wxMenuItemImpl { public :