]>
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 | |
7 | // RCS-ID: $Id: | |
8 | // Copyright: (c) 2002 David Elliott | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_COCOA_APP_H_ | |
13 | #define _WX_COCOA_APP_H_ | |
14 | ||
fb896a32 DE |
15 | // Represents the application. Derive OnInit and declare |
16 | // a new App object to start application | |
17 | class WXDLLEXPORT wxApp: public wxAppBase | |
18 | { | |
19 | DECLARE_DYNAMIC_CLASS(wxApp) | |
20 | DECLARE_EVENT_TABLE() | |
21 | // ------------------------------------------------------------------------ | |
22 | // initialization | |
23 | // ------------------------------------------------------------------------ | |
24 | public: | |
25 | wxApp(); | |
26 | virtual ~wxApp() {} | |
27 | ||
28 | // ------------------------------------------------------------------------ | |
29 | // Cocoa specifics | |
30 | // ------------------------------------------------------------------------ | |
31 | public: | |
32 | inline WX_NSApplication GetNSApplication() { return m_cocoaApp; } | |
33 | void CocoaInstallRequestedIdleHandler() { if(m_isIdle) CocoaInstallIdleHandler(); } | |
34 | inline void CocoaRequestIdle() { m_isIdle = true; } | |
35 | protected: | |
36 | WX_NSApplication m_cocoaApp; | |
14fc7eb4 | 37 | WX_NSThread m_cocoaMainThread; |
fb896a32 DE |
38 | void CocoaInstallIdleHandler(); |
39 | bool m_isIdle; | |
40 | ||
41 | // ------------------------------------------------------------------------ | |
42 | // Implementation | |
43 | // ------------------------------------------------------------------------ | |
44 | public: | |
45 | // Implement wxAppBase pure virtuals | |
46 | virtual int MainLoop(); | |
47 | virtual void ExitMainLoop(); | |
48 | virtual bool Initialized(); | |
49 | virtual bool Pending(); | |
50 | virtual void Dispatch(); | |
e2478fde VZ |
51 | |
52 | virtual void Exit(); | |
53 | ||
fb896a32 | 54 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
bf252640 | 55 | virtual void WakeUpIdle() { CocoaRequestIdle(); } |
fb896a32 | 56 | |
05e2b077 | 57 | virtual bool Initialize(int& argc, wxChar **argv); |
94826170 | 58 | virtual void CleanUp(); |
47f1ad6a DE |
59 | virtual bool CallOnInit(); |
60 | ||
fb896a32 DE |
61 | |
62 | virtual bool OnInit(); | |
63 | virtual bool OnInitGui(); | |
b93d8cc4 DE |
64 | |
65 | #ifdef __WXDEBUG__ | |
66 | virtual void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg); | |
67 | bool IsInAssert() const { return m_isInAssert; } | |
68 | #endif // __WXDEBUG__ | |
69 | ||
70 | private: | |
71 | #ifdef __WXDEBUG__ | |
72 | bool m_isInAssert; | |
73 | #endif // __WXDEBUG__ | |
fb896a32 DE |
74 | }; |
75 | ||
76 | #endif // _WX_COCOA_APP_H_ |