X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7fc641aff97d5f100b94cabb0288d3c4261e5328..8064223b7b1b3657363b7a635c381b9269d95e55:/src/mac/carbon/app.cpp?ds=sidebyside diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 1120af3662..749119f1bf 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -39,6 +39,7 @@ #include "wx/docview.h" #include "wx/filename.h" #include "wx/link.h" +#include "wx/thread.h" #include @@ -586,7 +587,7 @@ wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler), { wxWindow *win = menu->GetInvokingWindow(); if (win) - win->GetEventHandler()->ProcessEvent(wxevent); + win->HandleWindowEvent(wxevent); } } } @@ -821,7 +822,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) CFRelease( url ) ; CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ; CFRelease( urlParent ) ; - wxString cwd = wxMacCFStringHolder(path).AsString(wxLocale::GetSystemEncoding()); + wxString cwd = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding()); wxSetWorkingDirectory( cwd ) ; } @@ -1408,7 +1409,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi wxKeyEvent event(wxEVT_KEY_DOWN) ; MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ; - handled = focus->GetEventHandler()->ProcessEvent( event ) ; + handled = focus->HandleWindowEvent( event ) ; if ( handled && event.GetSkipped() ) handled = false ; @@ -1455,7 +1456,7 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier bool handled; wxKeyEvent event( wxEVT_KEY_UP ) ; MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ; - handled = focus->GetEventHandler()->ProcessEvent( event ) ; + handled = focus->HandleWindowEvent( event ) ; return handled ; } @@ -1476,7 +1477,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers if (tlw) { event.SetEventType( wxEVT_CHAR_HOOK ); - handled = tlw->GetEventHandler()->ProcessEvent( event ); + handled = tlw->HandleWindowEvent( event ); if ( handled && event.GetSkipped() ) handled = false ; } @@ -1485,7 +1486,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers { event.SetEventType( wxEVT_CHAR ); event.Skip( false ) ; - handled = focus->GetEventHandler()->ProcessEvent( event ) ; + handled = focus->HandleWindowEvent( event ) ; } if ( !handled && (keyval == WXK_TAB) ) @@ -1501,7 +1502,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */ new_event.SetWindowChange( event.ControlDown() ); new_event.SetCurrentFocus( focus ); - handled = focus->GetParent()->GetEventHandler()->ProcessEvent( new_event ); + handled = focus->GetParent()->HandleWindowEvent( new_event ); if ( handled && new_event.GetSkipped() ) handled = false ; } @@ -1540,7 +1541,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers // generate wxID_CANCEL if command-. or has been pressed (typically in dialogs) wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL); new_event.SetEventObject( focus ); - handled = focus->GetEventHandler()->ProcessEvent( new_event ); + handled = focus->HandleWindowEvent( new_event ); } } #endif @@ -1634,3 +1635,14 @@ void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymess event.SetTimestamp(when); event.SetEventObject(focus); } + + +void wxApp::MacHideApp() +{ + wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess ); + HICommand command; + memset( &command, 0 , sizeof(command) ); + command.commandID = kHICommandHide ; + event.SetParameter(kEventParamDirectObject, command ); + SendEventToApplication( event ); +}