From b9c26464b6606406b38a951f1abca4ae1aa6b025 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Sat, 23 Jun 2018 16:29:06 +1100 Subject: [PATCH] Select Orb Colors: used a widget iterator instead of a walker The documentation indicates you're not really meant to use the walker directly. They're part of the implementation of the iterators. They could be used directly, as shown here, but this is shorter. (cherry-picked from commit aca7d4e6df4648ff45f48b6acb9e643de8c05103) --- src/gui/dialogs/select_orb_colors.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/gui/dialogs/select_orb_colors.cpp b/src/gui/dialogs/select_orb_colors.cpp index de6ba3430e1..9f8ee1c54f2 100644 --- a/src/gui/dialogs/select_orb_colors.cpp +++ b/src/gui/dialogs/select_orb_colors.cpp @@ -16,7 +16,7 @@ #include "gui/dialogs/select_orb_colors.hpp" #include "gui/auxiliary/find_widget.hpp" -#include "gui/auxiliary/iterator/walker.hpp" +#include "gui/auxiliary/iterator/iterator.hpp" #include "gui/core/event/dispatcher.hpp" #include "gui/widgets/button.hpp" #include "gui/widgets/grid.hpp" @@ -101,20 +101,14 @@ void select_orb_colors::setup_orb_group(const std::string& base_id, bool& shown, // group& group = groups_[base_id]; - using iteration::walker_base; - + // Grid containing each color option toggle. grid& selection = find_widget(get_window(), prefix + "selection", false); - std::unique_ptr iter(selection.create_walker()); - while(!iter->at_end(walker_base::child)) { - widget* next = iter->get(walker_base::child); - - if(toggle_button* button = dynamic_cast(next)) { + for(iteration::bottom_up_iterator iter(selection); !iter.at_end(); ++iter) { + if(toggle_button* button = dynamic_cast(iter.get())) { const std::string& id = button->id(); group.add_member(button, id.substr(prefix.size())); } - - iter->next(walker_base::child); } group.set_member_states(initial);