#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
#include "wx/evtloop.h"
#include "wx/msgout.h"
#include "wx/thread.h"
+#include "wx/vidmode.h"
#include "wx/ptr_scpd.h"
+#ifdef __WXDEBUG__
+ #if wxUSE_STACKWALKER
+ #include "wx/stackwalk.h"
+ #endif // wxUSE_STACKWALKER
+#endif // __WXDEBUG__
+
#if defined(__WXMSW__)
#include "wx/msw/private.h" // includes windows.h for LOGFONT
#endif
#include "wx/build.h"
WX_CHECK_BUILD_OPTIONS("wxCore")
+WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete;
// ----------------------------------------------------------------------------
// wxEventLoopPtr
wxAppBase::wxAppBase()
{
m_topWindow = (wxWindow *)NULL;
+
m_useBestVisual = false;
+ m_forceTrueColour = false;
+
m_isActive = true;
m_mainLoop = NULL;
#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
// ----------------------------------------------------------------------------
{
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();
bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg)
{
+#if defined(__WXMSW__) || !wxUSE_MSGDLG
// under MSW we prefer to use the base class version using ::MessageBox()
// even if wxMessageBox() is available because it has less chances to
// double fault our app than our wxMessageBox()
-#if defined(__WXMSW__) || !wxUSE_MSGDLG
return wxAppTraitsBase::ShowAssertDialog(msg);
#else // wxUSE_MSGDLG
+ wxString msgDlg = msg;
+
+#if wxUSE_STACKWALKER
+ // on Unix stack frame generation may take some time, depending on the
+ // size of the executable mainly... warn the user that we are working
+ wxFprintf(stderr, wxT("[Debug] Generating a stack trace... please wait"));
+ fflush(stderr);
+
+ const wxString stackTrace = GetAssertStackTrace();
+ if ( !stackTrace.empty() )
+ msgDlg << _T("\n\nCall stack:\n") << stackTrace;
+#endif // wxUSE_STACKWALKER
+
// this message is intentionally not translated -- it is for
// developpers only
- wxString msgDlg(msg);
msgDlg += wxT("\nDo you want to stop the program?\n")
wxT("You can also choose [Cancel] to suppress ")
wxT("further warnings.");