]>
git.saurik.com Git - wxWidgets.git/blob - src/common/init.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: common/init.cpp
3 // Purpose: initialisation for the library
4 // Author: Vadim Zeitlin
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/wxprec.h"
29 #include "wx/module.h"
32 // ----------------------------------------------------------------------------
34 // ----------------------------------------------------------------------------
36 wxApp
* WXDLLEXPORT wxTheApp
= NULL
;
38 wxAppInitializerFunction
39 wxAppBase::m_appInitFn
= (wxAppInitializerFunction
)NULL
;
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 class /* no WXDLLEXPORT */ wxConsoleApp
: public wxApp
48 virtual int OnRun() { wxFAIL_MSG(wxT("unreachable")); return 0; }
51 // ----------------------------------------------------------------------------
53 // ----------------------------------------------------------------------------
55 static size_t gs_nInitCount
= 0;
57 // ============================================================================
59 // ============================================================================
61 bool WXDLLEXPORT
wxInitialize()
65 // already initialized
69 wxASSERT_MSG( !wxTheApp
,
70 wxT("either call wxInitialize or create app, not both!") );
72 wxClassInfo::InitializeClasses();
74 wxModule::RegisterModules();
75 if ( !wxModule::InitializeModules() )
80 wxTheApp
= new wxConsoleApp
;
92 void WXDLLEXPORT
wxUninitialize()
94 if ( !--gs_nInitCount
)
96 wxModule::CleanUpModules();
98 wxClassInfo::CleanUpClasses();
100 // delete the application object
102 wxTheApp
= (wxApp
*)NULL
;