adapt defines for ctrl/command key

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-08-16 12:00:52 +00:00
parent 5266f34590
commit 3c5f62640d
6 changed files with 10 additions and 7 deletions

View File

@@ -307,7 +307,7 @@ wxString wxAcceleratorEntry::ToString() const
int flags = GetFlags(); int flags = GetFlags();
if ( flags & wxACCEL_ALT ) if ( flags & wxACCEL_ALT )
text += _("Alt+"); text += _("Alt+");
if ( flags & (wxACCEL_CTRL | wxACCEL_CMD) ) if ( flags & wxACCEL_CTRL )
text += _("Ctrl+"); text += _("Ctrl+");
if ( flags & wxACCEL_SHIFT ) if ( flags & wxACCEL_SHIFT )
text += _("Shift+"); text += _("Shift+");

View File

@@ -93,10 +93,10 @@ int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
{ {
wxAcceleratorEntry *entry = node->GetData(); wxAcceleratorEntry *entry = node->GetData();
if ((event.m_keyCode == entry->GetKeyCode()) && if ((event.m_keyCode == entry->GetKeyCode()) &&
(((entry->GetFlags() & wxACCEL_CTRL) != 0) == event.ControlDown()) && (((entry->GetFlags() & wxACCEL_RAW_CTRL) != 0) == event.ControlDown()) &&
(((entry->GetFlags() & wxACCEL_SHIFT) != 0) == event.ShiftDown()) && (((entry->GetFlags() & wxACCEL_SHIFT) != 0) == event.ShiftDown()) &&
(((entry->GetFlags() & wxACCEL_ALT) != 0) == event.AltDown()) && (((entry->GetFlags() & wxACCEL_ALT) != 0) == event.AltDown()) &&
(((entry->GetFlags() & wxACCEL_CMD) != 0) == event.CmdDown())) (((entry->GetFlags() & wxACCEL_CTRL) != 0) == event.CmdDown()))
{ {
return entry->GetCommand(); return entry->GetCommand();
} }

View File

@@ -137,6 +137,9 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry*
if (entry->GetFlags() & wxACCEL_CTRL) if (entry->GetFlags() & wxACCEL_CTRL)
modifiers |= NSCommandKeyMask; modifiers |= NSCommandKeyMask;
if (entry->GetFlags() & wxACCEL_RAW_CTRL)
modifiers |= NSControlKeyMask;
if (entry->GetFlags() & wxACCEL_ALT) if (entry->GetFlags() & wxACCEL_ALT)
modifiers |= NSAlternateKeyMask ; modifiers |= NSAlternateKeyMask ;

View File

@@ -80,7 +80,7 @@ wxDialog::~wxDialog()
// about it // about it
bool wxDialog::IsEscapeKey(const wxKeyEvent& event) bool wxDialog::IsEscapeKey(const wxKeyEvent& event)
{ {
if ( event.GetKeyCode() == '.' && event.GetModifiers() == wxMOD_CMD ) if ( event.GetKeyCode() == '.' && event.GetModifiers() == wxMOD_CONTROL )
return true; return true;
return wxDialogBase::IsEscapeKey(event); return wxDialogBase::IsEscapeKey(event);

View File

@@ -339,7 +339,7 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
void wxTextCtrl::OnKeyDown(wxKeyEvent& event) void wxTextCtrl::OnKeyDown(wxKeyEvent& event)
{ {
if ( event.GetModifiers() == wxMOD_CMD ) if ( event.GetModifiers() == wxMOD_CONTROL )
{ {
switch( event.GetKeyCode() ) switch( event.GetKeyCode() )
{ {

View File

@@ -2667,9 +2667,9 @@ bool wxWindowMac::RegisterHotKey(int hotkeyId, int modifiers, int keycode)
mac_modifiers |= optionKey; mac_modifiers |= optionKey;
if ( modifiers & wxMOD_SHIFT ) if ( modifiers & wxMOD_SHIFT )
mac_modifiers |= shiftKey; mac_modifiers |= shiftKey;
if ( modifiers & wxMOD_CONTROL ) if ( modifiers & wxMOD_RAW_CONTROL )
mac_modifiers |= controlKey; mac_modifiers |= controlKey;
if ( modifiers & wxMOD_META ) if ( modifiers & wxMOD_CONTROL )
mac_modifiers |= cmdKey; mac_modifiers |= cmdKey;
EventHotKeyRef hotKeyRef; EventHotKeyRef hotKeyRef;