Give wxSafeYield an onlyIfNeeded parameter

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18278 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-12-16 21:58:36 +00:00
parent 8325937efa
commit b829bf55a0
3 changed files with 30 additions and 26 deletions

View File

@@ -371,7 +371,8 @@ call to this function.
\membersection{::wxSafeYield}\label{wxsafeyield}
\func{bool}{wxSafeYield}{\param{wxWindow*}{ win = NULL}}
\func{bool}{wxSafeYield}{\param{wxWindow*}{ win = NULL}, \param{bool}{
onlyIfNeeded = FALSE}}
This function is similar to wxYield, except that it disables the user input to
all program windows before calling wxYield and re-enables it again

View File

@@ -370,7 +370,7 @@ WXDLLEXPORT bool wxYield();
WXDLLEXPORT bool wxYieldIfNeeded();
// Yield to other apps/messages and disable user input
WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL);
WXDLLEXPORT bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = FALSE);
// Enable or disable input to all top level windows
WXDLLEXPORT void wxEnableTopLevelWindows(bool enable = TRUE);

View File

@@ -872,10 +872,13 @@ wxWindowDisabler::~wxWindowDisabler()
// Yield to other apps/messages and disable user input to all windows except
// the given one
bool wxSafeYield(wxWindow *win)
bool wxSafeYield(wxWindow *win, bool onlyIfNeeded = FALSE)
{
wxWindowDisabler wd(win);
if (onlyIfNeeded)
bool rc = wxYieldIfNeeded();
else
bool rc = wxYield();
return rc;