]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/app.h
wxMSWUniv build fix.
[wxWidgets.git] / include / wx / mac / carbon / app.h
CommitLineData
8cf73271
SC
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
65571936 9// Licence: wxWindows licence
8cf73271
SC
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
ec8565f3 24#ifdef __WXMAC_OSX__
2c7219fe 25typedef struct __CFRunLoopSource * CFRunLoopSourceRef;
413baa20 26#endif
95e568ee 27
8cf73271
SC
28class WXDLLEXPORT wxFrame;
29class WXDLLEXPORT wxWindowMac;
30class WXDLLEXPORT wxApp ;
31class WXDLLEXPORT wxKeyEvent;
32class WXDLLEXPORT wxLog;
33
34#define wxPRINT_WINDOWS 1
35#define wxPRINT_POSTSCRIPT 2
36
37WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
38
39// Force an exit from main loop
40void WXDLLEXPORT wxExit();
41
42// Yield to other apps/messages
43bool WXDLLEXPORT wxYield();
44
45// Represents the application. Derive OnInit and declare
46// a new App object to start application
47class WXDLLEXPORT wxApp: public wxAppBase
48{
49 DECLARE_DYNAMIC_CLASS(wxApp)
50
51 wxApp();
52 virtual ~wxApp() {}
53
54 virtual int MainLoop();
55 virtual void ExitMainLoop();
56 virtual bool Pending() ;
57 virtual bool Dispatch() ;
58
59 virtual void Exit();
60
61 virtual bool Yield(bool onlyIfNeeded = FALSE);
62 virtual void WakeUpIdle();
63
64 virtual void SetPrintMode(int mode) { m_printMode = mode; }
65 virtual int GetPrintMode() const { return m_printMode; }
66
67#if wxUSE_GUI
68 // setting up all MacOS Specific Event-Handlers etc
69 virtual bool OnInitGui();
70#endif // wxUSE_GUI
71 // implementation only
72 void OnIdle(wxIdleEvent& event);
73 void OnEndSession(wxCloseEvent& event);
74 void OnQueryEndSession(wxCloseEvent& event);
75
8cf73271
SC
76protected:
77 bool m_showOnInit;
78 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
4f305456 79
8cf73271
SC
80public:
81
82 static bool sm_isEmbedded;
83 // Implementation
84 virtual bool Initialize(int& argc, wxChar **argv);
85 virtual void CleanUp();
86
87 bool IsExiting() { return !m_keepGoing ; }
4f305456 88
8cf73271
SC
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 ; }
8cf73271
SC
94
95public:
96 static long sm_lastMessageTime;
97 static wxWindow* s_captureWindow ;
98 static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right
99 static WXHRGN s_macCursorRgn ;
100 static long s_lastModifiers ;
101
102 int m_nCmdShow;
103
104private:
105 bool m_keepGoing ;
106
107 // mac specifics
4f305456 108
8cf73271
SC
109 WXEVENTHANDLERREF m_macEventHandler ;
110 WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
8cf73271 111 WXEVENTREF m_macCurrentEvent ;
ec8565f3 112#ifdef __WXMAC_OSX__
95e568ee 113 CFRunLoopSourceRef m_macEventPosted ;
ec8565f3 114#endif
8cf73271
SC
115
116public:
117 static bool s_macSupportPCMenuShortcuts ;
118 static long s_macAboutMenuItemId ;
119 static long s_macPreferencesMenuItemId ;
120 static long s_macExitMenuItemId ;
121 static wxString s_macHelpMenuTitleName ;
122
123 static bool s_macHasAppearance ;
124 static long s_macAppearanceVersion ;
125 static bool s_macHasNavigation ;
126 static bool s_macNavigationVersion ;
127 static bool s_macHasWindowManager ;
128 static long s_macWindowManagerVersion ;
129 static bool s_macHasMenuManager ;
130 static long s_macMenuManagerVersion ;
131 static bool s_macHasDialogManager ;
132 static long s_macDialogManagerVersion ;
e9b41b24 133
8cf73271
SC
134 WXHRGN m_macCursorRgn ;
135 WXHRGN m_macSleepRgn ;
136 WXHRGN m_macHelpRgn ;
137
8cf73271
SC
138 void MacDoOneEvent() ;
139 WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
140 void MacHandleOneEvent( WXEVENTREF ev ) ;
141
142 // For embedded use. By default does nothing.
143 virtual void MacHandleUnhandledEvent( WXEVENTREF ev );
144
2d17efa9
SC
145 bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
146 bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
8cf73271
SC
147
148 virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
149 virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
150 virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
151 virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
152 virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
153
154 // in response of an open-document apple event
155 virtual void MacOpenFile(const wxString &fileName) ;
156 // in response of a print-document apple event
157 virtual void MacPrintFile(const wxString &fileName) ;
158 // in response of a open-application apple event
159 virtual void MacNewFile() ;
160 // in response of a reopen-application apple event
161 virtual void MacReopenApp() ;
162
163 DECLARE_EVENT_TABLE()
164};
165
8cf73271
SC
166#endif
167 // _WX_APP_H_
168