]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/app.h
wxTinderbox build fix (!PCH support).
[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
8cf73271
SC
15#include "wx/defs.h"
16#include "wx/object.h"
17#include "wx/gdicmn.h"
18#include "wx/event.h"
19
ec8565f3 20#ifdef __WXMAC_OSX__
2c7219fe 21typedef struct __CFRunLoopSource * CFRunLoopSourceRef;
413baa20 22#endif
95e568ee 23
8cf73271
SC
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
8cf73271
SC
50 virtual bool Yield(bool onlyIfNeeded = FALSE);
51 virtual void WakeUpIdle();
52
53 virtual void SetPrintMode(int mode) { m_printMode = mode; }
54 virtual int GetPrintMode() const { return m_printMode; }
55
56#if wxUSE_GUI
57 // setting up all MacOS Specific Event-Handlers etc
58 virtual bool OnInitGui();
59#endif // wxUSE_GUI
60 // implementation only
61 void OnIdle(wxIdleEvent& event);
62 void OnEndSession(wxCloseEvent& event);
63 void OnQueryEndSession(wxCloseEvent& event);
64
4d90072c
VZ
65 void MacDoOneEvent() ;
66
8cf73271
SC
67protected:
68 bool m_showOnInit;
69 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
4f305456 70
8cf73271
SC
71public:
72
73 static bool sm_isEmbedded;
74 // Implementation
75 virtual bool Initialize(int& argc, wxChar **argv);
76 virtual void CleanUp();
77
8cf73271
SC
78 // the installed application event handler
79 WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
80 WXEVENTHANDLERREF MacGetCurrentEventHandlerCallRef() { return m_macCurrentEventHandlerCallRef ; }
81 void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler )
82 { m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; }
8cf73271
SC
83
84public:
85 static long sm_lastMessageTime;
86 static wxWindow* s_captureWindow ;
87 static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right
88 static WXHRGN s_macCursorRgn ;
89 static long s_lastModifiers ;
90
91 int m_nCmdShow;
92
93private:
8cf73271 94 // mac specifics
4f305456 95
8cf73271
SC
96 WXEVENTHANDLERREF m_macEventHandler ;
97 WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
8cf73271 98 WXEVENTREF m_macCurrentEvent ;
ec8565f3 99#ifdef __WXMAC_OSX__
95e568ee 100 CFRunLoopSourceRef m_macEventPosted ;
ec8565f3 101#endif
8cf73271
SC
102
103public:
104 static bool s_macSupportPCMenuShortcuts ;
105 static long s_macAboutMenuItemId ;
106 static long s_macPreferencesMenuItemId ;
107 static long s_macExitMenuItemId ;
108 static wxString s_macHelpMenuTitleName ;
109
110 static bool s_macHasAppearance ;
111 static long s_macAppearanceVersion ;
112 static bool s_macHasNavigation ;
113 static bool s_macNavigationVersion ;
114 static bool s_macHasWindowManager ;
115 static long s_macWindowManagerVersion ;
116 static bool s_macHasMenuManager ;
117 static long s_macMenuManagerVersion ;
118 static bool s_macHasDialogManager ;
119 static long s_macDialogManagerVersion ;
e9b41b24 120
8cf73271
SC
121 WXHRGN m_macCursorRgn ;
122 WXHRGN m_macSleepRgn ;
123 WXHRGN m_macHelpRgn ;
124
8cf73271
SC
125 WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
126 void MacHandleOneEvent( WXEVENTREF ev ) ;
127
128 // For embedded use. By default does nothing.
129 virtual void MacHandleUnhandledEvent( WXEVENTREF ev );
130
2d17efa9
SC
131 bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
132 bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
f139ea01
SC
133 bool MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
134 void MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ;
8cf73271
SC
135 virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
136 virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
137 virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
138 virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
139 virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
140
141 // in response of an open-document apple event
142 virtual void MacOpenFile(const wxString &fileName) ;
143 // in response of a print-document apple event
144 virtual void MacPrintFile(const wxString &fileName) ;
145 // in response of a open-application apple event
146 virtual void MacNewFile() ;
147 // in response of a reopen-application apple event
148 virtual void MacReopenApp() ;
149
150 DECLARE_EVENT_TABLE()
151};
152
8cf73271
SC
153#endif
154 // _WX_APP_H_
155