]>
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"
31 #include "wx/module.h"
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 wxApp
* WXDLLEXPORT wxTheApp
= NULL
;
40 wxAppInitializerFunction
41 wxAppBase::m_appInitFn
= (wxAppInitializerFunction
)NULL
;
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
47 class /* no WXDLLEXPORT */ wxConsoleApp
: public wxApp
50 virtual int OnRun() { wxFAIL_MSG(wxT("unreachable")); return 0; }
53 // ----------------------------------------------------------------------------
55 // ----------------------------------------------------------------------------
57 static size_t gs_nInitCount
= 0;
59 // ============================================================================
61 // ============================================================================
63 bool WXDLLEXPORT
wxInitialize()
67 // already initialized
71 wxASSERT_MSG( !wxTheApp
,
72 wxT("either call wxInitialize or create app, not both!") );
74 wxClassInfo::InitializeClasses();
76 wxModule::RegisterModules();
77 if ( !wxModule::InitializeModules() )
82 wxTheApp
= new wxConsoleApp
;
94 void WXDLLEXPORT
wxUninitialize()
96 if ( !--gs_nInitCount
)
98 wxModule::CleanUpModules();
100 wxClassInfo::CleanUpClasses();
102 // delete the application object
104 wxTheApp
= (wxApp
*)NULL
;