+int wxAppConsoleBase::MainLoop()
+{
+ wxEventLoopBaseTiedPtr mainLoop(&m_mainLoop, CreateMainLoop());
+
+ return m_mainLoop ? m_mainLoop->Run() : -1;
+}
+
+void wxAppConsoleBase::ExitMainLoop()
+{
+ // we should exit from the main event loop, not just any currently active
+ // (e.g. modal dialog) event loop
+ if ( m_mainLoop && m_mainLoop->IsRunning() )
+ {
+ m_mainLoop->Exit(0);
+ }
+}
+
+bool wxAppConsoleBase::Pending()
+{
+ // use the currently active message loop here, not m_mainLoop, because if
+ // we're showing a modal dialog (with its own event loop) currently the
+ // main event loop is not running anyhow
+ wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
+
+ return loop && loop->Pending();
+}
+
+bool wxAppConsoleBase::Dispatch()
+{
+ // see comment in Pending()
+ wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
+
+ return loop && loop->Dispatch();
+}
+
+bool wxAppConsoleBase::HasPendingEvents() const
+{
+ wxENTER_CRIT_SECT( *wxHandlersWithPendingEventsLocker );
+
+ bool has = wxHandlersWithPendingEvents && !wxHandlersWithPendingEvents->IsEmpty();
+
+ wxLEAVE_CRIT_SECT( *wxHandlersWithPendingEventsLocker );
+
+ return has;
+}
+
+/* static */
+bool wxAppConsoleBase::IsMainLoopRunning()
+{
+ const wxAppConsole * const app = GetInstance();
+
+ return app && app->m_mainLoop != NULL;
+}
+
+void wxAppConsoleBase::ProcessPendingEvents()