]> git.saurik.com Git - wxWidgets.git/blame - include/wx/app.h
moved wxSTRINGIZE to defs.h and made it work with macro argument, so that it can...
[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 670.
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
65571936 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
090a6d7a 21#include "wx/build.h"
0fcbaf23 22#include "wx/init.h" // we must declare wxEntry()
5ff14574 23#include "wx/intl.h" // for wxLayoutDirection
090a6d7a 24
e8e1149b 25class WXDLLIMPEXP_BASE wxAppConsole;
bddd7a8d
VZ
26class WXDLLIMPEXP_BASE wxAppTraits;
27class WXDLLIMPEXP_BASE wxCmdLineParser;
28class WXDLLIMPEXP_BASE wxLog;
29class WXDLLIMPEXP_BASE wxMessageOutput;
a69be60b 30
4d90072c 31#if wxUSE_GUI
fb761cd5 32 class WXDLLEXPORT wxEventLoop;
5ff14574 33 struct WXDLLIMPEXP_CORE wxVideoMode;
fb761cd5 34#endif
1bf77ee5 35
53c9228e
VZ
36// ----------------------------------------------------------------------------
37// typedefs
38// ----------------------------------------------------------------------------
39
40// the type of the function used to create a wxApp object on program start up
e8e1149b 41typedef wxAppConsole* (*wxAppInitializerFunction)();
53c9228e 42
094637f6
VZ
43// ----------------------------------------------------------------------------
44// constants
45// ----------------------------------------------------------------------------
46
e2478fde
VZ
47enum
48{
49 wxPRINT_WINDOWS = 1,
50 wxPRINT_POSTSCRIPT = 2
51};
094637f6
VZ
52
53// ----------------------------------------------------------------------------
e2478fde 54// wxAppConsole: wxApp for non-GUI applications
094637f6
VZ
55// ----------------------------------------------------------------------------
56
bddd7a8d 57class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler
094637f6
VZ
58{
59public:
e2478fde
VZ
60 // ctor and dtor
61 wxAppConsole();
62 virtual ~wxAppConsole();
63
1e6feb95 64
094637f6
VZ
65 // the virtual functions which may/must be overridden in the derived class
66 // -----------------------------------------------------------------------
bf188f1a 67
94826170
VZ
68 // This is the very first function called for a newly created wxApp object,
69 // it is used by the library to do the global initialization. If, for some
70 // reason, you must override it (instead of just overriding OnInit(), as
71 // usual, for app-specific initializations), do not forget to call the base
72 // class version!
05e2b077 73 virtual bool Initialize(int& argc, wxChar **argv);
94826170 74
7fbc89bb
DE
75 // This gives wxCocoa a chance to call OnInit() with a memory pool in place
76 virtual bool CallOnInit() { return OnInit(); }
77
e2478fde
VZ
78 // Called before OnRun(), this is a good place to do initialization -- if
79 // anything fails, return false from here to prevent the program from
80 // continuing. The command line is normally parsed here, call the base
81 // class OnInit() to do it.
bf188f1a 82 virtual bool OnInit();
094637f6 83
87b6002d 84 // this is here only temporary hopefully (FIXME)
94826170
VZ
85 virtual bool OnInitGui() { return true; }
86
e2478fde
VZ
87 // This is the replacement for the normal main(): all program work should
88 // be done here. When OnRun() returns, the programs starts shutting down.
e90c1d2a 89 virtual int OnRun() = 0;
094637f6 90
e2478fde
VZ
91 // This is only called if OnInit() returned true so it's a good place to do
92 // any cleanup matching the initializations done there.
7beba2fc 93 virtual int OnExit();
094637f6 94
94826170
VZ
95 // This is the very last function called on wxApp object before it is
96 // destroyed. If you override it (instead of overriding OnExit() as usual)
97 // do not forget to call the base class version!
98 virtual void CleanUp();
99
e2478fde
VZ
100 // Called when a fatal exception occurs, this function should take care not
101 // to do anything which might provoke a nested exception! It may be
102 // overridden if you wish to react somehow in non-default way (core dump
103 // under Unix, application crash under Windows) to fatal program errors,
104 // however extreme care should be taken if you don't want this function to
105 // crash.
094637f6
VZ
106 virtual void OnFatalException() { }
107
e2478fde
VZ
108 // Called from wxExit() function, should terminate the application a.s.a.p.
109 virtual void Exit();
b137e493 110
978af864
VZ
111 // Return the layout direction for the current locale
112 virtual wxLayoutDirection GetLayoutDirection() const;
094637f6 113
094637f6
VZ
114
115 // application info: name, description, vendor
116 // -------------------------------------------
117
118 // NB: all these should be set by the application itself, there are no
119 // reasonable default except for the application name which is taken to
120 // be argv[0]
121
122 // set/get the application name
123 wxString GetAppName() const
124 {
e2478fde 125 return m_appName.empty() ? m_className : m_appName;
094637f6
VZ
126 }
127 void SetAppName(const wxString& name) { m_appName = name; }
128
129 // set/get the app class name
130 wxString GetClassName() const { return m_className; }
131 void SetClassName(const wxString& name) { m_className = name; }
132
133 // set/get the vendor name
134 const wxString& GetVendorName() const { return m_vendorName; }
135 void SetVendorName(const wxString& name) { m_vendorName = name; }
136
e90c1d2a 137
bf188f1a
VZ
138 // cmd line parsing stuff
139 // ----------------------
140
141 // all of these methods may be overridden in the derived class to
142 // customize the command line parsing (by default only a few standard
143 // options are handled)
144 //
145 // you also need to call wxApp::OnInit() from YourApp::OnInit() for all
146 // this to work
147
148#if wxUSE_CMDLINE_PARSER
149 // this one is called from OnInit() to add all supported options
b913d3ed
VZ
150 // to the given parser (don't forget to call the base class version if you
151 // override it!)
bf188f1a
VZ
152 virtual void OnInitCmdLine(wxCmdLineParser& parser);
153
4629016d
WS
154 // called after successfully parsing the command line, return true
155 // to continue and false to exit (don't forget to call the base class
b913d3ed 156 // version if you override it!)
bf188f1a
VZ
157 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
158
4629016d
WS
159 // called if "--help" option was specified, return true to continue
160 // and false to exit
bf188f1a
VZ
161 virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
162
163 // called if incorrect command line options were given, return
4629016d 164 // false to abort and true to continue
bf188f1a
VZ
165 virtual bool OnCmdLineError(wxCmdLineParser& parser);
166#endif // wxUSE_CMDLINE_PARSER
167
e2478fde 168
094637f6
VZ
169 // miscellaneous customization functions
170 // -------------------------------------
171
e2478fde
VZ
172 // create the app traits object to which we delegate for everything which
173 // either should be configurable by the user (then he can change the
174 // default behaviour simply by overriding CreateTraits() and returning his
175 // own traits object) or which is GUI/console dependent as then wxAppTraits
176