-void wxApp::doMacKeyDown(void)
-{
- long menuResult = 0 ;
- short keycode ;
- short keychar ;
- keychar = short(m_event.message & charCodeMask);
- keycode = short(m_event.message & keyCodeMask) >> 8 ;
-
- // Handle menu accelerators
- if ( gSFMacHasAppearance )
- {
- menuResult = MenuEvent( &m_event ) ;
- if ( HiWord( menuResult ) )
- {
- doMacInMenuBar( menuResult ) ;
- }
- else
- {
- ControlHandle control ;
-
- GetKeyboardFocus( FrontNonFloatingWindow() , &control ) ;
- if ( control && keychar != 0x07 )
- HandleControlKey( control , keycode , keychar , m_event.modifiers ) ;
- else
- {
- wxWindow* theMacWxFrame = wxFrame::MacFindFrameOrDialog(::FrontWindow());
- if (theMacWxFrame)
- {
- wxKeyEvent event(wxEVT_CHAR);
- event.m_shiftDown = m_event.modifiers & shiftKey;
- event.m_controlDown = m_event.modifiers & controlKey;
- event.m_altDown = m_event.modifiers & optionKey;
- event.m_metaDown = m_event.modifiers & cmdKey;
- event.m_keyCode = macTranslateKey(keychar, m_event.modifiers & (shiftKey|optionKey));
- event.m_x = m_event.where.h;
- event.m_y = m_event.where.v;
- event.m_timeStamp = m_event.when;
- event.SetEventObject(theMacWxFrame);
-
- theMacWxFrame->ProcessEvent(event);
- }
- }
- }
- }
- else
- {
- if (GetMenuHandle( kwxMacAppleMenuId ) )
- {
-// menuResult = MDEF_MenuKey(m_event.message, m_event.modifiers , GetMenuHandle( kwxMacAppleMenuId ) );
- }
- else
- {
- if (m_event.modifiers & cmdKey)
- {
- menuResult = MenuKey( keychar ) ;
- }
- }
-
- if ( HiWord( menuResult ) )
- {
- doMacInMenuBar( menuResult ) ;
- }
- else
- {
- wxWindow* theMacWxFrame = wxFrame::MacFindFrameOrDialog(::FrontWindow());
- if (theMacWxFrame)
- {
- wxKeyEvent event(wxEVT_CHAR);
- event.m_shiftDown = m_event.modifiers & shiftKey;
- event.m_controlDown = m_event.modifiers & controlKey;
- event.m_altDown = m_event.modifiers & optionKey;
- event.m_metaDown = m_event.modifiers & cmdKey;
- event.m_keyCode = macTranslateKey(keychar, m_event.modifiers & (shiftKey|optionKey));
- event.m_x = m_event.where.h;
- event.m_y = m_event.where.v;
- event.m_timeStamp = m_event.when;
- event.SetEventObject(theMacWxFrame);
-
- theMacWxFrame->ProcessEvent(event);
- }
- }
- }
-}