]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/app.h
Source cleaning: whitespaces & tabs, ::, TRUE/true, FALSE/false.
[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
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
8cf73271
SC
72protected:
73 bool m_showOnInit;
74 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
4f305456 75
8cf73271
SC
76public:
77
78 static bool sm_isEmbedded;
79 // Implementation
80 virtual bool Initialize(int& argc, wxChar **argv);
81 virtual void CleanUp();
82
83 bool IsExiting() { return !m_keepGoing ; }
4f305456 84
8cf73271
SC
85 // the installed application event handler
86 WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
87 WXEVENTHANDLERREF MacGetCurrentEventHandlerCallRef() { return m_macCurrentEventHandlerCallRef ; }
88 void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler )
89 { m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; }
8cf73271
SC
90
91public:
92 static long sm_lastMessageTime;
93 static wxWindow* s_captureWindow ;
94 static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right
95 static WXHRGN s_macCursorRgn ;
96 static long s_lastModifiers ;
97
98 int m_nCmdShow;
99
100private:
101 bool m_keepGoing ;
102
103 // mac specifics
4f305456 104
8cf73271
SC
105 WXEVENTHANDLERREF m_macEventHandler ;
106 WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
8cf73271
SC
107 WXEVENTREF m_macCurrentEvent ;
108
109public:
110 static bool s_macSupportPCMenuShortcuts ;
111 static long s_macAboutMenuItemId ;
112 static long s_macPreferencesMenuItemId ;
113 static long s_macExitMenuItemId ;
114 static wxString s_macHelpMenuTitleName ;
115
116 static bool s_macHasAppearance ;
117 static long s_macAppearanceVersion ;
118 static bool s_macHasNavigation ;
119 static bool s_macNavigationVersion ;
120 static bool s_macHasWindowManager ;
121 static long s_macWindowManagerVersion ;
122 static bool s_macHasMenuManager ;
123 static long s_macMenuManagerVersion ;
124 static bool s_macHasDialogManager ;
125 static long s_macDialogManagerVersion ;
126
127 WXHRGN m_macCursorRgn ;
128 WXHRGN m_macSleepRgn ;
129 WXHRGN m_macHelpRgn ;
130
8cf73271
SC
131 void MacDoOneEvent() ;
132 WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
133 void MacHandleOneEvent( WXEVENTREF ev ) ;
134
135 // For embedded use. By default does nothing.
136 virtual void MacHandleUnhandledEvent( WXEVENTREF ev );
137
4f305456
SC
138 bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ;
139 bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ;
8cf73271
SC
140
141 virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
142 virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
143 virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
144 virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
145 virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
146
147 // in response of an open-document apple event
148 virtual void MacOpenFile(const wxString &fileName) ;
149 // in response of a print-document apple event
150 virtual void MacPrintFile(const wxString &fileName) ;
151 // in response of a open-application apple event
152 virtual void MacNewFile() ;
153 // in response of a reopen-application apple event
154 virtual void MacReopenApp() ;
155
156 DECLARE_EVENT_TABLE()
157};
158
8cf73271
SC
159#endif
160 // _WX_APP_H_
161