-
- //
- // The logic below doesn't apply to the top level windows -- otherwise
- // showing a modal dialog would result in total greying out (and ungreying
- // out later) of everything which would be really ugly
- //
- if (IsTopLevel())
- return true;
-
- wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
-
- while (node)
- {
- wxWindow* pChild = node->GetData();
-
- if (bEnable)
- {
- //
- // Enable the child back unless it had been disabled before us
- //
- if (!m_pChildrenDisabled || !m_pChildrenDisabled->Find(pChild))
- pChild->Enable();
- }
- else // we're being disabled
- {
- if (pChild->IsEnabled())
- {
- //
- // Disable it as children shouldn't stay enabled while the
- // parent is not
- //
- pChild->Disable();
- }
- else // child already disabled, remember it
- {
- //
- // Have we created the list of disabled children already?
- //
- if (!m_pChildrenDisabled)
- m_pChildrenDisabled = new wxWindowList;
- m_pChildrenDisabled->Append(pChild);
- }
- }
- node = node->GetNext();
- }
- if (bEnable && m_pChildrenDisabled)
- {
- //
- // We don't need this list any more, don't keep unused memory
- //
- delete m_pChildrenDisabled;
- m_pChildrenDisabled = NULL;
- }
- return true;
-} // end of wxWindowOS2::Enable