1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxApp class
4 // Author: David Elliott
8 // Copyright: (c) 2002 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COCOA_APP_H_
13 #define _WX_COCOA_APP_H_
15 typedef struct __CFRunLoopObserver
* CFRunLoopObserverRef
;
16 typedef const struct __CFString
* CFStringRef
;
18 #include "wx/mac/corefoundation/cfref.h"
20 // ========================================================================
22 // ========================================================================
23 // Represents the application. Derive OnInit and declare
24 // a new App object to start application
25 class WXDLLEXPORT wxApp
: public wxAppBase
27 DECLARE_DYNAMIC_CLASS(wxApp
)
29 // ------------------------------------------------------------------------
31 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
40 inline WX_NSApplication
GetNSApplication() { return m_cocoaApp
; }
41 virtual void CocoaDelegate_applicationWillBecomeActive();
42 virtual void CocoaDelegate_applicationDidBecomeActive();
43 virtual void CocoaDelegate_applicationWillResignActive();
44 virtual void CocoaDelegate_applicationDidResignActive();
45 virtual void CocoaDelegate_applicationWillUpdate();
46 virtual void CF_ObserveMainRunLoopBeforeWaiting(CFRunLoopObserverRef observer
, int activity
);
48 WX_NSApplication m_cocoaApp
;
49 struct objc_object
*m_cocoaAppDelegate
;
50 WX_NSThread m_cocoaMainThread
;
51 wxCFRef
<CFRunLoopObserverRef
> m_cfRunLoopIdleObserver
;
52 wxCFRef
<CFStringRef
> m_cfObservedRunLoopMode
;
54 // ------------------------------------------------------------------------
56 // ------------------------------------------------------------------------
58 // Implement wxAppBase pure virtuals
61 virtual bool Yield(bool onlyIfNeeded
= FALSE
);
62 virtual void WakeUpIdle();
64 virtual bool Initialize(int& argc
, wxChar
**argv
);
65 virtual void CleanUp();
66 virtual bool CallOnInit();
69 virtual bool OnInit();
70 virtual bool OnInitGui();
73 virtual void OnAssert(const wxChar
*file
, int line
, const wxChar
*cond
, const wxChar
*msg
);
74 bool IsInAssert() const { return m_isInAssert
; }
77 // Set true _before_ initializing wx to force embedded mode (no app delegate, etc.)
78 static bool sm_isEmbedded
;
85 #endif // _WX_COCOA_APP_H_