20 if (!getComponent()->isAutoAdjust())
25 for (
auto child : getComponent()->getChildren())
27 if (child->containsComponent(event->getNewFocus()))
29 getComponent()->moveToFront(child);
36LayeredContainer::LayeredContainer()
38 getEventDispatcher()->attachFilter(FocusReceivedFilter::EVENT_TYPES,
new FocusReceivedFilter(
this));
41bool LayeredContainer::isAutoAdjust()
const {
return m_AutoAdjust; }
42void LayeredContainer::setAutoAdjust(
bool autoAdjust) { m_AutoAdjust = autoAdjust; }
44void LayeredContainer::moveToFront(
Component* child)
48 for (
auto it = m_Children.begin(); it != m_Children.end(); ++it)
53 m_Children.push_back(child);
59void LayeredContainer::moveToBack(
Component* child)
63 for (
auto it = m_Children.begin(); it != m_Children.end(); ++it)
68 m_Children.push_front(child);
76 return m_Children.empty() ? nullptr : m_Children.back();
81 return m_Children.empty() ? nullptr : m_Children.front();