]>
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
;
36 // ----------------------------------------------------------------------------
38 // ----------------------------------------------------------------------------
40 class /* no WXDLLEXPORT */ wxConsoleApp
: public wxApp
43 virtual int OnRun() { wxFAIL_MSG(T("unreachable")); return 0; }
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 static size_t gs_nInitCount
= 0;
52 // ============================================================================
54 // ============================================================================
56 bool WXDLLEXPORT
wxInitialize()
58 if ( gs_nInitCount
++ )
60 // already initialized
64 wxASSERT_MSG( !wxTheApp
,
65 T("either call wxInitialize or create app, not both!") );
67 wxTheApp
= new wxConsoleApp
;
69 return wxTheApp
!= NULL
;
72 void WXDLLEXPORT
wxUninitialize()
74 if ( !--gs_nInitCount
)
76 // delete the application object
78 wxTheApp
= (wxApp
*)NULL
;