+bool wxWindowMac::OSXHandleKeyEvent( wxKeyEvent& event )
+{
+ bool handled = HandleWindowEvent( event ) ;
+ if ( handled && event.GetSkipped() )
+ handled = false ;
+
+#if wxUSE_ACCEL
+ if ( !handled && event.GetEventType() == wxEVT_KEY_DOWN)
+ {
+ wxWindow *ancestor = this;
+ while (ancestor)
+ {
+ int command = ancestor->GetAcceleratorTable()->GetCommand( event );
+ if (command != -1)
+ {
+ wxEvtHandler * const handler = ancestor->GetEventHandler();
+
+ wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
+ handled = handler->ProcessEvent( command_event );
+
+ if ( !handled )
+ {
+ // accelerators can also be used with buttons, try them too
+ command_event.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
+ handled = handler->ProcessEvent( command_event );
+ }
+
+ break;
+ }
+
+ if (ancestor->IsTopLevel())
+ break;
+
+ ancestor = ancestor->GetParent();
+ }
+ }
+#endif // wxUSE_ACCEL
+
+ return handled ;
+}
+