From ead7ce1013868743dc6482d11c52f5180fffcabd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karsten=20Ball=C3=BCder?= Date: Mon, 22 Mar 1999 10:22:26 +0000 Subject: [PATCH] Added wxSafeYield(wxWindow *win=NULL). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/utils.h | 3 +++ src/common/utilscmn.cpp | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/wx/utils.h b/include/wx/utils.h index 222e822c5b..c18128a791 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -171,6 +171,9 @@ WXDLLEXPORT int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, con // Yield to other apps/messages WXDLLEXPORT bool wxYield(); +// Yield to other apps/messages and disable user input +WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL); + // Format a message on the standard error (UNIX) or the debugging // stream (Windows) WXDLLEXPORT void wxDebugMsg(const char *fmt ...) ; diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index f15e7f0bbd..be9df90d2f 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -748,6 +748,27 @@ whereami(name) #endif + +// Yield to other apps/messages and disable user input +bool wxSafeYield(wxWindow *win) +{ + wxNode *node; + for ( node = wxTopLevelWindows.GetFirst(); + node; + node = node->GetNext() ) + ((wxWindow*)node->GetData())->Enable(FALSE); + + // always enable ourselves + if(win) win->Enable(true); + bool rc = wxYield(); + + for ( node = wxTopLevelWindows.GetFirst(); + node; + node = node->GetNext() ) + ((wxWindow*)node->GetData())->Enable(TRUE); + return rc; +} + /* * N.B. these convenience functions must be separate from msgdlgg.cpp, textdlgg.cpp * since otherwise the generic code may be pulled in unnecessarily. -- 2.47.2