+#endif // wxUSE_ACCEL
+ }
+ if (!handled)
+ {
+ event.Skip( FALSE ) ;
+ event.SetEventType( wxEVT_CHAR ) ;
+ // raw value again
+ event.m_keyCode = realkeyval ;
+
+ handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+ if ( handled && event.GetSkipped() )
+ handled = false ;
+ }
+ if ( !handled &&
+ (keyval == WXK_TAB) &&
+// CS: copied the change below from wxGTK
+// VZ: testing for wxTE_PROCESS_TAB shouldn't be done here the control may
+// have this style, yet choose not to process this particular TAB in which
+// case TAB must still work as a navigational character
+#if 0
+ (!focus->HasFlag(wxTE_PROCESS_TAB)) &&
+#endif
+ (focus->GetParent()) &&
+ (focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
+ {
+ wxNavigationKeyEvent new_event;
+ new_event.SetEventObject( focus );
+ new_event.SetDirection( !event.ShiftDown() );
+ /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
+ new_event.SetWindowChange( event.ControlDown() );
+ new_event.SetCurrentFocus( focus );
+ handled = focus->GetEventHandler()->ProcessEvent( new_event );
+ if ( handled && new_event.GetSkipped() )
+ handled = false ;
+ }
+ // backdoor handler for default return and command escape
+ if ( !handled && (!focus->IsKindOf(CLASSINFO(wxControl) ) || !focus->MacCanFocus() ) )
+ {
+ // if window is not having a focus still testing for default enter or cancel
+ // TODO add the UMA version for ActiveNonFloatingWindow
+ wxWindow* focus = wxFindWinFromMacWindow( FrontWindow() ) ;
+ if ( focus )
+ {
+ if ( keyval == WXK_RETURN )
+ {
+ wxButton *def = wxDynamicCast(focus->GetDefaultItem(),
+ wxButton);
+ if ( def && def->IsEnabled() )
+ {
+ wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+ event.SetEventObject(def);
+ def->Command(event);
+ return true ;
+ }
+ }
+ /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
+ else if (keyval == WXK_ESCAPE || (keyval == '.' && modifiers & cmdKey ) )
+ {
+ wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+ new_event.SetEventObject( focus );
+ handled = focus->GetEventHandler()->ProcessEvent( new_event );
+ }
+ }
+ }
+ return handled ;
+}
+
+bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey )
+{
+ if ( !focus )
+ return false ;
+
+ 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);
+ keycode = short(keyInfo & keyCodeMask) >> 8 ;