From 67216467d4dc43134a07f7f843a80a1adf688acd Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 1 Aug 2024 20:55:16 +0200 Subject: Move to settings page on settings button pressed --- src/gui/ComboBox.cpp | 1 + src/gui/Page.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'src/gui') diff --git a/src/gui/ComboBox.cpp b/src/gui/ComboBox.cpp index 2766797..dd683e1 100644 --- a/src/gui/ComboBox.cpp +++ b/src/gui/ComboBox.cpp @@ -40,6 +40,7 @@ namespace gsr { if(mgl::FloatRect(position, item_size).contains(mouse_pos)) { show_dropdown = !show_dropdown; + move_to_top = true; } else { show_dropdown = false; } diff --git a/src/gui/Page.cpp b/src/gui/Page.cpp index 817c7fd..813c2bd 100644 --- a/src/gui/Page.cpp +++ b/src/gui/Page.cpp @@ -15,6 +15,14 @@ namespace gsr { } void Page::draw(mgl::Window &window) { + for(auto &widget : widgets) { + if(widget->move_to_top) { + widget->move_to_top = false; + std::swap(widget, widgets.back()); + } + widget->draw(window); + } + for(auto &widget : widgets) { widget->draw(window); } -- cgit v1.2.3