retval = WXK_TAB;
break;
- default :
+ case 75: // /
+ retval = WXK_NUMPAD_DIVIDE;
+ break;
+ case 67: // *
+ retval = WXK_NUMPAD_MULTIPLY;
+ break;
+ case 78: // -
+ retval = WXK_NUMPAD_SUBTRACT;
+ break;
+ case 69: // +
+ retval = WXK_NUMPAD_ADD;
+ break;
+ case 76: // Enter
+ retval = WXK_NUMPAD_ENTER;
+ break;
+ case 65: // .
+ retval = WXK_NUMPAD_DECIMAL;
+ break;
+ case 82: // 0
+ retval = WXK_NUMPAD0;
+ break;
+ case 83: // 1
+ retval = WXK_NUMPAD1;
+ break;
+ case 84: // 2
+ retval = WXK_NUMPAD2;
+ break;
+ case 85: // 3
+ retval = WXK_NUMPAD3;
+ break;
+ case 86: // 4
+ retval = WXK_NUMPAD4;
+ break;
+ case 87: // 5
+ retval = WXK_NUMPAD5;
+ break;
+ case 88: // 6
+ retval = WXK_NUMPAD6;
+ break;
+ case 89: // 7
+ retval = WXK_NUMPAD7;
+ break;
+ case 91: // 8
+ retval = WXK_NUMPAD8;
+ break;
+ case 92: // 9
+ retval = WXK_NUMPAD9;
+ break;
+ default:
+ //retval = [event keyCode];
break;
}
return retval;
wxevent.m_rawFlags = modifiers;
wxevent.SetTimestamp( [nsEvent timestamp] * 1000.0 ) ;
- switch (eventType)
- {
- case NSKeyDown :
- wxevent.SetEventType( wxEVT_KEY_DOWN ) ;
- break;
- case NSKeyUp :
- wxevent.SetEventType( wxEVT_KEY_UP ) ;
- break;
- case NSFlagsChanged :
- // setup common code here
- break;
- default :
- break ;
- }
wxString chars;
if ( eventType != NSFlagsChanged )
{
- NSString* nschars = [nsEvent characters];
+ NSString* nschars = (wxevent.GetEventType() != wxEVT_CHAR) ? [nsEvent charactersIgnoringModifiers] : [nsEvent characters];
if ( charString )
{
// if charString is set, it did not come from key up / key down
long keyval = 0;
if (wxevent.GetEventType() != wxEVT_CHAR)
+ {
keyval = wxOSXTranslateCocoaKey(nsEvent) ;
+ switch (eventType)
+ {
+ case NSKeyDown :
+ wxevent.SetEventType( wxEVT_KEY_DOWN ) ;
+ break;
+ case NSKeyUp :
+ wxevent.SetEventType( wxEVT_KEY_UP ) ;
+ break;
+ case NSFlagsChanged :
+ switch (keyval)
+ {
+ case WXK_CONTROL:
+ wxevent.SetEventType( wxevent.m_controlDown ? wxEVT_KEY_DOWN : wxEVT_KEY_UP);
+ break;
+ case WXK_SHIFT:
+ wxevent.SetEventType( wxevent.m_shiftDown ? wxEVT_KEY_DOWN : wxEVT_KEY_UP);
+ break;
+ case WXK_ALT:
+ wxevent.SetEventType( wxevent.m_altDown ? wxEVT_KEY_DOWN : wxEVT_KEY_UP);
+ break;
+ case WXK_COMMAND:
+ wxevent.SetEventType( wxevent.m_metaDown ? wxEVT_KEY_DOWN : wxEVT_KEY_UP);
+ break;
+ }
+ break;
+ default :
+ break ;
+ }
+ }
if ( !keyval )
{
bool wxWidgetCocoaImpl::DoHandleCharEvent(NSEvent *event, NSString *text)
{
- wxKeyEvent wxevent(wxEVT_KEY_DOWN);
+ wxKeyEvent wxevent(wxEVT_CHAR);
SetupKeyEvent( wxevent, event, text );
wxevent.SetEventObject(GetWXPeer());
if ([event type] == NSKeyDown)
{
m_lastKeyDownEvent = event;
- [m_osxView interpretKeyEvents:[NSArray arrayWithObject:event]];
+ if ( !result )
+ [m_osxView interpretKeyEvents:[NSArray arrayWithObject:event]];
}
return result;
}