]>
Commit | Line | Data |
---|---|---|
fb896a32 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cocoa/app.h | |
3 | // Purpose: wxApp class | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2002/11/27 | |
cdd0a08f | 7 | // RCS-ID: $Id$ |
fb896a32 | 8 | // Copyright: (c) 2002 David Elliott |
65571936 | 9 | // Licence: wxWindows licence |
fb896a32 DE |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_COCOA_APP_H_ | |
13 | #define _WX_COCOA_APP_H_ | |
14 | ||
047c1182 DE |
15 | typedef struct __CFRunLoopObserver * CFRunLoopObserverRef; |
16 | typedef const struct __CFString * CFStringRef; | |
17 | ||
18 | #include "wx/mac/corefoundation/cfref.h" | |
19 | ||
cdd0a08f DE |
20 | // ======================================================================== |
21 | // wxApp | |
22 | // ======================================================================== | |
fb896a32 DE |
23 | // Represents the application. Derive OnInit and declare |
24 | // a new App object to start application | |
25 | class WXDLLEXPORT wxApp: public wxAppBase | |
26 | { | |
27 | DECLARE_DYNAMIC_CLASS(wxApp) | |
28 | DECLARE_EVENT_TABLE() | |
29 | // ------------------------------------------------------------------------ | |
30 | // initialization | |
31 | // ------------------------------------------------------------------------ | |
32 | public: | |
33 | wxApp(); | |
047c1182 | 34 | virtual ~wxApp(); |
fb896a32 DE |
35 | |
36 | // ------------------------------------------------------------------------ | |
37 | // Cocoa specifics | |
38 | // ------------------------------------------------------------------------ | |
39 | public: | |
40 | inline WX_NSApplication GetNSApplication() { return m_cocoaApp; } | |
0187ddb4 DE |
41 | virtual void CocoaDelegate_applicationWillBecomeActive(); |
42 | virtual void CocoaDelegate_applicationDidBecomeActive(); | |
43 | virtual void CocoaDelegate_applicationWillResignActive(); | |
44 | virtual void CocoaDelegate_applicationDidResignActive(); | |
047c1182 DE |
45 | virtual void CocoaDelegate_applicationWillUpdate(); |
46 | virtual void CF_ObserveMainRunLoopBeforeWaiting(CFRunLoopObserverRef observer, int activity); | |
fb896a32 DE |
47 | protected: |
48 | WX_NSApplication m_cocoaApp; | |
0187ddb4 | 49 | struct objc_object *m_cocoaAppDelegate; |
14fc7eb4 | 50 | WX_NSThread m_cocoaMainThread; |
047c1182 DE |
51 | wxCFRef<CFRunLoopObserverRef> m_cfRunLoopIdleObserver; |
52 | wxCFRef<CFStringRef> m_cfObservedRunLoopMode; | |
fb896a32 DE |
53 | |
54 | // ------------------------------------------------------------------------ | |
55 | // Implementation | |
56 | // ------------------------------------------------------------------------ | |
57 | public: | |
58 | // Implement wxAppBase pure virtuals | |
e2478fde VZ |
59 | virtual void Exit(); |
60 | ||
fb896a32 | 61 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
eb537cfb | 62 | virtual void WakeUpIdle(); |
fb896a32 | 63 | |
05e2b077 | 64 | virtual bool Initialize(int& argc, wxChar **argv); |
94826170 | 65 | virtual void CleanUp(); |
47f1ad6a DE |
66 | virtual bool CallOnInit(); |
67 | ||
fb896a32 DE |
68 | |
69 | virtual bool OnInit(); | |
70 | virtual bool OnInitGui(); | |
b93d8cc4 DE |
71 | |
72 | #ifdef __WXDEBUG__ | |
73 | virtual void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg); | |
74 | bool IsInAssert() const { return m_isInAssert; } | |
75 | #endif // __WXDEBUG__ | |
76 | ||
879180b6 DE |
77 | // Set true _before_ initializing wx to force embedded mode (no app delegate, etc.) |
78 | static bool sm_isEmbedded; | |
b93d8cc4 DE |
79 | private: |
80 | #ifdef __WXDEBUG__ | |
81 | bool m_isInAssert; | |
82 | #endif // __WXDEBUG__ | |
fb896a32 DE |
83 | }; |
84 | ||
85 | #endif // _WX_COCOA_APP_H_ |