]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/app.cpp
listctrl header cleanup
[wxWidgets.git] / src / mac / carbon / app.cpp
index 8338c416182213a5704b643475e41d0cceacee70..abbe50cc3544ac68ee5b56e615761e0b3446f98f 100644 (file)
 #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"
+    #include "wx/module.h"
 #endif
 
-#include "wx/window.h"
-#include "wx/frame.h"
-#include "wx/button.h"
-#include "wx/utils.h"
-#include "wx/gdicmn.h"
-#include "wx/pen.h"
-#include "wx/brush.h"
-#include "wx/cursor.h"
-#include "wx/icon.h"
-#include "wx/palette.h"
-#include "wx/dc.h"
-#include "wx/dialog.h"
-#include "wx/msgdlg.h"
-#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 "wx/link.h"
 
 #include <string.h>
 
 // mac
 
 #ifndef __DARWIN__
-  #if __option(profile)
-    #include <profiler.h>
-  #endif
+    #if __option(profile)
+        #include <profiler.h>
+    #endif
 #endif
 
 // #include "apprsrc.h"
@@ -67,7 +68,8 @@
 #  include <Devices.h>
 #endif
 
-extern wxList wxPendingDelete;
+// Keep linker from discarding wxStockGDIMac
+wxFORCE_LINK_MODULE(gdiobj)
 
 #if wxUSE_THREADS
 extern size_t g_numberOfThreads;
@@ -92,13 +94,9 @@ const short kMacMinHeap = (29 * 1024) ;
 const short kwxMacMenuBarResource = 1 ;
 const short kwxMacAppleMenuId = 1 ;
 
-WXHRGN    wxApp::s_macCursorRgn = NULL;
 wxWindow* wxApp::s_captureWindow = NULL ;
-int       wxApp::s_lastMouseDown = 0 ;
-long      wxApp::sm_lastMessageTime = 0;
 long      wxApp::s_lastModifiers = 0 ;
 
-bool      wxApp::s_macSupportPCMenuShortcuts = true ;
 long      wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
 long      wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ;
 long      wxApp::s_macExitMenuItemId = wxID_EXIT ;
@@ -731,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,
@@ -817,8 +810,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
 
 #endif
 
-    s_macCursorRgn = ::NewRgn() ;
-
     // Mac OS X passes a process serial number command line argument when
     // the application is launched from the Finder. This argument must be
     // removed from the command line arguments before being handled by the
@@ -940,8 +931,6 @@ void wxApp::CleanUp()
 #endif
 
     UMACleanupToolbox() ;
-    if (s_macCursorRgn)
-        ::DisposeRgn((RgnHandle)s_macCursorRgn);
 
     if (!sm_isEmbedded)
         RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) );
@@ -1583,14 +1572,18 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
         {
             if ( keyval == WXK_RETURN )
             {
-                wxButton *def = wxDynamicCast(focus->GetDefaultItem(), wxButton);
-                if ( def && def->IsEnabled() )
+                wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(focus), wxTopLevelWindow);
+                if ( tlw && tlw->GetDefaultItem() )
                 {
-                    wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
-                    event.SetEventObject(def);
-                    def->Command(event);
+                    wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
+                    if ( def && def->IsEnabled() )
+                    {
+                        wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+                        event.SetEventObject(def);
+                        def->Command(event);
 
-                    return true ;
+                        return true ;
+                    }
                 }
             }
             else if (keyval == WXK_ESCAPE || (keyval == '.' && modifiers & cmdKey ) )