X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4da39c96469760962116bee9f35a0ef54f445cb6..f80ffb32eb597f7b051ed1705c72b2934eb2eb30:/src/mac/carbon/uma.cpp diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index b7061575ad..3e60338538 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -36,7 +36,7 @@ // since we have decided that we only support 8.6 upwards we are // checking for these minimum requirements in the startup code of -// the application so all wxWindows code can safely assume that appearance 1.1 +// the application so all wxWidgets code can safely assume that appearance 1.1 // windows manager, control manager, navigation services etc. are // present @@ -318,7 +318,7 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEn glyph += 13 ; if ( !explicitCommandKey ) modifiers |= kMenuNoCommandModifier ; - } + } else { switch( key ) @@ -379,10 +379,21 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEn macKey = kDownArrowCharCode ; glyph = kMenuDownArrowGlyph ; break ; + default : + macKey = toupper( key ) ; + break ; } + // we now allow non command key shortcuts + // remove in case this gives problems + if ( !explicitCommandKey ) + modifiers |= kMenuNoCommandModifier ; } - SetItemCmd( menu, item , macKey ); + // 1d and 1e have special meaning to SetItemCmd, so + // do not use for these character codes. + if (key != WXK_UP && key != WXK_RIGHT) + SetItemCmd( menu, item , macKey ); + SetMenuItemModifiers(menu, item , modifiers ) ; if ( glyph ) @@ -393,6 +404,8 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEn void UMAAppendMenuItem( MenuRef menu , const wxString& title, wxFontEncoding encoding , wxAcceleratorEntry *entry ) { MacAppendMenu(menu, "\pA"); + // don't attempt to interpret metacharacters like a '-' at the beginning (would become a separator otherwise) + ChangeMenuItemAttributes( menu , ::CountMenuItems(menu), kMenuItemAttrIgnoreMeta , 0 ) ; UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title , encoding ); UMASetMenuItemShortcut( menu , (SInt16) ::CountMenuItems(menu), entry ) ; } @@ -400,6 +413,8 @@ void UMAAppendMenuItem( MenuRef menu , const wxString& title, wxFontEncoding enc void UMAInsertMenuItem( MenuRef menu , const wxString& title, wxFontEncoding encoding , MenuItemIndex item , wxAcceleratorEntry *entry ) { MacInsertMenuItem( menu , "\pA" , item) ; + // don't attempt to interpret metacharacters like a '-' at the beginning (would become a separator otherwise) + ChangeMenuItemAttributes( menu , item+1, kMenuItemAttrIgnoreMeta , 0 ) ; UMASetMenuItemText(menu, item+1 , title , encoding ); UMASetMenuItemShortcut( menu , item+1 , entry ) ; } @@ -632,22 +647,6 @@ OSErr UMASetKeyboardFocus (WindowPtr inWindow, return err ; } -// events -void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) -{ - wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) inWindow) ) ; - RgnHandle updateRgn = NewRgn() ; - GetWindowUpdateRgn( inWindow , updateRgn ) ; - - Point zero = { 0 , 0 } ; - LocalToGlobal( &zero ) ; - OffsetRgn( updateRgn , -zero.h , -zero.v ) ; - - UpdateControls( inWindow , inRgn ) ; - InvalWindowRgn( inWindow, updateRgn) ; - DisposeRgn( updateRgn ) ; -} - bool UMAIsWindowFloating( WindowRef inWindow ) { WindowClass cl ;