added wxApp::Yield()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-10-19 18:29:32 +00:00
parent 85ee61ac2e
commit 8461e4c253
19 changed files with 2116 additions and 2100 deletions

View File

@@ -1435,20 +1435,26 @@ void wxExit()
// Yield to incoming messages
static bool gs_inYield = FALSE;
bool wxYield()
bool wxApp::Yield(bool onlyIfNeeded)
{
// MT-FIXME
static bool s_inYield = FALSE;
// disable log flushing from here because a call to wxYield() shouldn't
// normally result in message boxes popping up &c
wxLog::Suspend();
#ifdef __WXDEBUG__
if (gs_inYield)
wxFAIL_MSG( wxT("wxYield called recursively" ) );
#endif
if ( s_inYield )
{
if ( !onlyIfNeeded )
{
wxFAIL_MSG( wxT("wxYield called recursively" ) );
}
gs_inYield = TRUE;
return FALSE;
}
s_inYield = TRUE;
// we don't want to process WM_QUIT from here - it should be processed in
// the main event loop in order to stop it
@@ -1464,27 +1470,17 @@ bool wxYield()
break;
}
// If they are pending events, we must process them.
if (wxTheApp)
wxTheApp->ProcessPendingEvents();
// if there are pending events, we must process them.
ProcessPendingEvents();
// let the logs be flashed again
wxLog::Resume();
gs_inYield = FALSE;
s_inYield = FALSE;
return TRUE;
}
// Yield to incoming messages; but fail silently if recursion is detected.
bool wxYieldIfNeeded()
{
if (gs_inYield)
return FALSE;
return wxYield();
}
bool wxHandleFatalExceptions(bool doit)
{
#if wxUSE_ON_FATAL_EXCEPTION
@@ -1493,9 +1489,9 @@ bool wxHandleFatalExceptions(bool doit)
return TRUE;
#else
wxFAIL_MSG(_T("set wxUSE_ON_FATAL_EXCEPTION to 1 to sue this function"));
(void)doit;
wxFAIL_MSG(_T("set wxUSE_ON_FATAL_EXCEPTION to 1 to use this function"));
(void)doit;
return FALSE;
#endif
}