/////////////////////////////////////////////////////////////////////////////
-// Name: app.cpp
+// Name: src/mac/carbon/app.cpp
// Purpose: wxApp
// Author: Stefan Csomor
// Modified by:
#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"
# include <Devices.h>
#endif
-extern wxList wxPendingDelete;
-
#if wxUSE_THREADS
extern size_t g_numberOfThreads;
#endif
int wxId ;
} ;
-IdPair gCommandIds [] =
+IdPair gCommandIds [] =
{
{ kHICommandCut , wxID_CUT } ,
{ kHICommandCopy , wxID_COPY } ,
{ kHICommandRedo , wxID_REDO } ,
} ;
-int wxMacCommandToId( UInt32 macCommandId )
+int wxMacCommandToId( UInt32 macCommandId )
{
int wxid = 0 ;
-
+
switch ( macCommandId )
{
case kHICommandPreferences :
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)
return macId ;
}
-wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item )
+wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item )
{
wxMenu* itemMenu = NULL ;
int id = 0 ;
if ( item )
{
wxASSERT( itemMenu != NULL ) ;
-
+
switch ( cEvent.GetKind() )
{
case kEventProcessCommand :
{
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 )
processed = win->GetEventHandler()->ProcessEvent(event);
break;
}
-
+
menu = menu->GetParent();
}
}
-
+
if ( processed )
{
// if anything changed, update the changed attribute
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,
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 ;
wxKeyEvent event( wxEVT_KEY_UP ) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
-
+
return handled ;
}
{
if ( !focus )
return false ;
-
+
wxKeyEvent event(wxEVT_CHAR) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
long keyval = event.m_keyCode ;
bool handled = false ;
wxTopLevelWindowMac *tlw = focus->MacGetTopLevelWindow() ;
-
+
if (tlw)
{
event.SetEventType( wxEVT_CHAR_HOOK );
event.Skip( false ) ;
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
}
-
+
if ( !handled && (keyval == WXK_TAB) )
{
wxWindow* iter = focus->GetParent() ;
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 ;