mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-19 06:40:42 +00:00
Replace some UI_FOREACH_WIDGET() with range-based for loops
This commit is contained in:
parent
8f66e75cb0
commit
0b0cb56c1e
@ -557,11 +557,11 @@ void Manager::setFocus(Widget* widget)
|
|||||||
|
|
||||||
Message* msg = new Message(kFocusLeaveMessage);
|
Message* msg = new Message(kFocusLeaveMessage);
|
||||||
|
|
||||||
UI_FOREACH_WIDGET(focus_parents, it) {
|
for (Widget* parent1 : focus_parents) {
|
||||||
if (widget) {
|
if (widget) {
|
||||||
UI_FOREACH_WIDGET(widget_parents, it2) {
|
for (Widget* parent2 : widget_parents) {
|
||||||
if (*it == *it2) {
|
if (parent1 == parent2) {
|
||||||
common_parent = *it;
|
common_parent = parent1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -569,9 +569,9 @@ void Manager::setFocus(Widget* widget)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*it)->hasFocus()) {
|
if (parent1->hasFocus()) {
|
||||||
(*it)->disableFlags(HAS_FOCUS);
|
parent1->disableFlags(HAS_FOCUS);
|
||||||
msg->addRecipient(*it);
|
msg->addRecipient(parent1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,11 +638,11 @@ void Manager::setMouse(Widget* widget)
|
|||||||
|
|
||||||
Message* msg = new Message(kMouseLeaveMessage);
|
Message* msg = new Message(kMouseLeaveMessage);
|
||||||
|
|
||||||
UI_FOREACH_WIDGET(mouse_parents, it) {
|
for (Widget* parent1 : mouse_parents) {
|
||||||
if (widget) {
|
if (widget) {
|
||||||
UI_FOREACH_WIDGET(widget_parents, it2) {
|
for (Widget* parent2 : widget_parents) {
|
||||||
if (*it == *it2) {
|
if (parent1 == parent2) {
|
||||||
common_parent = *it;
|
common_parent = parent1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -650,9 +650,9 @@ void Manager::setMouse(Widget* widget)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*it)->hasMouse()) {
|
if (parent1->hasMouse()) {
|
||||||
(*it)->disableFlags(HAS_MOUSE);
|
parent1->disableFlags(HAS_MOUSE);
|
||||||
msg->addRecipient(*it);
|
msg->addRecipient(parent1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ bool TooltipManager::onProcessMessage(Message* msg)
|
|||||||
switch (msg->type()) {
|
switch (msg->type()) {
|
||||||
|
|
||||||
case kMouseEnterMessage: {
|
case kMouseEnterMessage: {
|
||||||
UI_FOREACH_WIDGET(msg->recipients(), itWidget) {
|
for (Widget* widget : msg->recipients()) {
|
||||||
Tips::iterator it = m_tips.find(*itWidget);
|
Tips::iterator it = m_tips.find(widget);
|
||||||
if (it != m_tips.end()) {
|
if (it != m_tips.end()) {
|
||||||
m_target.widget = it->first;
|
m_target.widget = it->first;
|
||||||
m_target.tipInfo = it->second;
|
m_target.tipInfo = it->second;
|
||||||
|
@ -410,14 +410,14 @@ Widget* Widget::getPreviousSibling()
|
|||||||
|
|
||||||
Widget* Widget::pick(const gfx::Point& pt)
|
Widget* Widget::pick(const gfx::Point& pt)
|
||||||
{
|
{
|
||||||
Widget* inside, *picked = NULL;
|
Widget* inside, *picked = nullptr;
|
||||||
|
|
||||||
if (!hasFlags(HIDDEN) && // Is visible
|
if (!hasFlags(HIDDEN) && // Is visible
|
||||||
getBounds().contains(pt)) { // The point is inside the bounds
|
getBounds().contains(pt)) { // The point is inside the bounds
|
||||||
picked = this;
|
picked = this;
|
||||||
|
|
||||||
UI_FOREACH_WIDGET(m_children, it) {
|
for (Widget* child : m_children) {
|
||||||
inside = (*it)->pick(pt);
|
inside = child->pick(pt);
|
||||||
if (inside) {
|
if (inside) {
|
||||||
picked = inside;
|
picked = inside;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user