]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/evtloop.cpp
Blind fixes for warnings in wxTinderbox.
[wxWidgets.git] / src / mac / carbon / evtloop.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: mac/carbon/evtloop.cpp
3 // Purpose: implementation of wxEventLoop for wxMac
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 2006-01-12
7 // RCS-ID: $Id$
8 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #include "wx/evtloop.h"
28
29 #include <Carbon/Carbon.h>
30
31 // ============================================================================
32 // wxEventLoop implementation
33 // ============================================================================
34
35 // ----------------------------------------------------------------------------
36 // high level functions for RunApplicationEventLoop() case
37 // ----------------------------------------------------------------------------
38
39 #if wxMAC_USE_RUN_APP_EVENT_LOOP
40
41 int wxEventLoop::Run()
42 {
43 wxEventLoopActivator activate(this);
44
45 RunApplicationEventLoop();
46
47 return m_exitcode;
48 }
49
50 void wxEventLoop::Exit(int rc)
51 {
52 m_exitcode = rc;
53
54 QuitApplicationEventLoop();
55
56 OnExit();
57 }
58
59 #else // manual event loop
60
61 // ----------------------------------------------------------------------------
62 // functions only used by wxEventLoopManual-based implementation
63 // ----------------------------------------------------------------------------
64
65 void wxEventLoop::WakeUp()
66 {
67 extern void wxMacWakeUp();
68
69 wxMacWakeUp();
70 }
71
72 #endif // high/low-level event loop
73
74 // ----------------------------------------------------------------------------
75 // low level functions used in both cases
76 // ----------------------------------------------------------------------------
77
78 bool wxEventLoop::Pending() const
79 {
80 EventRef theEvent;
81
82 return ReceiveNextEvent
83 (
84 0, // we want any event at all so we don't specify neither
85 NULL, // the number of event types nor the types themselves
86 kEventDurationNoWait,
87 false, // don't remove the event from queue
88 &theEvent
89 ) == noErr;
90 }
91
92 bool wxEventLoop::Dispatch()
93 {
94 // TODO: we probably should do the dispatching directly from here but for
95 // now it's easier to forward to wxApp which has all the code to do
96 // it
97 if ( !wxTheApp )
98 return false;
99
100 wxTheApp->MacDoOneEvent();
101 return true;
102 }
103