1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/evtloop.mm
3 // Purpose: implementation of wxEventLoop for OS X
4 // Author: Vadim Zeitlin, Stefan Csomor
7 // RCS-ID: $Id: evtloop.cpp 54845 2008-07-30 14:52:41Z SC $
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"
33 #include "wx/osx/private.h"
35 // ============================================================================
36 // wxEventLoop implementation
37 // ============================================================================
39 wxGUIEventLoop::wxGUIEventLoop()
44 void wxGUIEventLoop::WakeUp()
46 extern void wxMacWakeUp();
51 bool wxGUIEventLoop::Pending() const
53 wxMacAutoreleasePool autoreleasepool;
54 // a pointer to the event is returned if there is one, or nil if not
55 return [[NSApplication sharedApplication]
56 nextEventMatchingMask: NSAnyEventMask
58 inMode: NSDefaultRunLoopMode
62 bool wxGUIEventLoop::Dispatch()
67 wxMacAutoreleasePool autoreleasepool;
69 if(NSEvent *event = [NSApp
70 nextEventMatchingMask:NSAnyEventMask
71 untilDate:[NSDate dateWithTimeIntervalSinceNow: m_sleepTime]
72 inMode:NSDefaultRunLoopMode
76 [NSApp sendEvent: event];
80 if ( wxTheApp->ProcessIdle() )