]>
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 | ||
15 | // entrypoint | |
16 | int WXDLLEXPORT wxEntry( int argc, char *argv[] ); | |
17 | ||
18 | // Represents the application. Derive OnInit and declare | |
19 | // a new App object to start application | |
20 | class WXDLLEXPORT wxApp: public wxAppBase | |
21 | { | |
22 | DECLARE_DYNAMIC_CLASS(wxApp) | |
23 | DECLARE_EVENT_TABLE() | |
24 | // ------------------------------------------------------------------------ | |
25 | // initialization | |
26 | // ------------------------------------------------------------------------ | |
27 | public: | |
28 | wxApp(); | |
29 | virtual ~wxApp() {} | |
30 | ||
31 | // ------------------------------------------------------------------------ | |
32 | // Cocoa specifics | |
33 | // ------------------------------------------------------------------------ | |
34 | public: | |
35 | inline WX_NSApplication GetNSApplication() { return m_cocoaApp; } | |
36 | void CocoaInstallRequestedIdleHandler() { if(m_isIdle) CocoaInstallIdleHandler(); } | |
37 | inline void CocoaRequestIdle() { m_isIdle = true; } | |
38 | protected: | |
39 | WX_NSApplication m_cocoaApp; | |
40 | void CocoaInstallIdleHandler(); | |
41 | bool m_isIdle; | |
42 | ||
43 | // ------------------------------------------------------------------------ | |
44 | // Implementation | |
45 | // ------------------------------------------------------------------------ | |
46 | public: | |
47 | // Implement wxAppBase pure virtuals | |
48 | virtual int MainLoop(); | |
49 | virtual void ExitMainLoop(); | |
50 | virtual bool Initialized(); | |
51 | virtual bool Pending(); | |
52 | virtual void Dispatch(); | |
e2478fde VZ |
53 | |
54 | virtual void Exit(); | |
55 | ||
fb896a32 DE |
56 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
57 | virtual bool ProcessIdle(); | |
bf252640 | 58 | virtual void WakeUpIdle() { CocoaRequestIdle(); } |
fb896a32 DE |
59 | |
60 | /* Idle Processing */ | |
61 | void OnIdle(wxIdleEvent& event); | |
62 | // Send idle event to all top-level windows. | |
63 | // Returns TRUE if more idle time is requested. | |
64 | bool SendIdleEvents(); | |
65 | // Send idle event to window and all subwindows | |
66 | // Returns TRUE if more idle time is requested. | |
67 | bool SendIdleEvents(wxWindowCocoa* win); | |
68 | ||
69 | static bool Initialize(); | |
70 | static void CleanUp(); | |
71 | ||
72 | virtual bool OnInit(); | |
73 | virtual bool OnInitGui(); | |
74 | void DeletePendingObjects(); | |
75 | }; | |
76 | ||
77 | #endif // _WX_COCOA_APP_H_ |