Refactor wxWindowDisabler to allow skipping more than one window

This is not implemented yet, but this commit changes DoDisable() to
disable all windows except those in the list of the windows not to be
disabled instead of explicitly checking for just a single window to
skip.

Rename m_winDisabled to m_windowsToSkip to better describe its purpose
and also because it's a vector, and so should use plural form in its
name.

Finally note that AfterDisable() is called with NULL argument from the
ctor not taking the window to skip for compatibility with the old code,
but it's not clear if it's really the right thing to do and perhaps this
shouldn't be done.

No real changes yet.
This commit is contained in:
Vadim Zeitlin
2022-04-07 23:32:05 +01:00
parent 53844108dd
commit bc81682e7f
2 changed files with 23 additions and 13 deletions

View File

@@ -739,8 +739,8 @@ public:
~wxWindowDisabler();
private:
// disable all windows except the given one (used by both ctors)
void DoDisable(wxWindow *winToSkip = NULL);
// disable all windows not in m_windowsToSkip
void DoDisable();
#if defined(__WXOSX__) && wxOSX_USE_COCOA
void AfterDisable(wxWindow* winToSkip);
@@ -748,7 +748,7 @@ private:
wxEventLoop* m_modalEventLoop = NULL;
#endif
wxVector<wxWindow*> m_winDisabled;
wxVector<wxWindow*> m_windowsToSkip;
bool m_disabled;
wxDECLARE_NO_COPY_CLASS(wxWindowDisabler);