]> git.saurik.com Git - wxWidgets.git/blame - src/common/appcmn.cpp
use type safe list instead of wxList for m_columns
[wxWidgets.git] / src / common / appcmn.cpp
CommitLineData
72cdf4c9
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: common/appcmn.cpp
3// Purpose: wxAppBase methods common to all platforms
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 18.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// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#if defined(__BORLANDC__)
28 #pragma hdrstop
29#endif
30
31#ifndef WX_PRECOMP
32 #include "wx/app.h"
e87271f3 33 #include "wx/list.h"
72cdf4c9
VZ
34#endif
35
36#include "wx/thread.h"
7beba2fc 37#include "wx/confbase.h"
e1ee679c 38
1e6feb95
VZ
39#ifdef __WXUNIVERSAL__
40 #include "wx/univ/theme.h"
41#endif // __WXUNIVERSAL__
42
d54598dd
VZ
43// ===========================================================================
44// implementation
45// ===========================================================================
46
1e6feb95
VZ
47wxAppBase::wxAppBase()
48{
49 wxTheApp = (wxApp *)this;
50
51 // VZ: what's this? is it obsolete?
52 m_wantDebugOutput = FALSE;
53
54#if wxUSE_GUI
55 m_topWindow = (wxWindow *)NULL;
56 m_useBestVisual = FALSE;
57 m_exitOnFrameDelete = TRUE;
58 m_isActive = TRUE;
59#endif // wxUSE_GUI
60}
61
62// ----------------------------------------------------------------------------
63// initialization and termination
64// ----------------------------------------------------------------------------
65
66#if wxUSE_GUI
67bool wxAppBase::OnInitGui()
68{
69#ifdef __WXUNIVERSAL__
70 if ( !wxTheme::CreateDefault() )
71 return FALSE;
72#endif // __WXUNIVERSAL__
73
74 return TRUE;
75}
76#endif // wxUSE_GUI
77
78int wxAppBase::OnExit()
79{
80#if wxUSE_CONFIG
81 // delete the config object if any (don't use Get() here, but Set()
82 // because Get() could create a new config object)
83 delete wxConfigBase::Set((wxConfigBase *) NULL);
84#endif // wxUSE_CONFIG
85
86#ifdef __WXUNIVERSAL__
87 delete wxTheme::Set(NULL);
88#endif // __WXUNIVERSAL__
89
90 return 0;
91}
92
72cdf4c9
VZ
93// ---------------------------------------------------------------------------
94// wxAppBase
95// ----------------------------------------------------------------------------
96
97void wxAppBase::ProcessPendingEvents()
98{
99 // ensure that we're the only thread to modify the pending events list
16c1f79c 100 wxENTER_CRIT_SECT( *wxPendingEventsLocker );
72cdf4c9
VZ
101
102 if ( !wxPendingEvents )
16c1f79c
RR
103 {
104 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
72cdf4c9 105 return;
16c1f79c 106 }
72cdf4c9
VZ
107
108 // iterate until the list becomes empty
109 wxNode *node = wxPendingEvents->First();
110 while (node)
111 {
112 wxEvtHandler *handler = (wxEvtHandler *)node->Data();
16c1f79c 113 delete node;
72cdf4c9 114
16c1f79c 115 // In ProcessPendingEvents(), new handlers might be add
1d910ac1 116 // and we can safely leave the critical section here.
16c1f79c 117 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
72cdf4c9 118 handler->ProcessPendingEvents();
16c1f79c 119 wxENTER_CRIT_SECT( *wxPendingEventsLocker );
72cdf4c9 120
72cdf4c9
VZ
121 node = wxPendingEvents->First();
122 }
1d910ac1 123
16c1f79c 124 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
72cdf4c9
VZ
125}
126
1e6feb95
VZ
127// ----------------------------------------------------------------------------
128// misc
129// ----------------------------------------------------------------------------
130
131#if wxUSE_GUI
132
6e169cf3 133void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus))
7beba2fc 134{
1e6feb95 135 m_isActive = active;
7beba2fc 136}
1e6feb95
VZ
137
138#endif // wxUSE_GUI