1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWindows initialization and finalization functions
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
15 #include "wx/wxchar.h"
17 // ----------------------------------------------------------------------------
18 // wxEntry helper functions which allow to have more fine grained control
19 // ----------------------------------------------------------------------------
21 // do common initialization, return true if ok (in this case wxEntryCleanup
22 // must be called later), otherwise the program can't use wxWindows at all
24 // this function also creates wxTheApp as a side effect, if IMPLEMENT_APP
25 // hadn't been used a dummy default application object is created
27 // note that the parameters may be modified, this is why we pass them by
29 extern bool WXDLLEXPORT
wxEntryStart(int& argc
, wxChar
**argv
);
31 // free the resources allocated by the library in wxEntryStart() and shut it
32 // down (wxEntryStart() may be called again afterwards if necessary)
33 extern void WXDLLEXPORT
wxEntryCleanup();
36 // ----------------------------------------------------------------------------
37 // wxEntry: this function initializes the library, runs the main event loop
39 // ----------------------------------------------------------------------------
41 // note that other, platform-specific, overloads of wxEntry may exist as well
42 // but this one always exists under all platforms
44 // returns the program exit code
45 extern int WXDLLEXPORT
wxEntry(int& argc
, wxChar
**argv
);
48 // ----------------------------------------------------------------------------
49 // Using the library without (explicit) application object: you may avoid using
50 // DECLARE_APP and IMPLEMENT_APP macros and call the functions below instead at
51 // the program startup and termination
52 // ----------------------------------------------------------------------------
54 // initialize the library (may be called as many times as needed, but each
55 // call to wxInitialize() must be matched by wxUninitialize())
56 extern bool WXDLLEXPORT
wxInitialize(int argc
= 0, wxChar
**argv
= NULL
);
58 // clean up -- the library can't be used any more after the last call to
60 extern void WXDLLEXPORT
wxUninitialize();
62 // create an object of this class on stack to initialize/cleanup the library
64 class WXDLLEXPORT wxInitializer
67 // initialize the library
68 wxInitializer() { m_ok
= wxInitialize(); }
70 // has the initialization been successful? (explicit test)
71 bool IsOk() const { return m_ok
; }
73 // has the initialization been successful? (implicit test)
74 operator bool() const { return m_ok
; }
76 // dtor only does clean up if we initialized the library properly
77 ~wxInitializer() { if ( m_ok
) wxUninitialize(); }