+// ----------------------------------------------------------------------------
+// main event loop implementation
+// ----------------------------------------------------------------------------
+
+int wxAppBase::MainLoop()
+{
+ wxEventLoopTiedPtr mainLoop(&m_mainLoop, new wxEventLoop);
+
+ return m_mainLoop->Run();
+}
+
+void wxAppBase::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 wxAppBase::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
+ wxEventLoop * const loop = wxEventLoop::GetActive();
+
+ return loop && loop->Pending();
+}
+
+bool wxAppBase::Dispatch()
+{
+ // see comment in Pending()
+ wxEventLoop * const loop = wxEventLoop::GetActive();
+
+ return loop && loop->Dispatch();
+}
+