]>
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 // ----------------------------------------------------------------------------
21 #pragma implementation "appbase.h"
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 wxApp
* WXDLLEXPORT wxTheApp
= NULL
;
33 wxAppInitializerFunction
34 wxAppBase::m_appInitFn
= (wxAppInitializerFunction
)NULL
;
37 // List of events pending processing
38 wxList
*wxPendingEvents
= NULL
;
39 wxCriticalSection
*wxPendingEventsLocker
= NULL
;
40 #endif // wxUSE_THREADS
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 class /* no WXDLLEXPORT */ wxConsoleApp
: public wxApp
49 virtual int OnRun() { wxFAIL_MSG(wxT("unreachable")); return 0; }
52 // ----------------------------------------------------------------------------
54 // ----------------------------------------------------------------------------
56 static size_t gs_nInitCount
= 0;
58 // ============================================================================
60 // ============================================================================
62 bool WXDLLEXPORT
wxInitialize()
66 // already initialized
70 wxASSERT_MSG( !wxTheApp
,
71 wxT("either call wxInitialize or create app, not both!") );
73 wxClassInfo::InitializeClasses();
75 wxModule::RegisterModules();
76 if ( !wxModule::InitializeModules() )
81 wxTheApp
= new wxConsoleApp
;
93 void WXDLLEXPORT
wxUninitialize()
95 if ( !--gs_nInitCount
)
97 wxModule::CleanUpModules();
99 wxClassInfo::CleanUpClasses();
101 // delete the application object
103 wxTheApp
= (wxApp
*)NULL
;