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