Replace wxList with wxVector in wxWindowDisabler implementation

No real changes, just get rid of an unnecessary instance of
wxWindowList: this one can be safely replaced with a vector because it's
a private member and so changing its type doesn't affect compatibility.
This commit is contained in:
Vadim Zeitlin
2020-11-16 04:05:06 +01:00
parent 516066939a
commit be570015bf
2 changed files with 4 additions and 13 deletions

View File

@@ -25,6 +25,7 @@
#if wxUSE_GUI
#include "wx/gdicmn.h"
#include "wx/mousestate.h"
#include "wx/vector.h"
#endif
class WXDLLIMPEXP_FWD_BASE wxArrayString;
@@ -51,7 +52,6 @@ class WXDLLIMPEXP_FWD_BASE wxArrayInt;
class WXDLLIMPEXP_FWD_BASE wxProcess;
class WXDLLIMPEXP_FWD_CORE wxFrame;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class wxWindowList;
class WXDLLIMPEXP_FWD_CORE wxEventLoop;
// ----------------------------------------------------------------------------
@@ -733,7 +733,7 @@ private:
#if defined(__WXOSX__) && wxOSX_USE_COCOA
wxEventLoop* m_modalEventLoop;
#endif
wxWindowList *m_winDisabled;
wxVector<wxWindow*> m_winDisabled;
bool m_disabled;
wxDECLARE_NO_COPY_CLASS(wxWindowDisabler);

View File

@@ -1530,8 +1530,6 @@ void wxWindowDisabler::DoDisable(wxWindow *winToSkip)
{
// remember the top level windows which were already disabled, so that we
// don't reenable them later
m_winDisabled = NULL;
wxWindowList::compatibility_iterator node;
for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )
{
@@ -1546,12 +1544,7 @@ void wxWindowDisabler::DoDisable(wxWindow *winToSkip)
}
else
{
if ( !m_winDisabled )
{
m_winDisabled = new wxWindowList;
}
m_winDisabled->Append(winTop);
m_winDisabled.push_back(winTop);
}
}
}
@@ -1565,14 +1558,12 @@ wxWindowDisabler::~wxWindowDisabler()
for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )
{
wxWindow *winTop = node->GetData();
if ( !m_winDisabled || !m_winDisabled->Find(winTop) )
if ( !wxVectorContains(m_winDisabled, winTop) )
{
winTop->Enable();
}
//else: had been already disabled, don't reenable
}
delete m_winDisabled;
}
#endif