mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-17 13:20:45 +00:00
Remove UI_FOREACH_WIDGET_*() macros
This commit is contained in:
parent
34ec123ecc
commit
78353199bb
@ -670,7 +670,10 @@ void Manager::handleWindowZOrder()
|
||||
win_manager->insertChild(0, window);
|
||||
else {
|
||||
int pos = (int)win_manager->children().size();
|
||||
UI_FOREACH_WIDGET_BACKWARD(win_manager->children(), it) {
|
||||
|
||||
for (auto it=win_manager->children().rbegin(),
|
||||
end=win_manager->children().rend();
|
||||
it != end; ++it) {
|
||||
if (static_cast<Window*>(*it)->isOnTop())
|
||||
break;
|
||||
|
||||
|
@ -345,18 +345,25 @@ void Menu::onSizeHint(SizeHintEvent& ev)
|
||||
Size size(0, 0);
|
||||
Size reqSize;
|
||||
|
||||
UI_FOREACH_WIDGET_WITH_END(children(), it, end) {
|
||||
for (auto it=children().begin(),
|
||||
end=children().end();
|
||||
it!=end; ) {
|
||||
auto next = it;
|
||||
++next;
|
||||
|
||||
reqSize = (*it)->sizeHint();
|
||||
|
||||
if (parent() &&
|
||||
parent()->type() == kMenuBarWidget) {
|
||||
size.w += reqSize.w + ((it+1 != end) ? childSpacing(): 0);
|
||||
size.w += reqSize.w + ((next != end) ? childSpacing(): 0);
|
||||
size.h = std::max(size.h, reqSize.h);
|
||||
}
|
||||
else {
|
||||
size.w = std::max(size.w, reqSize.w);
|
||||
size.h += reqSize.h + ((it+1 != end) ? childSpacing(): 0);
|
||||
size.h += reqSize.h + ((next != end) ? childSpacing(): 0);
|
||||
}
|
||||
|
||||
it = next;
|
||||
}
|
||||
|
||||
size.w += border().width();
|
||||
|
@ -61,10 +61,15 @@ bool Splitter::onProcessMessage(Message* msg)
|
||||
|
||||
bar = click_bar = 0;
|
||||
|
||||
UI_FOREACH_WIDGET_WITH_END(children(), it, end) {
|
||||
if (it+1 != end) {
|
||||
for (auto it=children().begin(),
|
||||
end=children().end();
|
||||
it != end; ) {
|
||||
auto next = it;
|
||||
++next;
|
||||
|
||||
if (next != end) {
|
||||
c1 = *it;
|
||||
c2 = *(it+1);
|
||||
c2 = *next;
|
||||
|
||||
++bar;
|
||||
|
||||
@ -85,6 +90,8 @@ bool Splitter::onProcessMessage(Message* msg)
|
||||
(mousePos.y >= y1) && (mousePos.y < y2))
|
||||
click_bar = bar;
|
||||
}
|
||||
|
||||
it = next;
|
||||
}
|
||||
|
||||
if (!click_bar)
|
||||
@ -142,8 +149,13 @@ bool Splitter::onProcessMessage(Message* msg)
|
||||
int x1, y1, x2, y2;
|
||||
bool change_cursor = false;
|
||||
|
||||
UI_FOREACH_WIDGET_WITH_END(children(), it, end) {
|
||||
if (it+1 != end) {
|
||||
for (auto it=children().begin(),
|
||||
end=children().end();
|
||||
it != end; ) {
|
||||
auto next = it;
|
||||
++next;
|
||||
|
||||
if (next != end) {
|
||||
c1 = *it;
|
||||
c2 = *(it+1);
|
||||
|
||||
@ -166,6 +178,8 @@ bool Splitter::onProcessMessage(Message* msg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
it = next;
|
||||
}
|
||||
|
||||
if (change_cursor) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -10,20 +11,6 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define UI_FOREACH_WIDGET_BACKWARD(list_name, iterator_name) \
|
||||
for (WidgetsList::const_reverse_iterator \
|
||||
iterator_name = (list_name).rbegin(), \
|
||||
__end=(list_name).rend(); \
|
||||
iterator_name != __end; \
|
||||
++iterator_name)
|
||||
|
||||
#define UI_FOREACH_WIDGET_WITH_END(list_name, iterator_name, end_name) \
|
||||
for (WidgetsList::const_iterator \
|
||||
iterator_name = (list_name).begin(), \
|
||||
end_name = (list_name).end(); \
|
||||
iterator_name != end_name; \
|
||||
++iterator_name)
|
||||
|
||||
#define UI_FIRST_WIDGET(list_name) \
|
||||
((list_name).empty() ? NULL: (list_name).front())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user