X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd44c9e02c47b251a251fea6dcd7c6fad5ad3dc1..2cf3a6d7bef6f20bea35062dd3d4dbf0aec9efb5:/src/mac/carbon/app.cpp diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index b128991ff0..3a350c9502 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: app.cpp +// Name: src/mac/carbon/app.cpp // Purpose: wxApp // Author: Stefan Csomor // Modified by: @@ -11,27 +11,31 @@ #include "wx/wxprec.h" -#include "wx/window.h" -#include "wx/frame.h" -#include "wx/button.h" #include "wx/app.h" -#include "wx/utils.h" -#include "wx/gdicmn.h" -#include "wx/pen.h" -#include "wx/brush.h" -#include "wx/cursor.h" -#include "wx/intl.h" -#include "wx/icon.h" -#include "wx/palette.h" -#include "wx/dc.h" -#include "wx/dialog.h" -#include "wx/msgdlg.h" -#include "wx/log.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/utils.h" + #include "wx/window.h" + #include "wx/frame.h" + #include "wx/dc.h" + #include "wx/button.h" + #include "wx/menu.h" + #include "wx/pen.h" + #include "wx/brush.h" + #include "wx/palette.h" + #include "wx/icon.h" + #include "wx/cursor.h" + #include "wx/dialog.h" + #include "wx/msgdlg.h" + #include "wx/textctrl.h" + #include "wx/memory.h" + #include "wx/gdicmn.h" +#endif + #include "wx/module.h" -#include "wx/memory.h" #include "wx/tooltip.h" -#include "wx/textctrl.h" -#include "wx/menu.h" #include "wx/docview.h" #include "wx/filename.h" @@ -63,8 +67,6 @@ # include #endif -extern wxList wxPendingDelete; - #if wxUSE_THREADS extern size_t g_numberOfThreads; #endif @@ -359,7 +361,7 @@ struct IdPair int wxId ; } ; -IdPair gCommandIds [] = +IdPair gCommandIds [] = { { kHICommandCut , wxID_CUT } , { kHICommandCopy , wxID_COPY } , @@ -370,10 +372,10 @@ IdPair gCommandIds [] = { kHICommandRedo , wxID_REDO } , } ; -int wxMacCommandToId( UInt32 macCommandId ) +int wxMacCommandToId( UInt32 macCommandId ) { int wxid = 0 ; - + switch ( macCommandId ) { case kHICommandPreferences : @@ -408,10 +410,10 @@ int wxMacCommandToId( UInt32 macCommandId ) return wxid ; } -UInt32 wxIdToMacCommand( int wxId ) +UInt32 wxIdToMacCommand( int wxId ) { UInt32 macId = 0 ; - + if ( wxId == wxApp::s_macPreferencesMenuItemId ) macId = kHICommandPreferences ; else if (wxId == wxApp::s_macExitMenuItemId) @@ -436,7 +438,7 @@ UInt32 wxIdToMacCommand( int wxId ) return macId ; } -wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item ) +wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item ) { wxMenu* itemMenu = NULL ; int id = 0 ; @@ -581,7 +583,7 @@ static pascal OSStatus wxMacAppCommandEventHandler( EventHandlerCallRef handler if ( item ) { wxASSERT( itemMenu != NULL ) ; - + switch ( cEvent.GetKind() ) { case kEventProcessCommand : @@ -598,16 +600,16 @@ static pascal OSStatus wxMacAppCommandEventHandler( EventHandlerCallRef handler { wxUpdateUIEvent event(id); event.SetEventObject( itemMenu ); - + bool processed = false; - + // Try the menu's event handler { wxEvtHandler *handler = itemMenu->GetEventHandler(); if ( handler ) processed = handler->ProcessEvent(event); } - + // Try the window the menu was popped up from // (and up through the hierarchy) if ( !processed ) @@ -621,11 +623,11 @@ static pascal OSStatus wxMacAppCommandEventHandler( EventHandlerCallRef handler processed = win->GetEventHandler()->ProcessEvent(event); break; } - + menu = menu->GetParent(); } } - + if ( processed ) { // if anything changed, update the changed attribute @@ -727,11 +729,6 @@ pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef eve DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacAppEventHandler ) -#if defined(WXMAKINGDLL_CORE) && !defined(__DARWIN__) -// we know it's there ;-) -WXIMPORT char std::__throws_bad_alloc ; -#endif - #ifdef __WXDEBUG__ pascal static void wxMacAssertOutputHandler(OSType componentSignature, UInt32 options, @@ -1473,10 +1470,10 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi if ( !focus ) return false ; - bool handled; + bool handled; wxKeyEvent event(wxEVT_KEY_DOWN) ; MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ; - + handled = focus->GetEventHandler()->ProcessEvent( event ) ; if ( handled && event.GetSkipped() ) handled = false ; @@ -1515,7 +1512,7 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier wxKeyEvent event( wxEVT_KEY_UP ) ; MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ; handled = focus->GetEventHandler()->ProcessEvent( event ) ; - + return handled ; } @@ -1523,7 +1520,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers { if ( !focus ) return false ; - + wxKeyEvent event(wxEVT_CHAR) ; MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ; long keyval = event.m_keyCode ; @@ -1531,7 +1528,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers bool handled = false ; wxTopLevelWindowMac *tlw = focus->MacGetTopLevelWindow() ; - + if (tlw) { event.SetEventType( wxEVT_CHAR_HOOK ); @@ -1546,7 +1543,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers event.Skip( false ) ; handled = focus->GetEventHandler()->ProcessEvent( event ) ; } - + if ( !handled && (keyval == WXK_TAB) ) { wxWindow* iter = focus->GetParent() ; @@ -1601,7 +1598,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers return handled ; } -// This method handles common code for SendKeyDown, SendKeyUp, and SendChar events. +// This method handles common code for SendKeyDown, SendKeyUp, and SendChar events. void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) { short keycode, keychar ;