diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-01 22:19:59 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-01 22:22:45 +0200 |
commit | 10a5669330ba978c37d984a312ba1de7a2542503 (patch) | |
tree | 0ff8cc9660841ce3979ad87da954fb7e14de7d16 /src/gui/Page.cpp | |
parent | 67216467d4dc43134a07f7f843a80a1adf688acd (diff) |
Draw and event position relative to parent (for pages)
Diffstat (limited to 'src/gui/Page.cpp')
-rw-r--r-- | src/gui/Page.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/gui/Page.cpp b/src/gui/Page.cpp index 813c2bd..19e3f2c 100644 --- a/src/gui/Page.cpp +++ b/src/gui/Page.cpp @@ -1,30 +1,7 @@ #include "../../include/gui/Page.hpp" -#include "../../include/gui/Widget.hpp" namespace gsr { void Page::add_widget(std::unique_ptr<Widget> widget) { widgets.push_back(std::move(widget)); } - - void Page::on_event(mgl::Event &event, mgl::Window &window) { - // Process widgets by visibility (backwards) - for(auto it = widgets.rbegin(), end = widgets.rend(); it != end; ++it) { - if(!(*it)->on_event(event, window)) - return; - } - } - - 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); - } - } }
\ No newline at end of file |