]>
Commit | Line | Data |
---|---|---|
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 | |
d54598dd VZ |
39 | // =========================================================================== |
40 | // implementation | |
41 | // =========================================================================== | |
42 | ||
72cdf4c9 VZ |
43 | // --------------------------------------------------------------------------- |
44 | // wxAppBase | |
45 | // ---------------------------------------------------------------------------- | |
46 | ||
47 | void wxAppBase::ProcessPendingEvents() | |
48 | { | |
49 | // ensure that we're the only thread to modify the pending events list | |
16c1f79c | 50 | wxENTER_CRIT_SECT( *wxPendingEventsLocker ); |
72cdf4c9 VZ |
51 | |
52 | if ( !wxPendingEvents ) | |
16c1f79c RR |
53 | { |
54 | wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); | |
72cdf4c9 | 55 | return; |
16c1f79c | 56 | } |
72cdf4c9 VZ |
57 | |
58 | // iterate until the list becomes empty | |
59 | wxNode *node = wxPendingEvents->First(); | |
60 | while (node) | |
61 | { | |
62 | wxEvtHandler *handler = (wxEvtHandler *)node->Data(); | |
16c1f79c | 63 | delete node; |
72cdf4c9 | 64 | |
16c1f79c | 65 | // In ProcessPendingEvents(), new handlers might be add |
ce6d2511 | 66 | // and we can safely leave the critical section here. |
16c1f79c | 67 | wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); |
72cdf4c9 | 68 | handler->ProcessPendingEvents(); |
16c1f79c | 69 | wxENTER_CRIT_SECT( *wxPendingEventsLocker ); |
72cdf4c9 | 70 | |
72cdf4c9 VZ |
71 | node = wxPendingEvents->First(); |
72 | } | |
16c1f79c RR |
73 | |
74 | wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); | |
72cdf4c9 VZ |
75 | } |
76 | ||
7beba2fc VZ |
77 | int wxAppBase::OnExit() |
78 | { | |
79 | #if wxUSE_CONFIG | |
80 | // delete the config object if any (don't use Get() here, but Set() | |
81 | // because Get() could create a new config object) | |
82 | delete wxConfigBase::Set((wxConfigBase *) NULL); | |
83 | #endif // wxUSE_CONFIG | |
84 | ||
85 | return 0; | |
86 | } |