X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e9b41b24a0968b67dd05eb900ef22e8beec642a0..9802983f157c32177e92e8c0f6b1ce44aec0ebca:/src/mac/carbon/app.cpp diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 082a1c35ed..bcff118fb6 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -9,11 +9,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "app.h" #endif -#include "wx/defs.h" +#include "wx/wxprec.h" #include "wx/window.h" #include "wx/frame.h" @@ -59,8 +59,6 @@ # if defined(WXMAKINGDLL_CORE) # include # endif -// include hid keyboard -# include "wx/mac/carbon/private/hid.h" #else # include # include @@ -121,10 +119,6 @@ long wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ; long wxApp::s_macExitMenuItemId = wxID_EXIT ; wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ; -#ifdef __DARWIN__ - wxHIDKeyboard* wxApp::s_macHIDKeyboard = NULL; -#endif - // Normally we're not a plugin bool wxApp::sm_isEmbedded = false; //---------------------------------------------------------------------- @@ -272,19 +266,26 @@ short wxApp::MacHandleAERApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU } + //---------------------------------------------------------------------- // Support Routines linking the Mac...File Calls to the Document Manager //---------------------------------------------------------------------- void wxApp::MacOpenFile(const wxString & fileName ) { +#if wxUSE_DOC_VIEW_ARCHITECTURE wxDocManager* dm = wxDocManager::GetDocumentManager() ; if ( dm ) dm->CreateDocument(fileName , wxDOC_SILENT ) ; +#endif } + void wxApp::MacPrintFile(const wxString & fileName ) { +#if wxUSE_DOC_VIEW_ARCHITECTURE + +#if wxUSE_PRINTING_ARCHITECTURE wxDocManager* dm = wxDocManager::GetDocumentManager() ; if ( dm ) { @@ -309,8 +310,13 @@ void wxApp::MacPrintFile(const wxString & fileName ) } } } +#endif //print + +#endif //docview } + + void wxApp::MacNewFile() { } @@ -711,7 +717,9 @@ bool wxApp::OnInitGui() void wxApp::CleanUp() { +#if wxUSE_TOOLTIPS wxToolTip::RemoveToolTips() ; +#endif // One last chance for pending objects to be cleaned up wxTheApp->DeletePendingObjects(); @@ -723,10 +731,6 @@ void wxApp::CleanUp() ProfilerDump( (StringPtr)"\papp.prof" ) ; ProfilerTerm() ; # endif - - // clean up HID Keyboard - if (s_macHIDKeyboard) - delete s_macHIDKeyboard; #endif UMACleanupToolbox() ; @@ -1177,18 +1181,9 @@ int wxMacKeyCodeToModifier(wxKeyCode key) } } +#ifndef __DARWIN__ bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below { -#ifdef __DARWIN__ - // Startup HID keyboard for getting key codes on DARWIN - if (!wxApp::s_macHIDKeyboard) - { - wxApp::s_macHIDKeyboard = new wxHIDKeyboard(); - wxApp::s_macHIDKeyboard->Create(); - } - - return wxApp::s_macHIDKeyboard->IsActive(key); -#else //if OS X > 10.2 (i.e. 10.2.x) //a known apple bug prevents the system from determining led //states with GetKeys... can only determine caps lock led @@ -1197,11 +1192,11 @@ bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below // KeyMapByteArray keymap; // GetKeys((BigEndianLong*)keymap); // return !!(BitTst(keymap, (sizeof(KeyMapByteArray)*8) - iKey)); -#endif } +#endif -bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey ) +bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) { if ( !focus ) return false ; @@ -1236,10 +1231,13 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi event.m_altDown = modifiers & optionKey; event.m_metaDown = modifiers & cmdKey; event.m_keyCode = keyval ; +#if wxUSE_UNICODE + event.m_uniChar = uniChar ; +#endif event.m_x = wherex; event.m_y = wherey; - event.m_timeStamp = when; + event.SetTimestamp(when); event.SetEventObject(focus); handled = focus->GetEventHandler()->ProcessEvent( event ) ; if ( handled && event.GetSkipped() ) @@ -1268,6 +1266,23 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi } if (!handled) { + wxTopLevelWindowMac *tlw = focus->MacGetTopLevelWindow() ; + + if (tlw) + { + event.Skip( FALSE ) ; + event.SetEventType( wxEVT_CHAR_HOOK ); + // raw value again + event.m_keyCode = realkeyval ; + + handled = tlw->GetEventHandler()->ProcessEvent( event ); + if ( handled && event.GetSkipped() ) + handled = false ; + } + } + + if ( !handled ) + { event.Skip( FALSE ) ; event.SetEventType( wxEVT_CHAR ) ; // raw value again @@ -1329,7 +1344,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi return handled ; } -bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey ) +bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) { if ( !focus ) return false ; @@ -1361,10 +1376,13 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier event.m_altDown = modifiers & optionKey; event.m_metaDown = modifiers & cmdKey; event.m_keyCode = keyval ; +#if wxUSE_UNICODE + event.m_uniChar = uniChar ; +#endif event.m_x = wherex; event.m_y = wherey; - event.m_timeStamp = when; + event.SetTimestamp(when); event.SetEventObject(focus); handled = focus->GetEventHandler()->ProcessEvent( event ) ;