]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/app.h
Don't overwrite wxFD_ styles in m_windowStyle.
[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 173.
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#include "wx/build.h"
22#include "wx/init.h" // we must declare wxEntry()
23#include "wx/intl.h" // for wxLayoutDirection
24
25class WXDLLIMPEXP_BASE wxAppConsole;
26class WXDLLIMPEXP_BASE wxAppTraits;
27class WXDLLIMPEXP_BASE wxCmdLineParser;
28class WXDLLIMPEXP_BASE wxLog;
29class WXDLLIMPEXP_BASE wxMessageOutput;
30
31#if wxUSE_GUI
32 class WXDLLEXPORT wxEventLoop;
33 struct WXDLLIMPEXP_CORE wxVideoMode;
34#endif
35
36// ----------------------------------------------------------------------------
37// typedefs
38// ----------------------------------------------------------------------------
39
40// the type of the function used to create a wxApp object on program start up
41typedef wxAppConsole* (*wxAppInitializerFunction)();
42
43// ----------------------------------------------------------------------------
44// constants
45// ----------------------------------------------------------------------------
46
47enum
48{
49 wxPRINT_WINDOWS = 1,
50 wxPRINT_POSTSCRIPT = 2
51};
52
53// ----------------------------------------------------------------------------
54// wxAppConsole: wxApp for non-GUI applications
55// ----------------------------------------------------------------------------
56
57class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler
58{
59public:
60 // ctor and dtor
61 wxAppConsole();
62 virtual ~wxAppConsole();
63
64
65 // the virtual functions which may/must be overridden in the derived class
66 // -----------------------------------------------------------------------
67
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!
73 virtual bool Initialize(int& argc, wxChar **argv);
74
75 // This gives wxCocoa a chance to call OnInit() with a memory pool in place
76 virtual bool CallOnInit() { return OnInit(); }
77
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.
82 virtual bool OnInit();
83
84 // this is here only temporary hopefully (FIXME)
85 virtual bool OnInitGui() { return true; }
86
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.
89 virtual int OnRun() = 0;
90
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.
93 virtual int OnExit();
94
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
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.
106 virtual void OnFatalException() { }
107
108 // Called from wxExit() function, should terminate the application a.s.a.p.
109 virtual void Exit();
110
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 {
122 return m_appName.empty() ? m_className : m_appName;
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
134
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
147 // to the given parser (don't forget to call the base class version if you
148 // override it!)
149 virtual void OnInitCmdLine(wxCmdLineParser& parser);
150
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
153 // version if you override it!)
154 virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
155
156 // called if "--help" option was specified, return true to continue
157 // and false to exit
158 virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
159
160 // called if incorrect command line options were given, return
161 // false to abort and true to continue
162 virtual bool OnCmdLineError(wxCmdLineParser& parser);
163#endif // wxUSE_CMDLINE_PARSER
164
165
166 // miscellaneous customization functions
167 // -------------------------------------
168
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