]>
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 | |
53a2db12 | 25 | class WXDLLIMPEXP_CORE wxApp: public wxAppBase |
fb896a32 DE |
26 | { |
27 | DECLARE_DYNAMIC_CLASS(wxApp) | |
fb896a32 DE |
28 | // ------------------------------------------------------------------------ |
29 | // initialization | |
30 | // ------------------------------------------------------------------------ | |
31 | public: | |
32 | wxApp(); | |
047c1182 | 33 | virtual ~wxApp(); |
fb896a32 DE |
34 | |
35 | // ------------------------------------------------------------------------ | |
36 | // Cocoa specifics | |
37 | // ------------------------------------------------------------------------ | |
38 | public: | |
39 | inline WX_NSApplication GetNSApplication() { return m_cocoaApp; } | |
0187ddb4 DE |
40 | virtual void CocoaDelegate_applicationWillBecomeActive(); |
41 | virtual void CocoaDelegate_applicationDidBecomeActive(); | |
42 | virtual void CocoaDelegate_applicationWillResignActive(); | |
43 | virtual void CocoaDelegate_applicationDidResignActive(); | |
047c1182 DE |
44 | virtual void CocoaDelegate_applicationWillUpdate(); |
45 | virtual void CF_ObserveMainRunLoopBeforeWaiting(CFRunLoopObserverRef observer, int activity); | |
fb896a32 DE |
46 | protected: |
47 | WX_NSApplication m_cocoaApp; | |
0187ddb4 | 48 | struct objc_object *m_cocoaAppDelegate; |
14fc7eb4 | 49 | WX_NSThread m_cocoaMainThread; |
047c1182 DE |
50 | wxCFRef<CFRunLoopObserverRef> m_cfRunLoopIdleObserver; |
51 | wxCFRef<CFStringRef> m_cfObservedRunLoopMode; | |
fb896a32 DE |
52 | |
53 | // ------------------------------------------------------------------------ | |
54 | // Implementation | |
55 | // ------------------------------------------------------------------------ | |
56 | public: | |
57 | // Implement wxAppBase pure virtuals | |
e2478fde VZ |
58 | virtual void Exit(); |
59 | ||
fb896a32 | 60 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
eb537cfb | 61 | virtual void WakeUpIdle(); |
fb896a32 | 62 | |
05e2b077 | 63 | virtual bool Initialize(int& argc, wxChar **argv); |
94826170 | 64 | virtual void CleanUp(); |
47f1ad6a DE |
65 | virtual bool CallOnInit(); |
66 | ||
fb896a32 DE |
67 | |
68 | virtual bool OnInit(); | |
69 | virtual bool OnInitGui(); | |
b93d8cc4 DE |
70 | |
71 | #ifdef __WXDEBUG__ | |
72 | virtual void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg); | |
73 | bool IsInAssert() const { return m_isInAssert; } | |
74 | #endif // __WXDEBUG__ | |
75 | ||
879180b6 DE |
76 | // Set true _before_ initializing wx to force embedded mode (no app delegate, etc.) |
77 | static bool sm_isEmbedded; | |
b93d8cc4 DE |
78 | private: |
79 | #ifdef __WXDEBUG__ | |
80 | bool m_isInAssert; | |
81 | #endif // __WXDEBUG__ | |
fb896a32 DE |
82 | }; |
83 | ||
84 | #endif // _WX_COCOA_APP_H_ |