]>
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"
24 #include "wx/wxprec.h"
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 wxApp
* WXDLLEXPORT wxTheApp
= NULL
;
40 wxAppInitializerFunction
41 wxAppBase::m_appInitFn
= (wxAppInitializerFunction
)NULL
;
44 // List of events pending processing
45 wxList
*wxPendingEvents
= NULL
;
46 wxCriticalSection
*wxPendingEventsLocker
= NULL
;
47 #endif // wxUSE_THREADS
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 class /* no WXDLLEXPORT */ wxConsoleApp
: public wxApp
56 virtual int OnRun() { wxFAIL_MSG(wxT("unreachable")); return 0; }
59 // ----------------------------------------------------------------------------
61 // ----------------------------------------------------------------------------
63 static size_t gs_nInitCount
= 0;
65 // ============================================================================
67 // ============================================================================
69 bool WXDLLEXPORT
wxInitialize()
73 // already initialized
77 wxASSERT_MSG( !wxTheApp
,
78 wxT("either call wxInitialize or create app, not both!") );
80 wxClassInfo::InitializeClasses();
82 wxModule::RegisterModules();
83 if ( !wxModule::InitializeModules() )
88 wxTheApp
= new wxConsoleApp
;
100 void WXDLLEXPORT
wxUninitialize()
102 if ( !--gs_nInitCount
)
104 wxModule::CleanUpModules();
106 wxClassInfo::CleanUpClasses();
108 // delete the application object
110 wxTheApp
= (wxApp
*)NULL
;