]>
git.saurik.com Git - wxWidgets.git/blob - src/common/appcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: common/appcmn.cpp
3 // Purpose: wxAppBase methods common to all platforms
4 // Author: Vadim Zeitlin
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
21 #pragma implementation "appbase.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
27 #if defined(__BORLANDC__)
36 #include "wx/thread.h"
37 #include "wx/confbase.h"
39 #ifdef __WXUNIVERSAL__
40 #include "wx/univ/theme.h"
41 #endif // __WXUNIVERSAL__
43 // ===========================================================================
45 // ===========================================================================
47 wxAppBase::wxAppBase()
49 wxTheApp
= (wxApp
*)this;
51 // VZ: what's this? is it obsolete?
52 m_wantDebugOutput
= FALSE
;
55 m_topWindow
= (wxWindow
*)NULL
;
56 m_useBestVisual
= FALSE
;
57 m_exitOnFrameDelete
= TRUE
;
62 // ----------------------------------------------------------------------------
63 // initialization and termination
64 // ----------------------------------------------------------------------------
67 bool wxAppBase::OnInitGui()
69 #ifdef __WXUNIVERSAL__
70 if ( !wxTheme::CreateDefault() )
72 #endif // __WXUNIVERSAL__
78 int wxAppBase::OnExit()
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
86 #ifdef __WXUNIVERSAL__
87 delete wxTheme::Set(NULL
);
88 #endif // __WXUNIVERSAL__
93 // ---------------------------------------------------------------------------
95 // ----------------------------------------------------------------------------
97 void wxAppBase::ProcessPendingEvents()
99 // ensure that we're the only thread to modify the pending events list
100 wxENTER_CRIT_SECT( *wxPendingEventsLocker
);
102 if ( !wxPendingEvents
)
104 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker
);
108 // iterate until the list becomes empty
109 wxNode
*node
= wxPendingEvents
->First();
112 wxEvtHandler
*handler
= (wxEvtHandler
*)node
->Data();
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
);
121 node
= wxPendingEvents
->First();
124 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker
);
127 // ----------------------------------------------------------------------------
129 // ----------------------------------------------------------------------------
133 void wxAppBase::SetActive(bool active
, wxWindow
* WXUNUSED(lastFocus
))