]> git.saurik.com Git - wxWidgets.git/blame - include/wx/app.h
use LLONG_MIN instead of -1 (which is a valid time value corresponding to 1ms before...
[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 653.
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
094637f6
VZ
111
112 // application info: name, description, vendor
113 // -------------------------------------------
114
115 // NB: all these should be set by the application itself, there are no
116 // reasonable default except for the application name which is taken to
117 // be argv[0]
118
119 // set/get the application name
120 wxString GetAppName() const
121 {
e2478fde 122 return m_appName.empty() ? m_className : m_appName;
094637f6
VZ
123 }
124 void SetAppName(const wxString& name) { m_appName = name; }
125
126 // set/get the app class name
127 wxString GetClassName() const { return m_className; }
128 void SetClassName(const wxString& name) { m_className = name; }
129
130 // set/get the vendor name
131 const wxString& GetVendorName() const { return m_vendorName; }
132 void SetVendorName(const wxString& name) { m_vendorName = name; }
133
e90c1d2a 134
bf188f1a
VZ
135 // cmd line parsing stuff
136 // ----------------------
137
138 // all of these methods may be overridden in the derived class to
139 // customize the command line parsing (by default only a few standard
140 // options are handled)
141 //
142 // you also need to call wxApp::OnInit() from YourApp::OnInit() for all
143 // this to work
144
145#if wxUSE_CMDLINE_PARSER
146 // this one is called from OnInit() to add all supported options
b913d3ed
VZ
147 // to the given parser (don't forget to call the base class version if you
148 // override it!)
bf188f1a
VZ
149 virtual void OnInitCmdLine(wxCmdLineParser& parser);
150
4629016d
WS
151 // called after successfully parsing the command line, return true
152 // to continue and false to exit (don't forget to call the base class
b913d3ed 153 // version if you override it!)
bf188f1a
VZ
154 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
155
4629016d
WS
156 // called if "--help" option was specified, return true to continue
157 // and false to exit
bf188f1a
VZ
158 virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
159
160 // called if incorrect command line options were given, return
4629016d 161 // false to abort and true to continue
bf188f1a
VZ
162 virtual bool OnCmdLineError(wxCmdLineParser& parser);
163#endif // wxUSE_CMDLINE_PARSER
164
e2478fde 165
094637f6
VZ
166 // miscellaneous customization functions
167 // -------------------------------------
168
e2478fde
VZ
169 // create the app traits object to which we delegate for everything which
170 // either should be configurable by the user (then he can change the
171 // default behaviour simply by overriding CreateTraits() and returning his
172 // own traits object) or which is GUI/console dependent as then wxAppTraits
173