bringing ctrl and cmd accel handling for menus in line with pure key event handling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@57852 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -194,7 +194,11 @@ wxAcceleratorEntry::ParseAccel(const wxString& text, int *flagsOut, int *keyOut)
|
||||
{
|
||||
if ( (label[n] == '+') || (label[n] == '-') )
|
||||
{
|
||||
// differentiate between a ctrl that will be translated to cmd on mac
|
||||
// and an explicit xctrl that will not be translated and remains a ctrl
|
||||
if ( CompareAccelString(current, wxTRANSLATE("ctrl")) )
|
||||
accelFlags |= wxACCEL_CMD;
|
||||
else if ( CompareAccelString(current, wxTRANSLATE("xctrl")) )
|
||||
accelFlags |= wxACCEL_CTRL;
|
||||
else if ( CompareAccelString(current, wxTRANSLATE("alt")) )
|
||||
accelFlags |= wxACCEL_ALT;
|
||||
@@ -312,8 +316,12 @@ wxString wxAcceleratorEntry::ToString() const
|
||||
int flags = GetFlags();
|
||||
if ( flags & wxACCEL_ALT )
|
||||
text += _("Alt-");
|
||||
if ( flags & wxACCEL_CTRL )
|
||||
if ( flags & wxACCEL_CMD )
|
||||
text += _("Ctrl-");
|
||||
#ifdef __WXMAC__
|
||||
if ( flags & wxACCEL_CTRL )
|
||||
text += _("XCtrl-");
|
||||
#endif
|
||||
if ( flags & wxACCEL_SHIFT )
|
||||
text += _("Shift-");
|
||||
|
||||
|
@@ -193,7 +193,9 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEn
|
||||
SInt16 key = entry->GetKeyCode() ;
|
||||
if ( key )
|
||||
{
|
||||
bool explicitCommandKey = (entry->GetFlags() & wxACCEL_CTRL);
|
||||
bool explicitCommandKey = (entry->GetFlags() & wxACCEL_CMD);
|
||||
if ( !explicitCommandKey )
|
||||
modifiers |= kMenuNoCommandModifier ;
|
||||
|
||||
if (entry->GetFlags() & wxACCEL_ALT)
|
||||
modifiers |= kMenuOptionModifier ;
|
||||
@@ -201,12 +203,14 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEn
|
||||
if (entry->GetFlags() & wxACCEL_SHIFT)
|
||||
modifiers |= kMenuShiftModifier ;
|
||||
|
||||
if (entry->GetFlags() & wxACCEL_CTRL)
|
||||
modifiers |= kMenuControlModifier ;
|
||||
|
||||
|
||||
SInt16 glyph = 0 ;
|
||||
SInt16 macKey = key ;
|
||||
if ( key >= WXK_F1 && key <= WXK_F15 )
|
||||
{
|
||||
if ( !explicitCommandKey )
|
||||
modifiers |= kMenuNoCommandModifier ;
|
||||
|
||||
// for some reasons this must be 0 right now
|
||||
// everything else leads to just the first function key item
|
||||
@@ -303,11 +307,6 @@ void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEn
|
||||
macKey = toupper( key ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
// we now allow non command key shortcuts
|
||||
// remove in case this gives problems
|
||||
if ( !explicitCommandKey )
|
||||
modifiers |= kMenuNoCommandModifier ;
|
||||
}
|
||||
|
||||
// 1d and 1e have special meaning to SetItemCmd, so
|
||||
|
Reference in New Issue
Block a user