wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
}
- #if TARGET_CARBON
+#if TARGET_CARBON
if ( m_macEventHandler )
{
::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
#endif
wxRemoveMacWindowAssociation( this ) ;
- wxTopLevelWindows.DeleteObject(this);
-
if ( wxModelessWindows.Find(this) )
wxModelessWindows.DeleteObject(this);
- // If this is the last top-level window, exit.
- if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
- {
- wxTheApp->SetTopWindow(NULL);
-
- if ( wxTheApp->GetExitOnFrameDelete() )
- {
- wxTheApp->ExitMainLoop() ;
- }
- }
DisposeRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
}
EventHandlerUPP wxMacWindowEventHandlerUPP = NULL ;
+extern long wxMacTranslateKey(unsigned char key, unsigned char code) ;
+
pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
OSStatus result = eventNotHandledErr ;
case kEventClassTextInput :
if ( wxMacConvertEventToRecord( event , &rec ) )
{
- wxTheApp->MacHandleOneEvent( &rec ) ;
- result = noErr ;
+ short keycode ;
+ short keychar ;
+ keychar = short(rec.message & charCodeMask);
+ keycode = short(rec.message & keyCodeMask) >> 8 ;
+ wxWindow* focus = wxWindow::FindFocus() ;
+ // it is wxWindows Convention to have Ctrl Key Combinations at ASCII char value
+ if ( (rec.modifiers & controlKey) && keychar >= 0 && keychar < 0x20 )
+ {
+ keychar += 0x40 ;
+ }
+ long keyval = wxMacTranslateKey(keychar, keycode) ;
+ if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( focus , keyval , rec.modifiers , rec.when , rec.where.h , rec.where.v ) )
+ {
+ // was handled internally
+ result = noErr ;
+ }
}
break ;
default :