mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-04-18 07:55:50 +09:00
Change global widget container to page
This commit is contained in:
22
src/gui/Page.cpp
Normal file
22
src/gui/Page.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#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) {
|
||||
widget->draw(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user