]> git.saurik.com Git - wxWidgets.git/blame - include/wx/init.h
No changes, just fix some typos in the comments in the headers.
[wxWidgets.git] / include / wx / init.h
CommitLineData
94826170
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/init.h
77ffb593 3// Purpose: wxWidgets initialization and finalization functions
94826170
VZ
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 29.06.2003
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
65571936 9// Licence: wxWindows licence
94826170
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_INIT_H_
13#define _WX_INIT_H_
14
26497253 15#include "wx/defs.h"
e3f6cbd9 16#include "wx/chartype.h"
94826170
VZ
17
18// ----------------------------------------------------------------------------
19// wxEntry helper functions which allow to have more fine grained control
20// ----------------------------------------------------------------------------
21
22// do common initialization, return true if ok (in this case wxEntryCleanup
77ffb593 23// must be called later), otherwise the program can't use wxWidgets at all
94826170
VZ
24//
25// this function also creates wxTheApp as a side effect, if IMPLEMENT_APP
26// hadn't been used a dummy default application object is created
27//
05e2b077
VZ
28// note that the parameters may be modified, this is why we pass them by
29// reference!
bb24c68f 30extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv);
94826170
VZ
31
32// free the resources allocated by the library in wxEntryStart() and shut it
33// down (wxEntryStart() may be called again afterwards if necessary)
bb24c68f 34extern void WXDLLIMPEXP_BASE wxEntryCleanup();
94826170
VZ
35
36
37// ----------------------------------------------------------------------------
38// wxEntry: this function initializes the library, runs the main event loop
39// and cleans it up
40// ----------------------------------------------------------------------------
41
42// note that other, platform-specific, overloads of wxEntry may exist as well
43// but this one always exists under all platforms
44//
45// returns the program exit code
bb24c68f 46extern int WXDLLIMPEXP_BASE wxEntry(int& argc, wxChar **argv);
94826170 47
0acfb5bd
VZ
48// we overload wxEntry[Start]() to take "char **" pointers too
49#if wxUSE_UNICODE
50
487f2d58
RD
51extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, char **argv);
52extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv);
0acfb5bd
VZ
53
54#endif// wxUSE_UNICODE
94826170 55
26cdd42d
VZ
56// Under Windows we define additional wxEntry() overloads with signature
57// compatible with WinMain() and not the traditional main().
58#if wxUSE_GUI && defined(__WINDOWS__)
59 #include "wx/msw/init.h"
60#endif
61
94826170
VZ
62// ----------------------------------------------------------------------------
63// Using the library without (explicit) application object: you may avoid using
e4431849 64// wxDECLARE_APP and wxIMPLEMENT_APP macros and call the functions below instead at
94826170
VZ
65// the program startup and termination
66// ----------------------------------------------------------------------------
67
68// initialize the library (may be called as many times as needed, but each
69// call to wxInitialize() must be matched by wxUninitialize())
d3688603
VS
70extern bool WXDLLIMPEXP_BASE wxInitialize();
71extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, wxChar **argv);
f380e251 72#if wxUSE_UNICODE
d3688603 73extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, char **argv);
f380e251 74#endif
94826170
VZ
75
76// clean up -- the library can't be used any more after the last call to
77// wxUninitialize()
bb24c68f 78extern void WXDLLIMPEXP_BASE wxUninitialize();
94826170
VZ
79
80// create an object of this class on stack to initialize/cleanup the library
81// automatically
bb24c68f 82class WXDLLIMPEXP_BASE wxInitializer
94826170
VZ
83{
84public:
85 // initialize the library
d3688603
VS
86 wxInitializer()
87 {
88 m_ok = wxInitialize();
89 }
90
91 wxInitializer(int argc, wxChar **argv)
76cebbff
VZ
92 {
93 m_ok = wxInitialize(argc, argv);
94 }
94826170 95
f380e251 96#if wxUSE_UNICODE
d3688603 97 wxInitializer(int argc, char **argv)
f380e251
VS
98 {
99 m_ok = wxInitialize(argc, argv);
100 }
101#endif // wxUSE_UNICODE
102
94826170
VZ
103 // has the initialization been successful? (explicit test)
104 bool IsOk() const { return m_ok; }
105
106 // has the initialization been successful? (implicit test)
107 operator bool() const { return m_ok; }
108
109 // dtor only does clean up if we initialized the library properly
110 ~wxInitializer() { if ( m_ok ) wxUninitialize(); }
111
112private:
113 bool m_ok;
114};
115
116#endif // _WX_INIT_H_
117