+ bool handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+ if ( !handled )
+ {
+ #if wxUSE_ACCEL
+ if (!handled)
+ {
+ wxWindow *ancestor = focus;
+ /*
+ while (ancestor)
+ {
+ int command = ancestor->GetAcceleratorTable()->GetCommand( event );
+ if (command != -1)
+ {
+ wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
+ handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
+ break;
+ }
+ if (ancestor->m_isFrame)
+ break;
+ ancestor = ancestor->GetParent();
+ }
+ */
+ }
+ #endif // wxUSE_ACCEL
+ }
+ if (!handled)
+ {
+ wxKeyEvent event(wxEVT_CHAR);
+ event.m_shiftDown = ev->modifiers & shiftKey;
+ event.m_controlDown = ev->modifiers & controlKey;
+ event.m_altDown = ev->modifiers & optionKey;
+ event.m_metaDown = ev->modifiers & cmdKey;
+ event.m_keyCode = keyval;
+ event.m_x = ev->where.h;
+ event.m_y = ev->where.v;
+ event.m_timeStamp = ev->when;
+ event.SetEventObject(focus);
+ handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+ }
+ if ( !handled &&
+ (keyval == WXK_TAB) &&
+ (!focus->HasFlag(wxTE_PROCESS_TAB)) &&
+ (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 );
+ }
+ /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
+ if ( (!handled) &&
+ (keyval == '.' && event.ControlDown() ) )
+ {
+ wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+ new_event.SetEventObject( focus );
+ handled = focus->GetEventHandler()->ProcessEvent( new_event );
+ }