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; } /*