]> git.saurik.com Git - wxWidgets.git/blob - src/common/appcmn.cpp
fix to include correct files.lst for wxUniv
[wxWidgets.git] / src / common / appcmn.cpp
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"
33 #include "wx/list.h"
34 #endif
35
36 #include "wx/thread.h"
37 #include "wx/confbase.h"
38
39 #ifdef __WXUNIVERSAL__
40 #include "wx/univ/theme.h"
41 #endif // __WXUNIVERSAL__
42
43 // ===========================================================================
44 // implementation
45 // ===========================================================================
46
47 wxAppBase::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
67 bool 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
78 int 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
93 // ---------------------------------------------------------------------------
94 // wxAppBase
95 // ----------------------------------------------------------------------------
96
97 void wxAppBase::ProcessPendingEvents()
98 {
99 // ensure that we're the only thread to modify the pending events list
100 wxENTER_CRIT_SECT( *wxPendingEventsLocker );
101
102 if ( !wxPendingEvents )
103 {
104 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
105 return;
106 }
107
108 // iterate until the list becomes empty
109 wxNode *node = wxPendingEvents->First();
110 while (node)
111 {
112 wxEvtHandler *handler = (wxEvtHandler *)node->Data();
113 delete node;
114
115 // In ProcessPendingEvents(), new handlers might be add
116 // and we can safely leave the critical section here.
117 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
118 handler->ProcessPendingEvents();
119 wxENTER_CRIT_SECT( *wxPendingEventsLocker );
120
121 node = wxPendingEvents->First();
122 }
123
124 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
125 }
126
127 // ----------------------------------------------------------------------------
128 // misc
129 // ----------------------------------------------------------------------------
130
131 #if wxUSE_GUI
132
133 void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus))
134 {
135 m_isActive = active;
136 }
137
138 #endif // wxUSE_GUI