]> git.saurik.com Git - wxWidgets.git/blame_incremental - 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_incremental - 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 182.
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/app.h
3// Purpose: wxAppBase class and macros used for declaration of wxApp
4// derived class in the user code
5// Author: Julian Smart
6// Modified by:
7// Created: 01/02/97
8// RCS-ID: $Id$
9// Copyright: (c) Julian Smart
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_APP_H_BASE_
14#define _WX_APP_H_BASE_
15
16// ----------------------------------------------------------------------------
17// headers we have to include here
18// ----------------------------------------------------------------------------
19
20#include "wx/event.h" // for the base class
21
22#if wxUSE_GUI
23 #include "wx/window.h" // for wxTopLevelWindows
24
25 #include "wx/vidmode.h"
26#endif // wxUSE_GUI
27
28#include "wx/build.h"
29#include "wx/init.h" // we must declare wxEntry()
30#include "wx/intl.h"
31
32class WXDLLIMPEXP_BASE wxAppConsole;
33class WXDLLIMPEXP_BASE wxAppTraits;
34class WXDLLIMPEXP_BASE wxCmdLineParser;
35class WXDLLIMPEXP_BASE wxLog;
36class WXDLLIMPEXP_BASE wxMessageOutput;
37
38#if wxUSE_GUI
39 class WXDLLEXPORT wxEventLoop;
40#endif
41
42// ----------------------------------------------------------------------------
43// typedefs
44// ----------------------------------------------------------------------------
45
46// the type of the function used to create a wxApp object on program start up
47typedef wxAppConsole* (*wxAppInitializerFunction)();
48
49// ----------------------------------------------------------------------------
50// constants
51// ----------------------------------------------------------------------------
52
53enum
54{
55 wxPRINT_WINDOWS = 1,
56 wxPRINT_POSTSCRIPT = 2
57};
58
59// ----------------------------------------------------------------------------
60// wxAppConsole: wxApp for non-GUI applications
61// ----------------------------------------------------------------------------
62
63class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler
64{
65public:
66 // ctor and dtor
67 wxAppConsole();
68 virtual ~wxAppConsole();
69
70
71 // the virtual functions which may/must be overridden in the derived class
72 // -----------------------------------------------------------------------
73
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!
79 virtual bool Initialize(int& argc, wxChar **argv);
80
81 // This gives wxCocoa a chance to call OnInit() with a memory pool in place
82 virtual bool CallOnInit() { return OnInit(); }
83
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.
88 virtual bool OnInit();
89
90 // this is here only temporary hopefully (FIXME)
91 virtual bool OnInitGui() { return true; }
92
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.
95 virtual int OnRun() = 0;
96
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.
99 virtual int OnExit();
100
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
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.
112 virtual void OnFatalException() { }
113
114 // Called from wxExit() function, should terminate the application a.s.a.p.
115 virtual void Exit();
116
117 // Return the layout direction for the current locale
118 virtual wxLayoutDirection GetLayoutDirection() const;
119
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 {
131 return m_appName.empty() ? m_className : m_appName;
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
143
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
156 // to the given parser (don't forget to call the base class version if you
157 // override it!)
158 virtual void OnInitCmdLine(wxCmdLineParser& parser);
159
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
162 // version if you override it!)
163 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
164
165 // called if "--help" option was specified, return true to continue
166 // and false to exit
167 virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
168
169 // called if incorrect command line options were given, return
170 // false to abort and true to continue
171 virtual bool OnCmdLineError(wxCmdLineParser& parser);
172#endif // wxUSE_CMDLINE_PARSER
173
174
175 // miscellaneous customization functions
176 // -------------------------------------
177
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