(blind) fix for wxMac compilation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,7 +32,15 @@ class WXDLLIMPEXP_BASE wxCmdLineParser;
|
|||||||
class WXDLLIMPEXP_BASE wxLog;
|
class WXDLLIMPEXP_BASE wxLog;
|
||||||
class WXDLLIMPEXP_BASE wxMessageOutput;
|
class WXDLLIMPEXP_BASE wxMessageOutput;
|
||||||
|
|
||||||
class WXDLLEXPORT wxEventLoop;
|
// wxUSE_EVTLOOP_IN_APP is a temporary hack needed until all ports are updated
|
||||||
|
// to use wxEventLoop, otherwise we get linking errors on wxMac, it's going to
|
||||||
|
// disappear a.s.a.p.
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
#define wxUSE_EVTLOOP_IN_APP 0
|
||||||
|
#else
|
||||||
|
#define wxUSE_EVTLOOP_IN_APP 1
|
||||||
|
class WXDLLEXPORT wxEventLoop;
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// typedefs
|
// typedefs
|
||||||
@@ -498,9 +506,11 @@ protected:
|
|||||||
virtual wxAppTraits *CreateTraits();
|
virtual wxAppTraits *CreateTraits();
|
||||||
|
|
||||||
|
|
||||||
|
#if wxUSE_EVTLOOP_IN_APP
|
||||||
// the main event loop of the application (may be NULL if the loop hasn't
|
// the main event loop of the application (may be NULL if the loop hasn't
|
||||||
// been started yet or has already terminated)
|
// been started yet or has already terminated)
|
||||||
wxEventLoop *m_mainLoop;
|
wxEventLoop *m_mainLoop;
|
||||||
|
#endif // wxUSE_EVTLOOP_IN_APP
|
||||||
|
|
||||||
// the main top level window (may be NULL)
|
// the main top level window (may be NULL)
|
||||||
wxWindow *m_topWindow;
|
wxWindow *m_topWindow;
|
||||||
|
@@ -97,7 +97,9 @@ wxAppBase::wxAppBase()
|
|||||||
m_useBestVisual = FALSE;
|
m_useBestVisual = FALSE;
|
||||||
m_isActive = TRUE;
|
m_isActive = TRUE;
|
||||||
|
|
||||||
|
#if wxUSE_EVTLOOP_IN_APP
|
||||||
m_mainLoop = NULL;
|
m_mainLoop = NULL;
|
||||||
|
#endif // wxUSE_EVTLOOP_IN_APP
|
||||||
|
|
||||||
// We don't want to exit the app if the user code shows a dialog from its
|
// 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
|
// OnInit() -- but this is what would happen if we set m_exitOnFrameDelete
|
||||||
@@ -270,37 +272,51 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser)
|
|||||||
|
|
||||||
int wxAppBase::MainLoop()
|
int wxAppBase::MainLoop()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_EVTLOOP_IN_APP
|
||||||
wxTiedEventLoopPtr mainLoop(&m_mainLoop, new wxEventLoop);
|
wxTiedEventLoopPtr mainLoop(&m_mainLoop, new wxEventLoop);
|
||||||
|
|
||||||
return m_mainLoop->Run();
|
return m_mainLoop->Run();
|
||||||
|
#else // !wxUSE_EVTLOOP_IN_APP
|
||||||
|
return 0;
|
||||||
|
#endif // wxUSE_EVTLOOP_IN_APP/!wxUSE_EVTLOOP_IN_APP
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAppBase::ExitMainLoop()
|
void wxAppBase::ExitMainLoop()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_EVTLOOP_IN_APP
|
||||||
// we should exit from the main event loop, not just any currently active
|
// we should exit from the main event loop, not just any currently active
|
||||||
// (e.g. modal dialog) event loop
|
// (e.g. modal dialog) event loop
|
||||||
if ( m_mainLoop )
|
if ( m_mainLoop )
|
||||||
{
|
{
|
||||||
m_mainLoop->Exit(0);
|
m_mainLoop->Exit(0);
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_EVTLOOP_IN_APP
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxAppBase::Pending()
|
bool wxAppBase::Pending()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_EVTLOOP_IN_APP
|
||||||
// use the currently active message loop here, not m_mainLoop, because if
|
// 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
|
// we're showing a modal dialog (with its own event loop) currently the
|
||||||
// main event loop is not running anyhow
|
// main event loop is not running anyhow
|
||||||
wxEventLoop * const loop = wxEventLoop::GetActive();
|
wxEventLoop * const loop = wxEventLoop::GetActive();
|
||||||
|
|
||||||
return loop && loop->Pending();
|
return loop && loop->Pending();
|
||||||
|
#else // wxUSE_EVTLOOP_IN_APP
|
||||||
|
return false;
|
||||||
|
#endif // wxUSE_EVTLOOP_IN_APP/!wxUSE_EVTLOOP_IN_APP
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxAppBase::Dispatch()
|
bool wxAppBase::Dispatch()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_EVTLOOP_IN_APP
|
||||||
// see comment in Pending()
|
// see comment in Pending()
|
||||||
wxEventLoop * const loop = wxEventLoop::GetActive();
|
wxEventLoop * const loop = wxEventLoop::GetActive();
|
||||||
|
|
||||||
return loop ? loop->Dispatch() : true;
|
return loop ? loop->Dispatch() : true;
|
||||||
|
#else // wxUSE_EVTLOOP_IN_APP
|
||||||
|
return true;
|
||||||
|
#endif // wxUSE_EVTLOOP_IN_APP/!wxUSE_EVTLOOP_IN_APP
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user