]>
Commit | Line | Data |
---|---|---|
fb896a32 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cocoa/app.mm | |
3 | // Purpose: wxApp | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2002/11/27 | |
d89d4059 | 7 | // RCS-ID: $Id$ |
fb896a32 | 8 | // Copyright: (c) David Elliott |
bb27b372 | 9 | // Licence: wxWidgets licence |
fb896a32 DE |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
fb896a32 DE |
12 | #include "wx/wxprec.h" |
13 | #ifndef WX_PRECOMP | |
14 | #include "wx/defs.h" | |
15 | #include "wx/app.h" | |
891d0563 | 16 | #include "wx/dc.h" |
fb896a32 DE |
17 | #include "wx/intl.h" |
18 | #include "wx/log.h" | |
fb896a32 DE |
19 | #endif |
20 | ||
11c08416 DE |
21 | #include "wx/module.h" |
22 | ||
fb45bb1f | 23 | #include "wx/cocoa/ObjcPose.h" |
493902ac | 24 | #include "wx/cocoa/autorelease.h" |
af367f46 | 25 | #include "wx/cocoa/mbarman.h" |
bb27b372 | 26 | #include "wx/cocoa/NSApplication.h" |
fb45bb1f | 27 | |
fb896a32 DE |
28 | #if wxUSE_WX_RESOURCES |
29 | # include "wx/resource.h" | |
30 | #endif | |
31 | ||
32 | #import <AppKit/NSApplication.h> | |
33 | #import <Foundation/NSRunLoop.h> | |
14fc7eb4 | 34 | #import <Foundation/NSThread.h> |
aaa5ab05 | 35 | #import <AppKit/NSEvent.h> |
eb537cfb | 36 | #import <Foundation/NSString.h> |
bb27b372 RN |
37 | #import <Foundation/NSNotification.h> |
38 | #import <AppKit/NSCell.h> | |
fb896a32 | 39 | |
70fb935a DE |
40 | // ======================================================================== |
41 | // wxPoseAsInitializer | |
42 | // ======================================================================== | |
fb896a32 DE |
43 | wxPoseAsInitializer *wxPoseAsInitializer::sm_first = NULL; |
44 | ||
eb537cfb DE |
45 | static bool sg_needIdle = true; |
46 | ||
70fb935a DE |
47 | // ======================================================================== |
48 | // wxPoserNSApplication | |
49 | // ======================================================================== | |
fb896a32 DE |
50 | @interface wxPoserNSApplication : NSApplication |
51 | { | |
52 | } | |
53 | ||
eb537cfb | 54 | - (NSEvent *)nextEventMatchingMask:(unsigned int)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)flag; |
fb896a32 | 55 | - (void)sendEvent: (NSEvent*)anEvent; |
fb896a32 DE |
56 | @end // wxPoserNSApplication |
57 | ||
70fb935a DE |
58 | WX_IMPLEMENT_POSER(wxPoserNSApplication); |
59 | ||
fb896a32 DE |
60 | @implementation wxPoserNSApplication : NSApplication |
61 | ||
eb537cfb DE |
62 | /* NOTE: The old method of idle event handling added the handler using the |
63 | [NSRunLoop -performSelector:target:argument:order:modes] which caused | |
64 | the invocation to occur at the begining of [NSApplication | |
65 | -nextEventMatchingMask:untilDate:expiration:inMode:dequeue:]. However, | |
66 | the code would be scheduled for invocation with every iteration of | |
67 | the event loop. This new method simply overrides the method. The | |
68 | same caveats apply. In particular, by the time the event loop has | |
69 | called this method, it usually expects to receive an event. If you | |
70 | plan on stopping the event loop, it is wise to send an event through | |
71 | the queue to ensure this method will return. | |
72 | See wxEventLoop::Exit() for more information. | |
422d306c RN |
73 | |
74 |