- short keycode ;
- short keychar ;
- keychar = short(keymessage & charCodeMask);
- keycode = short(keymessage & keyCodeMask) >> 8 ;
-
- if ( modifiers & ( controlKey|shiftKey|optionKey ) )
- {
- // control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier
- // and look at the character after
- UInt32 state = 0;
- UInt32 keyInfo = KeyTranslate((Ptr)GetScriptManagerVariable(smKCHRCache), ( modifiers & (~(controlKey|shiftKey|optionKey))) | keycode, &state);
- keychar = short(keyInfo & charCodeMask);
- }
-
- long keyval = wxMacTranslateKey(keychar, keycode) ;
- long realkeyval = keyval ;
- if ( keyval == keychar )
- {
- // we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
- realkeyval = short(keymessage & charCodeMask) ;
- keyval = wxToupper( keyval ) ;
- }
-
- // Check for NUMPAD keys
- if (keyval >= '0' && keyval <= '9' && keycode >= 82 && keycode <= 92)
- {
- keyval = keyval - '0' + WXK_NUMPAD0;
- }
- else if (keycode >= 67 && keycode <= 81)
- {
- switch (keycode)
- {
- case 76 :
- keyval = WXK_NUMPAD_ENTER;
- break;
-
- case 81:
- keyval = WXK_NUMPAD_EQUAL;
- break;
-
- case 67:
- keyval = WXK_NUMPAD_MULTIPLY;
- break;
-
- case 75:
- keyval = WXK_NUMPAD_DIVIDE;
- break;
-
- case 78:
- keyval = WXK_NUMPAD_SUBTRACT;
- break;
-
- case 69:
- keyval = WXK_NUMPAD_ADD;
- break;
-
- case 65:
- keyval = WXK_NUMPAD_DECIMAL;
- break;
-
- default:
- break;
- } // end switch
- }
+ bool handled;
+ wxKeyEvent event(wxEVT_KEY_DOWN) ;
+ MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;