]> git.saurik.com Git - wxWidgets.git/blame - src/common/init.cpp
Added demonstration of insert/delete rows/cols
[wxWidgets.git] / src / common / init.cpp
CommitLineData
e90c1d2a
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: common/init.cpp
3// Purpose: initialisation for the library
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 04.10.99
7// RCS-ID: $Id$
8// Copyright: (c) Vadim Zeitlin
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#ifdef __GNUG__
21 #pragma implementation "appbase.h"
22#endif
23
24#include "wx/app.h"
25#include "wx/debug.h"
26
27// ----------------------------------------------------------------------------
28// global vars
29// ----------------------------------------------------------------------------
30
31wxApp * WXDLLEXPORT wxTheApp = NULL;
32
33wxAppInitializerFunction
34 wxAppBase::m_appInitFn = (wxAppInitializerFunction)NULL;
35
bbfa0322
VZ
36#if wxUSE_THREADS
37 // List of events pending processing
38 wxList *wxPendingEvents = NULL;
39 wxCriticalSection *wxPendingEventsLocker = NULL;
40#endif // wxUSE_THREADS
41
e90c1d2a
VZ
42// ----------------------------------------------------------------------------
43// private classes
44// ----------------------------------------------------------------------------
45
46class /* no WXDLLEXPORT */ wxConsoleApp : public wxApp
47{
48public:
223d09f6 49 virtual int OnRun() { wxFAIL_MSG(wxT("unreachable")); return 0; }
e90c1d2a
VZ
50};
51
52// ----------------------------------------------------------------------------
53// private vars
54// ----------------------------------------------------------------------------
55
56static size_t gs_nInitCount = 0;
57
58// ============================================================================
59// implementation
60// ============================================================================
61
62bool WXDLLEXPORT wxInitialize()
63{
bbfa0322 64 if ( gs_nInitCount )
e90c1d2a
VZ
65 {
66 // already initialized
67 return TRUE;
68 }
69
70 wxASSERT_MSG( !wxTheApp,
223d09f6 71 wxT("either call wxInitialize or create app, not both!") );
e90c1d2a 72
bbfa0322
VZ
73 wxClassInfo::InitializeClasses();
74
75 wxModule::RegisterModules();
76 if ( !wxModule::InitializeModules() )
77 {
78 return FALSE;
79 }
80
e90c1d2a
VZ
81 wxTheApp = new wxConsoleApp;
82
bbfa0322
VZ
83 if ( !wxTheApp )
84 {
85 return FALSE;
86 }
87
88 gs_nInitCount++;
89
90 return TRUE;
e90c1d2a
VZ
91}
92
93void WXDLLEXPORT wxUninitialize()
94{
95 if ( !--gs_nInitCount )
96 {
bbfa0322
VZ
97 wxModule::CleanUpModules();
98
99 wxClassInfo::CleanUpClasses();
100
e90c1d2a
VZ
101 // delete the application object
102 delete wxTheApp;
103 wxTheApp = (wxApp *)NULL;
104 }
105}