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