]>
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"
33 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
37 wxApp
* WXDLLEXPORT wxTheApp
= NULL
;
39 wxAppInitializerFunction
40 wxAppBase::m_appInitFn
= (wxAppInitializerFunction
)NULL
;
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 // ----------------------------------------------------------------------------
63 // stubs for some GUI functions
64 // ----------------------------------------------------------------------------
66 void WXDLLEXPORT
wxExit()
71 // Yield to other apps/messages
72 bool WXDLLEXPORT
wxYield()
78 // Yield to other apps/messages
79 void WXDLLEXPORT
wxWakeUpIdle()
84 // ----------------------------------------------------------------------------
85 // wxBase-specific functions
86 // ----------------------------------------------------------------------------
88 bool WXDLLEXPORT
wxInitialize()
92 // already initialized
96 wxASSERT_MSG( !wxTheApp
,
97 wxT("either call wxInitialize or create app, not both!") );
99 wxClassInfo::InitializeClasses();
101 wxModule::RegisterModules();
102 if ( !wxModule::InitializeModules() )
107 wxTheApp
= new wxConsoleApp
;
119 void WXDLLEXPORT
wxUninitialize()
121 if ( !--gs_nInitCount
)
123 wxModule::CleanUpModules();
125 wxClassInfo::CleanUpClasses();
127 // delete the application object
129 wxTheApp
= (wxApp
*)NULL
;