From 95dee6514a24c2958b9571eb1c1a44ad3aad7a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ball=C3=BCder?= Date: Thu, 15 Apr 1999 14:18:12 +0000 Subject: [PATCH] Added wxEnableTopLevelWindows(bool enable) for use by wxSafeYield(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2177 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/function.tex | 12 ++++++++++++ include/wx/utils.h | 3 +++ src/common/utilscmn.cpp | 31 +++++++++++++------------------ 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 39a1950da3..88b47f7324 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -1390,6 +1390,18 @@ Returns the result of the call to \helpref{::wxYield}{wxyield}. +\membersection{::wxEnableTopLevelWindows}{wxenabletoplevelwindows} + +\func{void}{wxEnableTopLevelWindow}{\param{bool}{ enable = TRUE}} + +This function enables or disables all top level windows. It is used by +\helpref{::wxSafeYield}{wxsafeyield}. + +\wxheading{Include files} + + + + \membersection{::wxSetDisplayName}\label{wxsetdisplayname} \func{void}{wxSetDisplayName}{\param{const wxString\& }{displayName}} diff --git a/include/wx/utils.h b/include/wx/utils.h index a6d2991cc6..2f1bcc7768 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -239,6 +239,9 @@ WXDLLEXPORT bool wxYield(); // Yield to other apps/messages and disable user input WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL); +// Enable or disable input to all top level windows +WXDLLEXPORT void wxEnableTopLevelWindows(bool enable = TRUE); + // Check whether this window wants to process messages, e.g. Stop button // in long calculations. WXDLLEXPORT bool wxCheckForInterrupt(wxWindow *wnd); diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index f6cec3461c..813ca852f5 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -733,28 +733,23 @@ whereami(name) } #endif - +void wxEnableTopLevelWindows(bool enable) +{ + wxWindowList::Node *node; + for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() ) + node->GetData()->Enable(enable); +} // Yield to other apps/messages and disable user input bool wxSafeYield(wxWindow *win) { - wxWindowList::Node *node; - for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() ) - { - node->GetData()->Enable(FALSE); - } - - // always enable ourselves - if ( win ) - win->Enable(TRUE); - bool rc = wxYield(); - - for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() ) - { - node->GetData()->Enable(TRUE); - } - - return rc; + wxEnableTopLevelWindow(FALSE); + // always enable ourselves + if ( win ) + win->Enable(TRUE); + bool rc = wxYield(); + wxEnableToplevelWindows(TRUE); + return rc; } /*