]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mac/carbon/app.h
Compile with builtin ODBC in GTK+ ANSI mode
[wxWidgets.git] / include / wx / mac / carbon / 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
24#ifdef __WXMAC_OSX__
25#include <CoreFoundation/CFRunLoop.h>
26#endif
27
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
76protected:
77 bool m_showOnInit;
78 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
79
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 ; }
88
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
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
108
109 WXEVENTHANDLERREF m_macEventHandler ;
110 WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
111 WXEVENTREF m_macCurrentEvent ;
112#ifdef __WXMAC_OSX__
113 CFRunLoopSourceRef m_macEventPosted ;
114#endif
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 ;
133
134 WXHRGN m_macCursorRgn ;
135 WXHRGN m_macSleepRgn ;
136 WXHRGN m_macHelpRgn ;
137
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
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 ) ;
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
166#endif
167 // _WX_APP_H_
168