X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e1ee679c2e3f48bc4f2607e35033ed5505ed6665..24b9f055150de329d1fb61df5ce8d14e6d657cd0:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 33d0cc1956..0b7b957dc3 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -30,19 +30,65 @@ #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/list.h" #endif #include "wx/thread.h" +#include "wx/confbase.h" + +#ifdef __WXUNIVERSAL__ + #include "wx/univ/theme.h" +#endif // __WXUNIVERSAL__ // =========================================================================== // implementation // =========================================================================== +wxAppBase::wxAppBase() +{ + wxTheApp = (wxApp *)this; + + // VZ: what's this? is it obsolete? + m_wantDebugOutput = FALSE; + +#if wxUSE_GUI + m_topWindow = (wxWindow *)NULL; + m_useBestVisual = FALSE; + m_exitOnFrameDelete = TRUE; + m_isActive = TRUE; +#endif // wxUSE_GUI +} + // ---------------------------------------------------------------------------- -// some global data defined here +// initialization and termination // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule, wxModule) +#if wxUSE_GUI +bool wxAppBase::OnInitGui() +{ +#ifdef __WXUNIVERSAL__ + if ( !wxTheme::CreateDefault() ) + return FALSE; +#endif // __WXUNIVERSAL__ + + return TRUE; +} +#endif // wxUSE_GUI + +int wxAppBase::OnExit() +{ +#if wxUSE_CONFIG + // delete the config object if any (don't use Get() here, but Set() + // because Get() could create a new config object) + delete wxConfigBase::Set((wxConfigBase *) NULL); +#endif // wxUSE_CONFIG + +#ifdef __WXUNIVERSAL__ + delete wxTheme::Set(NULL); +#endif // __WXUNIVERSAL__ + + return 0; +} // --------------------------------------------------------------------------- // wxAppBase @@ -51,21 +97,42 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule, wxModule) void wxAppBase::ProcessPendingEvents() { // ensure that we're the only thread to modify the pending events list - wxCRIT_SECT_LOCKER(locker, wxPendingEventsLocker); + wxENTER_CRIT_SECT( *wxPendingEventsLocker ); if ( !wxPendingEvents ) + { + wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); return; + } // iterate until the list becomes empty wxNode *node = wxPendingEvents->First(); while (node) { wxEvtHandler *handler = (wxEvtHandler *)node->Data(); + delete node; + // In ProcessPendingEvents(), new handlers might be add + // and we can safely leave the critical section here. + wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); handler->ProcessPendingEvents(); + wxENTER_CRIT_SECT( *wxPendingEventsLocker ); - delete node; node = wxPendingEvents->First(); } + + wxLEAVE_CRIT_SECT( *wxPendingEventsLocker ); +} + +// ---------------------------------------------------------------------------- +// misc +// ---------------------------------------------------------------------------- + +#if wxUSE_GUI + +void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus)) +{ + m_isActive = active; } +#endif // wxUSE_GUI