]> git.saurik.com Git - wxWidgets.git/blame - include/wx/app.h
wxCocoa: CodeWarrior (like GCC) mangles struct X and @class X identically.
[wxWidgets.git] / include / wx / app.h
Content-type: text/html ]> git.saurik.com Git - wxWidgets.git/blame - include/wx/app.h


500 - Internal Server Error

Malformed UTF-8 character (fatal) at /usr/lib/x86_64-linux-gnu/perl5/5.40/HTML/Entities.pm line 485, <$fd> line 661.
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
090a6d7a 2// Name: wx/app.h
094637f6
VZ
3// Purpose: wxAppBase class and macros used for declaration of wxApp
4// derived class in the user code
c801d85f
KB
5// Author: Julian Smart
6// Modified by:
7// Created: 01/02/97
8// RCS-ID: $Id$
371a5b4e 9// Copyright: (c) Julian Smart
094637f6 10// Licence: wxWindows licence
c801d85f
KB
11/////////////////////////////////////////////////////////////////////////////
12
34138703
JS
13#ifndef _WX_APP_H_BASE_
14#define _WX_APP_H_BASE_
c801d85f 15
23280650
VZ
16// ----------------------------------------------------------------------------
17// headers we have to include here
18// ----------------------------------------------------------------------------
19
20#include "wx/event.h" // for the base class
21
e90c1d2a 22#if wxUSE_GUI
bf188f1a 23 #include "wx/window.h" // for wxTopLevelWindows
e90c1d2a 24#endif // wxUSE_GUI
23280650 25
090a6d7a 26#include "wx/build.h"
0fcbaf23 27#include "wx/init.h" // we must declare wxEntry()
090a6d7a 28
e8e1149b 29class WXDLLIMPEXP_BASE wxAppConsole;
bddd7a8d
VZ
30class WXDLLIMPEXP_BASE wxAppTraits;
31class WXDLLIMPEXP_BASE wxCmdLineParser;
32class WXDLLIMPEXP_BASE wxLog;
33class WXDLLIMPEXP_BASE wxMessageOutput;
a69be60b 34
53c9228e
VZ
35// ----------------------------------------------------------------------------
36// typedefs
37// ----------------------------------------------------------------------------
38
39// the type of the function used to create a wxApp object on program start up
e8e1149b 40typedef wxAppConsole* (*wxAppInitializerFunction)();
53c9228e 41
094637f6
VZ
42// ----------------------------------------------------------------------------
43// constants
44// ----------------------------------------------------------------------------
45
e2478fde
VZ
46enum
47{
48 wxPRINT_WINDOWS = 1,
49 wxPRINT_POSTSCRIPT = 2
50};
094637f6 51
1b4908de
VS
52// ----------------------------------------------------------------------------
53// support for framebuffer ports
54// ----------------------------------------------------------------------------
55
56#if wxUSE_GUI
57// VS: Fullscreen/framebuffer application needs to choose display mode prior
58// to wxWindows initialization. This class holds information about display
55176f44 59// mode. It is used by wxApp::Set/GetDisplayMode.
bddd7a8d 60class WXDLLIMPEXP_CORE wxDisplayModeInfo
1b4908de
VS
61{
62public:
63 wxDisplayModeInfo() : m_ok(FALSE) {}
a69be60b 64 wxDisplayModeInfo(unsigned width, unsigned height, unsigned depth)
07082b28 65 : m_width(width), m_height(height), m_depth(depth), m_ok(TRUE) {}
a69be60b 66
07082b28
VS
67 unsigned GetWidth() const { return m_width; }
68 unsigned GetHeight() const { return m_height; }
1b4908de
VS
69 unsigned GetDepth() const { return m_depth; }
70 bool IsOk() const { return m_ok; }
71
72private:
07082b28 73 unsigned m_width, m_height, m_depth;
1b4908de
VS
74 bool m_ok;
75};
e2478fde 76#endif // wxUSE_GUI
1b4908de 77
a8eaaeb2 78
094637f6 79// ----------------------------------------------------------------------------
e2478fde 80// wxAppConsole: wxApp for non-GUI applications
094637f6
VZ
81// ----------------------------------------------------------------------------
82
bddd7a8d 83class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler
094637f6
VZ
84{
85public:
e2478fde
VZ
86 // ctor and dtor
87 wxAppConsole();
88 virtual ~wxAppConsole();
89
1e6feb95 90
094637f6
VZ
91 // the virtual functions which may/must be overridden in the derived class
92 // -----------------------------------------------------------------------
bf188f1a 93
94826170
VZ
94 // This is the very first function called for a newly created wxApp object,
95 // it is used by the library to do the global initialization. If, for some
96 // reason, you must override it (instead of just overriding OnInit(), as
97 // usual, for app-specific initializations), do not forget to call the base
98 // class version!
05e2b077 99 virtual bool Initialize(int& argc, wxChar **argv);
94826170 100
7fbc89bb
DE
101 // This gives wxCocoa a chance to call OnInit() with a memory pool in place
102 virtual bool CallOnInit() { return OnInit(); }
103
e2478fde
VZ
104 // Called before OnRun(), this is a good place to do initialization -- if
105 // anything fails, return false from here to prevent the program from
106 // continuing. The command line is normally parsed here, call the base
107 // class OnInit() to do it.
bf188f1a 108 virtual bool OnInit();
094637f6 109
94826170
VZ
110 // this is here only temproary hopefully (FIXME)
111 virtual bool OnInitGui() { return true; }
112
e2478fde
VZ
113 // This is the replacement for the normal main(): all program work should
114 // be done here. When OnRun() returns, the programs starts shutting down.
e90c1d2a 115 virtual int OnRun() = 0;
094637f6 116
e2478fde
VZ
117 // This is only called if OnInit() returned true so it's a good place to do
118 // any cleanup matching the initializations done there.
7beba2fc 119 virtual int OnExit();
094637f6 120
94826170
VZ
121 // This is the very last function called on wxApp object before it is
122 // destroyed. If you override it (instead of overriding OnExit() as usual)
123 // do not forget to call the base class version!
124 virtual void CleanUp();
125
e2478fde
VZ
126 // Called when a fatal exception occurs, this function should take care not
127 // to do anything which might provoke a nested exception! It may be
128 // overridden if you wish to react somehow in non-default way (core dump
129 // under Unix, application crash under Windows) to fatal program errors,
130 // however extreme care should be taken if you don't want this function to
131 // crash.
094637f6
VZ
132 virtual void OnFatalException() { }
133
e2478fde
VZ
134 // Called from wxExit() function, should terminate the application a.s.a.p.
135 virtual void Exit();
094637f6 136
094637f6
VZ
137
138 // application info: name, description, vendor
139 // -------------------------------------------
140
141 // NB: all these should be set by the application itself, there are no
142 // reasonable default except for the application name which is taken to
143 // be argv[0]
144
145 // set/get the application name
146 wxString GetAppName() const
147 {
e2478fde 148 return m_appName.empty() ? m_className : m_appName;
094637f6
VZ
149 }
150 void SetAppName(const wxString& name) { m_appName = name; }
151
152 // set/get the app class name
153 wxString GetClassName() const { return m_className; }
154 void SetClassName(const wxString& name) { m_className = name; }
155
156 // set/get the vendor name
157 const wxString& GetVendorName() const { return m_vendorName; }
158 void SetVendorName(const wxString& name) { m_vendorName = name; }
159
e90c1d2a 160
bf188f1a
VZ
161 // cmd line parsing stuff
162 // ----------------------
163
164 // all of these methods may be overridden in the derived class to
165 // customize the command line parsing (by default only a few standard
166 // options are handled)
167 //
168 // you also need to call wxApp::OnInit() from YourApp::OnInit() for all
169 // this to work
170
171#if wxUSE_CMDLINE_PARSER
172 // this one is called from OnInit() to add all supported options
b913d3ed
VZ
173 // to the given parser (don't forget to call the base class version if you
174 // override it!)
bf188f1a
VZ
175 virtual void OnInitCmdLine(wxCmdLineParser& parser);
176
177 // called after successfully parsing the command line, return TRUE
b913d3ed
VZ
178 // to continue and FALSE to exit (don't forget to call the base class
179 // version if you override it!)
bf188f1a
VZ
180 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
181
182 // called if "--help" option was specified, return TRUE to continue
183 // and FALSE to exit
184 virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
185
186 // called if incorrect command line options were given, return
187 // FALSE to abort and TRUE to continue
188 virtual bool OnCmdLineError(wxCmdLineParser& parser);
189#endif // wxUSE_CMDLINE_PARSER
190
e2478fde 191
094637f6
VZ
192 // miscellaneous customization functions
193 // -------------------------------------
194
e2478fde
VZ
195 // create the app traits object to which we delegate for everything which
196 // either should be configurable by the user (then he can change the
197 // default behaviour simply by overriding CreateTraits() and returning his
198 // own traits object) or which is GUI/console dependent as then wxAppTraits
199