X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d30ef769524e1e8bc720ff1713b8d928be0a335e..0cd159592e4d9c979aa5a626627cdd9158fcc34f:/src/common/appcmn.cpp?ds=sidebyside diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 41f3958d47..f70be7b5ad 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/common/appcmn.cpp -// Purpose: wxAppConsole and wxAppBase methods common to all platforms +// Purpose: wxAppBase methods common to all platforms // Author: Vadim Zeitlin // Modified by: // Created: 18.10.99 @@ -71,13 +71,16 @@ WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete; wxAppBase::wxAppBase() { - m_topWindow = (wxWindow *)NULL; + m_topWindow = NULL; m_useBestVisual = false; m_forceTrueColour = false; m_isActive = true; + m_isInsideYield = false; + m_eventsToProcessInsideYield = wxEVT_CATEGORY_ALL; + // 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. @@ -323,6 +326,26 @@ void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus)) (void)ProcessEvent(event); } +bool wxAppBase::IsEventAllowedInsideYield(wxEventCategory cat) const +{ + return (m_eventsToProcessInsideYield & cat) != 0; +} + +bool wxAppBase::SafeYield(wxWindow *win, bool onlyIfNeeded) +{ + wxWindowDisabler wd(win); + + return Yield(onlyIfNeeded); +} + +bool wxAppBase::SafeYieldFor(wxWindow *win, long eventsToProcess) +{ + wxWindowDisabler wd(win); + + return YieldFor(eventsToProcess); +} + + // ---------------------------------------------------------------------------- // idle handling // ---------------------------------------------------------------------------- @@ -351,11 +374,11 @@ void wxAppBase::DeletePendingObjects() // Returns true if more time is needed. bool wxAppBase::ProcessIdle() { - // process pending wx events before sending idle events - ProcessPendingEvents(); - + // call the base class version first, it will process the pending events + // (which should be done before the idle events generation) and send the + // idle event to wxTheApp itself + bool needMore = wxAppConsoleBase::ProcessIdle(); wxIdleEvent event; - bool needMore = false; wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); while (node) { @@ -365,9 +388,6 @@ bool wxAppBase::ProcessIdle() node = node->GetNext(); } - if (wxAppConsole::ProcessIdle()) - needMore = true; - // 'Garbage' collection of windows deleted with Close(). DeletePendingObjects();