]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/evtloop.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/evtloop.cpp
3 // Purpose: implementation of wxEventLoop for wxMac
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #include "wx/evtloop.h"
34 #include <Carbon/Carbon.h>
36 #include <CoreFoundation/CoreFoundation.h>
38 // ============================================================================
39 // wxEventLoop implementation
40 // ============================================================================
42 // ----------------------------------------------------------------------------
43 // high level functions for RunApplicationEventLoop() case
44 // ----------------------------------------------------------------------------
48 #if wxOSX_USE_RUN_APP_EVENT_LOOP
50 int wxGUIEventLoop::Run()
52 wxEventLoopActivator
activate(this);
54 RunApplicationEventLoop();
59 void wxGUIEventLoop::Exit(int rc
)
63 QuitApplicationEventLoop();
68 #else // manual event loop
70 // ----------------------------------------------------------------------------
71 // functions only used by wxEventLoopManual-based implementation
72 // ----------------------------------------------------------------------------
74 void wxGUIEventLoop::WakeUp()
76 extern void wxMacWakeUp();
81 #endif // high/low-level event loop
83 // ----------------------------------------------------------------------------
84 // low level functions used in both cases
85 // ----------------------------------------------------------------------------
87 bool wxGUIEventLoop::Pending() const
92 return ReceiveNextEvent
94 0, // we want any event at all so we don't specify neither
95 NULL
, // the number of event types nor the types themselves
97 false, // don't remove the event from queue
105 bool wxGUIEventLoop::Dispatch()
111 // TODO: we probably should do the dispatching directly from here but for
112 // now it's easier to forward to wxApp which has all the code to do
114 wxTheApp
->MacDoOneEvent();
116 CFRunLoopRunInMode(kCFRunLoopDefaultMode
, 0, 0);