Always call DoEnable() from NotifyWindowOnEnableChange()
Simplify the code by replacing 2 conditionally-compiled DoEnable() calls with a single unconditional one. This doesn't change the behaviour of Enable(), as it always called DoEnable() on the window itself and only did it for its children when wxHAS_NATIVE_ENABLED_MANAGEMENT was not defined before and continues to do the same thing now, but it should fix a small bug in Reparent() as it didn't update the actual status of the window if it changed as the result of reparenting before, even though it was supposed to.
This commit is contained in:
@@ -1183,13 +1183,9 @@ bool wxWindowBase::IsEnabled() const
|
||||
|
||||
void wxWindowBase::NotifyWindowOnEnableChange(bool enabled)
|
||||
{
|
||||
// Under some platforms there is no need to update the window state
|
||||
// explicitly, it will become disabled when its parent is. On other ones we
|
||||
// do need to disable all windows recursively though.
|
||||
#ifndef wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
DoEnable(enabled);
|
||||
#endif // !defined(wxHAS_NATIVE_ENABLED_MANAGEMENT)
|
||||
|
||||
#ifndef wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
// Disabling a top level window is typically done when showing a modal
|
||||
// dialog and we don't need to disable its children in this case, they will
|
||||
// be logically disabled anyhow (i.e. their IsEnabled() will return false)
|
||||
@@ -1205,7 +1201,6 @@ void wxWindowBase::NotifyWindowOnEnableChange(bool enabled)
|
||||
// they would still show as enabled even though they wouldn't actually
|
||||
// accept any input (at least under MSW where children don't accept input
|
||||
// if any of the windows in their parent chain is enabled).
|
||||
#ifndef wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
||||
node;
|
||||
node = node->GetNext() )
|
||||
@@ -1224,12 +1219,6 @@ bool wxWindowBase::Enable(bool enable)
|
||||
|
||||
m_isEnabled = enable;
|
||||
|
||||
// If we call DoEnable() from NotifyWindowOnEnableChange(), we don't need
|
||||
// to do it from here.
|
||||
#ifdef wxHAS_NATIVE_ENABLED_MANAGEMENT
|
||||
DoEnable(enable);
|
||||
#endif // !defined(wxHAS_NATIVE_ENABLED_MANAGEMENT)
|
||||
|
||||
NotifyWindowOnEnableChange(enable);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user