+#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
+
+#if wxUSE_FONTMAP
+ #include "wx/fontmap.h"
+#endif // wxUSE_FONTMAP
+
+// DLL options compatibility check:
+#include "wx/build.h"
+WX_CHECK_BUILD_OPTIONS("wxCore")
+
+WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete;
+
+// ============================================================================
+// wxAppBase implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// initialization
+// ----------------------------------------------------------------------------
+
+wxAppBase::wxAppBase()
+{
+ m_topWindow = (wxWindow *)NULL;
+
+ m_useBestVisual = false;
+ m_forceTrueColour = false;
+
+ m_isActive = true;
+
+ // We don't want to exit the app if the user code shows a dialog from its
+ // OnInit() -- but this is what would happen if we set m_exitOnFrameDelete
+ // to Yes initially as this dialog would be the last top level window.
+ // OTOH, if we set it to No initially we'll have to overwrite it with Yes
+ // when we enter our OnRun() because we do want the default behaviour from
+ // then on. But this would be a problem if the user code calls
+ // SetExitOnFrameDelete(false) from OnInit().
+ //
+ // So we use the special "Later" value which is such that
+ // GetExitOnFrameDelete() returns false for it but which we know we can
+ // safely (i.e. without losing the effect of the users SetExitOnFrameDelete
+ // call) overwrite in OnRun()
+ m_exitOnFrameDelete = Later;
+}
+
+bool wxAppBase::Initialize(int& argcOrig, wxChar **argvOrig)
+{
+ if ( !wxAppConsole::Initialize(argcOrig, argvOrig) )
+ return false;
+
+ wxInitializeStockLists();
+
+ wxBitmap::InitStandardHandlers();
+
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+// cleanup
+// ----------------------------------------------------------------------------
+
+wxAppBase::~wxAppBase()
+{
+ // this destructor is required for Darwin
+}
+
+void wxAppBase::CleanUp()
+{
+ // clean up all the pending objects
+ DeletePendingObjects();
+
+ // and any remaining TLWs (they remove themselves from wxTopLevelWindows
+ // when destroyed, so iterate until none are left)
+ while ( !wxTopLevelWindows.empty() )
+ {
+ // do not use Destroy() here as it only puts the TLW in pending list
+ // but we want to delete them now
+ delete wxTopLevelWindows.GetFirst()->GetData();
+ }
+
+ // undo everything we did in Initialize() above
+ wxBitmap::CleanUpHandlers();
+
+ wxStockGDI::DeleteAll();
+
+ wxDeleteStockLists();
+
+ delete wxTheColourDatabase;
+ wxTheColourDatabase = NULL;
+
+ wxAppConsole::CleanUp();
+}
+
+// ----------------------------------------------------------------------------
+// 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