Allow to leave another window enabled in wxWindowDisabler

Allow specifying another window to "skip", i.e. not to disable, in
wxWindowDisabler.

This is not used yet, but will be in the upcoming commit.
This commit is contained in:
Vadim Zeitlin
2022-04-07 23:38:16 +01:00
parent bc81682e7f
commit 717e851225
3 changed files with 10 additions and 4 deletions

View File

@@ -732,8 +732,8 @@ public:
// it doesn't do anything
explicit wxWindowDisabler(bool disable = true);
// ctor disables all windows except winToSkip
explicit wxWindowDisabler(wxWindow *winToSkip);
// ctor disables all windows except the given one(s)
explicit wxWindowDisabler(wxWindow *winToSkip, wxWindow *winToSkip2 = NULL);
// dtor enables back all windows disabled by the ctor
~wxWindowDisabler();

View File

@@ -97,8 +97,12 @@ public:
from happening you may want to use wxFRAME_TOOL_WINDOW, if applicable,
or wxFRAME_NO_TASKBAR style when creating the window that will remain
enabled.
The argument @a winToSkip2 may be used to specify another window to
leave enabled, if it is non-null. This parameter is only available
since wxWidgets 3.1.7.
*/
explicit wxWindowDisabler(wxWindow* winToSkip);
explicit wxWindowDisabler(wxWindow* winToSkip, wxWindow* winToSkip2 = NULL);
/**
Reenables the windows disabled by the constructor.

View File

@@ -1526,12 +1526,14 @@ wxWindowDisabler::wxWindowDisabler(bool disable)
}
}
wxWindowDisabler::wxWindowDisabler(wxWindow *winToSkip)
wxWindowDisabler::wxWindowDisabler(wxWindow *winToSkip, wxWindow *winToSkip2)
{
m_disabled = true;
if ( winToSkip )
m_windowsToSkip.push_back(winToSkip);
if ( winToSkip2 )
m_windowsToSkip.push_back(winToSkip2);
DoDisable();