]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mac/app.h
Changed all symbols with the name "id" to "timerid" to allow Objective-C++
[wxWidgets.git] / include / wx / mac / app.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: app.h
3// Purpose: wxApp class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_APP_H_
13#define _WX_APP_H_
14
15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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
24class WXDLLEXPORT wxFrame;
25class WXDLLEXPORT wxWindowMac;
26class WXDLLEXPORT wxApp ;
27class WXDLLEXPORT wxKeyEvent;
28class WXDLLEXPORT wxLog;
29
30#define wxPRINT_WINDOWS 1
31#define wxPRINT_POSTSCRIPT 2
32
33WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
34
35// Force an exit from main loop
36void WXDLLEXPORT wxExit();
37
38// Yield to other apps/messages
39bool WXDLLEXPORT wxYield();
40
41// Represents the application. Derive OnInit and declare
42// a new App object to start application
43class WXDLLEXPORT wxApp: public wxAppBase
44{
45 DECLARE_DYNAMIC_CLASS(wxApp)
46
47 wxApp();
48 virtual ~wxApp() {}
49
50 virtual int MainLoop();
51 virtual void ExitMainLoop();
52 virtual bool Pending() ;
53 virtual bool Dispatch() ;
54
55 virtual void Exit();
56
57 virtual bool Yield(bool onlyIfNeeded = FALSE);
58 virtual void WakeUpIdle();
59
60 virtual void SetPrintMode(int mode) { m_printMode = mode; }
61 virtual int GetPrintMode() const { return m_printMode; }
62
63#if wxUSE_GUI
64 // setting up all MacOS Specific Event-Handlers etc
65 virtual bool OnInitGui();
66#endif // wxUSE_GUI
67 // implementation only
68 void OnIdle(wxIdleEvent& event);
69 void OnEndSession(wxCloseEvent& event);
70 void OnQueryEndSession(wxCloseEvent& event);
71
72 // Windows only, but for compatibility...
73 inline void SetAuto3D(bool flag) { m_auto3D = flag; }
74 inline bool GetAuto3D() const { return m_auto3D; }
75
76protected:
77 bool m_showOnInit;
78 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
79 bool m_auto3D ; // Always use 3D controls, except
80 // where overriden
81public:
82
83 // Implementation
84 virtual bool Initialize(int& argc, wxChar **argv);
85 virtual void CleanUp();
86
87 bool IsExiting() { return !m_keepGoing ; }
88#if TARGET_CARBON
89 // the installed application event handler
90 WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
91 WXEVENTHANDLERREF MacGetCurrentEventHandlerCallRef() { return m_macCurrentEventHandlerCallRef ; }
92 void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler )
93 { m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; }
94#endif
95
96public:
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 ;
101 static long s_lastModifiers ;
102
103 int m_nCmdShow;
104
105private:
106 bool m_keepGoing ;
107
108 // mac specifics
109#if TARGET_CARBON
110 WXEVENTHANDLERREF m_macEventHandler ;
111 WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
112#endif
113 WXEVENTREF m_macCurrentEvent ;
114
115public:
116 static bool s_macSupportPCMenuShortcuts ;
117 static long s_macAboutMenuItemId ;
118 static long s_macPreferencesMenuItemId ;
119 static long s_macExitMenuItemId ;
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 ;
136
137 virtual void MacSuspend( bool convertClipboard ) ;
138 virtual void MacResume( bool convertClipboard ) ;
139 virtual void MacConvertPrivateToPublicScrap() ;
140 virtual void MacConvertPublicToPrivateScrap() ;
141
142 void MacDoOneEvent() ;
143 WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
144 void MacHandleOneEvent( WXEVENTREF ev ) ;
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 ) ;
152 virtual void MacHandleMouseDownEvent( WXEVENTREF ev ) ;
153
154 void MacHandleModifierEvents( WXEVENTREF ev ) ;
155
156 virtual void MacHandleKeyDownEvent( WXEVENTREF ev ) ;
157 virtual void MacHandleKeyUpEvent( WXEVENTREF ev ) ;
158 virtual void MacHandleHighLevelEvent( WXEVENTREF ev ) ;
159
160#else
161 virtual void MacHandleMouseMovedEvent( wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp ) ;
162#endif
163
164 void MacHandleMenuCommand( wxUint32 command ) ;
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
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) ;
172
173 // in response of an open-document apple event
174 virtual void MacOpenFile(const wxString &fileName) ;
175 // in response of a print-document apple event
176 virtual void MacPrintFile(const wxString &fileName) ;
177 // in response of a open-application apple event
178 virtual void MacNewFile() ;
179
180 DECLARE_EVENT_TABLE()
181};
182
183class WXDLLEXPORT wxStAppResource
184{
185public:
186 wxStAppResource() ;
187 ~wxStAppResource() ;
188
189 // opaque pointer for CFragInitBlock
190 static void OpenSharedLibraryResource(const void *) ;
191 static void CloseSharedLibraryResource() ;
192
193private:
194 short m_currentRefNum ;
195} ;
196
197#endif
198 // _WX_APP_H_
199