]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mac/app.h
Added defines to allow altered tab placement under gcc-2.95
[wxWidgets.git] / include / wx / mac / app.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: app.h
3// Purpose: wxApp class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_APP_H_
13#define _WX_APP_H_
14
15#ifdef __GNUG__
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 wxWindow;
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 wxEvtHandler
44{
45 DECLARE_DYNAMIC_CLASS(wxApp)
46 wxApp();
47 inline ~wxApp() {}
48
49 static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
50 static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; }
51
52 virtual int MainLoop();
53 void ExitMainLoop();
54 bool Initialized();
55 virtual bool Pending() ;
56 virtual void Dispatch() ;
57
58 void OnIdle(wxIdleEvent& event);
59
60// Generic
61 virtual bool OnInit() { return FALSE; };
62
63 // No specific tasks to do here.
64 virtual bool OnInitGui() { return TRUE; }
65
66 // Called to set off the main loop
67 virtual int OnRun() { return MainLoop(); };
68 virtual int OnExit() { return 0; }
69
70
71 /** Returns the standard icons for the msg dialogs, implemented in
72 src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
73 virtual wxIcon GetStdIcon(int which) const;
74
75 inline void SetPrintMode(int mode) { m_printMode = mode; }
76 inline int GetPrintMode() const { return m_printMode; }
77
78 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
79 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
80
81 inline wxString GetAppName() const {
82 if (m_appName != "")
83 return m_appName;
84 else return m_className;
85 }
86
87 inline void SetAppName(const wxString& name) { m_appName = name; };
88 inline wxString GetClassName() const { return m_className; }
89 inline void SetClassName(const wxString& name) { m_className = name; }
90
91 void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
92 const wxString& GetVendorName() const { return m_vendorName; }
93
94 wxWindow *GetTopWindow() const ;
95 inline void SetTopWindow(wxWindow *win) { m_topWindow = win; }
96
97 inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
98 inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
99
100 // Send idle event to all top-level windows.
101 // Returns TRUE if more idle time is requested.
102 bool SendIdleEvents();
103
104 // Send idle event to window and all subwindows
105 // Returns TRUE if more idle time is requested.
106 bool SendIdleEvents(wxWindow* win);
107
108 // Windows only, but for compatibility...
109 inline void SetAuto3D(bool flag) { m_auto3D = flag; }
110 inline bool GetAuto3D() const { return m_auto3D; }
111
112 // Creates a log object
113 virtual wxLog* CreateLogTarget();
114
115public:
116 // Will always be set to the appropriate, main-style values.
117 int argc;
118 char ** argv;
119
120protected:
121 bool m_wantDebugOutput ;
122 wxString m_className;
123 wxString m_appName,
124 m_vendorName;
125 wxWindow * m_topWindow;
126 bool m_exitOnFrameDelete;
127 bool m_showOnInit;
128 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
129 bool m_auto3D ; // Always use 3D controls, except
130 // where overriden
131 static wxAppInitializerFunction m_appInitFn;
132
133public:
134
135 // Implementation
136 static bool Initialize();
137 static void CleanUp();
138
139 void DeletePendingObjects();
140 bool ProcessIdle();
141
142public:
143 static long sm_lastMessageTime;
144 int m_nCmdShow;
145
146protected:
147 bool m_keepGoing ;
148
149// mac specifics
150
151public :
152
153 void MacDoOneEvent() ;
154
155 void MacHandleOneEvent( EventRecord *ev ) ;
156 void MacHandleNullEvent( EventRecord *ev ) ;
157 void MacHandleHighLevelEvent( EventRecord *ev ) ;
158 void MacHandleMouseDownEvent( EventRecord *ev ) ;
159 void MacHandleMouseUpEvent( EventRecord *ev ) ;
160 void MacHandleKeyDownEvent( EventRecord *ev ) ;
161 void MacHandleKeyUpEvent( EventRecord *ev ) ;
162 void MacHandleAutoKeyEvent( EventRecord *ev ) ;
163 void MacHandleActivateEvent( EventRecord *ev ) ;
164 void MacHandleUpdateEvent( EventRecord *ev ) ;
165 void MacHandleDiskEvent( EventRecord *ev ) ;
166 void MacHandleOSEvent( EventRecord *ev ) ;
167
168
169
170DECLARE_EVENT_TABLE()
171};
172
173// TODO: add platform-specific arguments
174int WXDLLEXPORT wxEntry( int argc, char *argv[] );
175
176#endif
177 // _WX_APP_H_
178