X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b3dfbbc91088ab32c3aae4294a3c726fadfc5ccd..3bb63e5c806e7ef549673822dc6e4d40aa9dbec9:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 6898c219b9..9424db3196 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -167,7 +167,7 @@ void wxAppBase::Exit() wxAppTraits *wxAppBase::CreateTraits() { - return wxAppTraits::CreateGUI(); + return new wxGUIAppTraits; } // ---------------------------------------------------------------------------- @@ -205,6 +205,72 @@ void wxAppBase::DeletePendingObjects() } } +// Returns TRUE if more time is needed. +bool wxAppBase::ProcessIdle() +{ + wxWindowList::Node* node = wxTopLevelWindows.GetFirst(); + node = wxTopLevelWindows.GetFirst(); + while (node) + { + wxWindow* win = node->GetData(); + win->ProcessInternalIdle(); + node = node->GetNext(); + } + + wxIdleEvent event; + event.SetEventObject(this); + bool processed = ProcessEvent(event); + + wxUpdateUIEvent::ResetUpdateTime(); + + return processed && event.MoreRequested(); +} + +// Send idle event to all top-level windows +bool wxAppBase::SendIdleEvents() +{ + bool needMore = FALSE; + + wxWindowList::Node* node = wxTopLevelWindows.GetFirst(); + while (node) + { + wxWindow* win = node->GetData(); + if (SendIdleEvents(win)) + needMore = TRUE; + node = node->GetNext(); + } + + return needMore; +} + +// Send idle event to window and all subwindows +bool wxAppBase::SendIdleEvents(wxWindow* win) +{ + bool needMore = FALSE; + + if (wxIdleEvent::CanSend(win)) + { + wxIdleEvent event; + event.SetEventObject(win); + win->GetEventHandler()->ProcessEvent(event); + + needMore = event.MoreRequested(); + } + + wxWindowList::Node *node = win->GetChildren().GetFirst(); + while ( node ) + { + wxWindow *win = node->GetData(); + if (SendIdleEvents(win)) + needMore = TRUE; + + node = node->GetNext(); + } + + return needMore; +} + + // ---------------------------------------------------------------------------- // wxGUIAppTraitsBase // ---------------------------------------------------------------------------- @@ -305,12 +371,3 @@ void wxGUIAppTraitsBase::RemoveFromPendingDelete(wxObject *object) wxPendingDelete.DeleteObject(object); } -// ---------------------------------------------------------------------------- -// wxAppTraits -// ---------------------------------------------------------------------------- - -wxAppTraits *wxAppTraitsBase::CreateGUI() -{ - return new wxGUIAppTraits; -} -