]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: app.h | |
3 | // Purpose: wxApp class | |
a31a5f85 | 4 | // Author: Stefan Csomor |
0dbd6262 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
0dbd6262 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
0dbd6262 SC |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_APP_H_ | |
13 | #define _WX_APP_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
0dbd6262 SC |
16 | #pragma interface "app.h" |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | #include "wx/object.h" | |
21 | #include "wx/gdicmn.h" | |
22 | #include "wx/event.h" | |
23 | ||
24 | class WXDLLEXPORT wxFrame; | |
e766c8a9 | 25 | class WXDLLEXPORT wxWindowMac; |
0dbd6262 SC |
26 | class WXDLLEXPORT wxApp ; |
27 | class WXDLLEXPORT wxKeyEvent; | |
28 | class WXDLLEXPORT wxLog; | |
29 | ||
30 | #define wxPRINT_WINDOWS 1 | |
31 | #define wxPRINT_POSTSCRIPT 2 | |
32 | ||
33 | WXDLLEXPORT_DATA(extern wxApp*) wxTheApp; | |
34 | ||
35 | // Force an exit from main loop | |
36 | void WXDLLEXPORT wxExit(); | |
37 | ||
38 | // Yield to other apps/messages | |
39 | bool WXDLLEXPORT wxYield(); | |
40 | ||
41 | // Represents the application. Derive OnInit and declare | |
42 | // a new App object to start application | |
05adb9d2 | 43 | class WXDLLEXPORT wxApp: public wxAppBase |
0dbd6262 | 44 | { |
fbbdb7cd | 45 | DECLARE_DYNAMIC_CLASS(wxApp) |
2dbc444a | 46 | |
fbbdb7cd GD |
47 | wxApp(); |
48 | virtual ~wxApp() {} | |
49 | ||
50 | virtual int MainLoop(); | |
51 | virtual void ExitMainLoop(); | |
fbbdb7cd | 52 | virtual bool Pending() ; |
1bf77ee5 | 53 | virtual bool Dispatch() ; |
e2478fde VZ |
54 | |
55 | virtual void Exit(); | |
56 | ||
fbbdb7cd | 57 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
e2478fde | 58 | virtual void WakeUpIdle(); |
2dbc444a | 59 | |
fbbdb7cd GD |
60 | virtual void SetPrintMode(int mode) { m_printMode = mode; } |
61 | virtual int GetPrintMode() const { return m_printMode; } | |
2dbc444a | 62 | |
cbf8aca6 SC |
63 | #if wxUSE_GUI |
64 | // setting up all MacOS Specific Event-Handlers etc | |
65 | virtual bool OnInitGui(); | |
66 | #endif // wxUSE_GUI | |
fbbdb7cd GD |
67 | // implementation only |
68 | void OnIdle(wxIdleEvent& event); | |
69 | void OnEndSession(wxCloseEvent& event); | |
70 | void OnQueryEndSession(wxCloseEvent& event); | |
2dbc444a | 71 | |
fbbdb7cd GD |
72 | // Windows only, but for compatibility... |
73 | inline void SetAuto3D(bool flag) { m_auto3D = flag; } | |
74 | inline bool GetAuto3D() const { return m_auto3D; } | |
2dbc444a | 75 | |
0dbd6262 | 76 | protected: |
fbbdb7cd GD |
77 | bool m_showOnInit; |
78 | int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT | |
79 | bool m_auto3D ; // Always use 3D controls, except | |
80 | // where overriden | |
0dbd6262 SC |
81 | public: |
82 | ||
fbbdb7cd | 83 | // Implementation |
05e2b077 | 84 | virtual bool Initialize(int& argc, wxChar **argv); |
94826170 | 85 | virtual void CleanUp(); |
2dbc444a | 86 | |
fbbdb7cd | 87 | bool IsExiting() { return !m_keepGoing ; } |
cbf8aca6 | 88 | #if TARGET_CARBON |
768dc88a | 89 | // the installed application event handler |
d921af51 JS |
90 | WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } |
91 | WXEVENTHANDLERREF MacGetCurrentEventHandlerCallRef() { return m_macCurrentEventHandlerCallRef ; } | |
768dc88a SC |
92 | void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler ) |
93 | { m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; } | |
cbf8aca6 SC |
94 | #endif |
95 | ||
0dbd6262 | 96 | public: |
fbbdb7cd GD |
97 | static long sm_lastMessageTime; |
98 | static wxWindow* s_captureWindow ; | |
99 | static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right | |
100 | static WXHRGN s_macCursorRgn ; | |
41d368a4 | 101 | static long s_lastModifiers ; |
2dbc444a | 102 | |
fbbdb7cd | 103 | int m_nCmdShow; |
2dbc444a | 104 | |
cd28bcad | 105 | private: |
fbbdb7cd | 106 | bool m_keepGoing ; |
519cb848 | 107 | |
fbbdb7cd | 108 | // mac specifics |
cbf8aca6 | 109 | #if TARGET_CARBON |
768dc88a SC |
110 | WXEVENTHANDLERREF m_macEventHandler ; |
111 | WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ; | |
cbf8aca6 | 112 | #endif |
cd28bcad SC |
113 | WXEVENTREF m_macCurrentEvent ; |
114 | ||
115 | public: | |
fbbdb7cd GD |
116 | static bool s_macSupportPCMenuShortcuts ; |
117 | static long s_macAboutMenuItemId ; | |
2b5f62a0 VZ |
118 | static long s_macPreferencesMenuItemId ; |
119 | static long s_macExitMenuItemId ; | |
fbbdb7cd GD |
120 | static wxString s_macHelpMenuTitleName ; |
121 | ||
122 | static bool s_macHasAppearance ; | |
123 | static long s_macAppearanceVersion ; | |
124 | static bool s_macHasNavigation ; | |
125 | static bool s_macNavigationVersion ; | |
126 | static bool s_macHasWindowManager ; | |
127 | static long s_macWindowManagerVersion ; | |
128 | static bool s_macHasMenuManager ; | |
129 | static long s_macMenuManagerVersion ; | |
130 | static bool s_macHasDialogManager ; | |
131 | static long s_macDialogManagerVersion ; | |
132 | ||
133 | WXHRGN m_macCursorRgn ; | |
134 | WXHRGN m_macSleepRgn ; | |
135 | WXHRGN m_macHelpRgn ; | |
2dbc444a | 136 | |
fbbdb7cd GD |
137 | virtual void MacSuspend( bool convertClipboard ) ; |
138 | virtual void MacResume( bool convertClipboard ) ; | |
fbbdb7cd GD |
139 | virtual void MacConvertPrivateToPublicScrap() ; |
140 | virtual void MacConvertPublicToPrivateScrap() ; | |
2dbc444a | 141 | |
cd28bcad SC |
142 | void MacDoOneEvent() ; |
143 | WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; } | |
144 | void MacHandleOneEvent( WXEVENTREF ev ) ; | |
cbf8aca6 SC |
145 | #if !TARGET_CARBON |
146 | virtual void MacHandleMenuSelect( int menuid , int menuitem ) ; | |
147 | virtual void MacHandleMouseUpEvent( WXEVENTREF ev ) ; | |
148 | virtual void MacHandleOSEvent( WXEVENTREF ev ) ; | |
149 | virtual void MacHandleDiskEvent( WXEVENTREF ev ) ; | |
150 | virtual void MacHandleActivateEvent( WXEVENTREF ev ) ; | |
151 | virtual void MacHandleUpdateEvent( WXEVENTREF ev ) ; | |
cbf8aca6 | 152 | virtual void MacHandleMouseDownEvent( WXEVENTREF ev ) ; |
fbbdb7cd | 153 | |
41d368a4 | 154 | void MacHandleModifierEvents( WXEVENTREF ev ) ; |
cd28bcad | 155 | |
fbbdb7cd GD |
156 | virtual void MacHandleKeyDownEvent( WXEVENTREF ev ) ; |
157 | virtual void MacHandleKeyUpEvent( WXEVENTREF ev ) ; | |
fbbdb7cd | 158 | virtual void MacHandleHighLevelEvent( WXEVENTREF ev ) ; |
2dbc444a | 159 | |
bd764110 SC |
160 | #else |
161 | virtual void MacHandleMouseMovedEvent( wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp ) ; | |
cd28bcad SC |
162 | #endif |
163 | ||
2dbc444a | 164 | void MacHandleMenuCommand( wxUint32 command ) ; |
d921af51 JS |
165 | bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ; |
166 | bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ; | |
167 | ||
fbbdb7cd GD |
168 | virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; |
169 | virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; | |
170 | virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; | |
171 | virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; | |
2dbc444a | 172 | |
2072fbbb | 173 | // in response of an open-document apple event |
d921af51 | 174 | virtual void MacOpenFile(const wxString &fileName) ; |
2072fbbb | 175 | // in response of a print-document apple event |
d921af51 | 176 | virtual void MacPrintFile(const wxString &fileName) ; |
2072fbbb | 177 | // in response of a open-application apple event |
d921af51 | 178 | virtual void MacNewFile() ; |
2072fbbb | 179 | |
fbbdb7cd | 180 | DECLARE_EVENT_TABLE() |
0dbd6262 SC |
181 | }; |
182 | ||
fa15551c SC |
183 | class WXDLLEXPORT wxStAppResource |
184 | { | |
fbbdb7cd | 185 | public: |
fa15551c SC |
186 | wxStAppResource() ; |
187 | ~wxStAppResource() ; | |
fbbdb7cd GD |
188 | |
189 | // opaque pointer for CFragInitBlock | |
190 | static void OpenSharedLibraryResource(const void *) ; | |
191 | static void CloseSharedLibraryResource() ; | |
2dbc444a RD |
192 | |
193 | private: | |
fbbdb7cd | 194 | short m_currentRefNum ; |
fa15551c SC |
195 | } ; |
196 | ||
0dbd6262 SC |
197 | #endif |
198 | // _WX_APP_H_ | |
199 |