+#include "wx/vidmode.h"
+#include "wx/evtloop.h"
+
+#if wxUSE_FONTMAP
+ #include "wx/fontmap.h"
+#endif // wxUSE_FONTMAP
+
+// DLL options compatibility check:
+#include "wx/build.h"
+WX_CHECK_BUILD_OPTIONS("wxCore")
+
+// ============================================================================
+// wxAppBase implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// initialization
+// ----------------------------------------------------------------------------
+
+wxAppBase::wxAppBase()
+{
+ m_topWindow = 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();
+
+ // for compatibility call the old initialization function too
+ if ( !OnInitGui() )
+ return false;
+
+ 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();