X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e7445ff8ee26e39fab1e35455e1bef954bdf636f..d632789924e1ef1427c5321476215bd473dfe4d6:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index d37a9be4ac..44c63efd1a 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -25,13 +25,11 @@ #endif #ifndef WX_PRECOMP - #include "wx/list.h" #include "wx/app.h" + #include "wx/window.h" #include "wx/bitmap.h" - #include "wx/intl.h" #include "wx/log.h" #include "wx/msgdlg.h" - #include "wx/bitmap.h" #include "wx/confbase.h" #include "wx/utils.h" #endif @@ -41,6 +39,7 @@ #include "wx/evtloop.h" #include "wx/msgout.h" #include "wx/thread.h" +#include "wx/vidmode.h" #include "wx/ptr_scpd.h" #if defined(__WXMSW__) @@ -158,6 +157,41 @@ void wxAppBase::CleanUp() #endif // wxUSE_THREADS } +// ---------------------------------------------------------------------------- +// various accessors +// ---------------------------------------------------------------------------- + +wxWindow* wxAppBase::GetTopWindow() const +{ + wxWindow* window = m_topWindow; + if (window == NULL && wxTopLevelWindows.GetCount() > 0) + window = wxTopLevelWindows.GetFirst()->GetData(); + return window; +} + +wxVideoMode wxAppBase::GetDisplayMode() const +{ + return wxVideoMode(); +} + +wxLayoutDirection wxAppBase::GetLayoutDirection() const +{ +#if wxUSE_INTL + const wxLocale *const locale = wxGetLocale(); + if ( locale ) + { + const wxLanguageInfo *const + info = wxLocale::GetLanguageInfo(locale->GetLanguage()); + + if ( info ) + return info->LayoutDirection; + } +#endif // wxUSE_INTL + + // we don't know + return wxLayout_Default; +} + #if wxUSE_CMDLINE_PARSER // ---------------------------------------------------------------------------- @@ -367,11 +401,14 @@ void wxAppBase::DeletePendingObjects() { wxObject *obj = node->GetData(); - delete obj; - - if (wxPendingDelete.Member(obj)) + // remove it from the list first so that if we get back here somehow + // during the object deletion (e.g. wxYield called from its dtor) we + // wouldn't try to delete it the second time + if ( wxPendingDelete.Member(obj) ) wxPendingDelete.Erase(node); + delete obj; + // Deleting one object may have deleted other pending // objects, so start from beginning of list again. node = wxPendingDelete.GetFirst();