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