diff options
Diffstat (limited to 'src/gui/StaticPage.cpp')
-rw-r--r-- | src/gui/StaticPage.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/StaticPage.cpp b/src/gui/StaticPage.cpp index 73adfa0..a89fc42 100644 --- a/src/gui/StaticPage.cpp +++ b/src/gui/StaticPage.cpp @@ -19,14 +19,13 @@ namespace gsr { } // Process widgets by visibility (backwards) - for(auto it = widgets.rbegin(), end = widgets.rend(); it != end; ++it) { - if(it->get() != selected_widget) { - if(!(*it)->on_event(event, window, offset)) + return widgets.for_each_reverse([selected_widget, &window, &event, offset](std::unique_ptr<Widget> &widget) { + if(widget.get() != selected_widget) { + if(!widget->on_event(event, window, offset)) return false; } - } - - return true; + return true; + }); } void StaticPage::draw(mgl::Window &window, mgl::vec2f offset) { @@ -46,9 +45,10 @@ namespace gsr { }; mgl_window_set_scissor(window.internal_window(), &new_scissor); - for(auto &widget : widgets) { + for(size_t i = 0; i < widgets.size(); ++i) { + auto &widget = widgets[i]; if(widget.get() != selected_widget) - widget->draw(window, offset); + widget->draw(window, position); } if(selected_widget) |