add: Container Widget

This commit is contained in:
Simon Hardt
2022-03-06 22:03:12 +01:00
parent 33f79d9f92
commit 4c70f3440d
11 changed files with 288 additions and 13 deletions

View File

@@ -0,0 +1,34 @@
#include "ContainerWidget.hpp"
namespace frame::widgets
{
ContainerWidget::ContainerWidget(size_t slots)
{
widgets.resize(slots);
maxSlots = slots;
}
Widget::shared_ptr ContainerWidget::getSlot(size_t slot) const
{
if(slot >= maxSlots)
return nullptr;
return widgets[slot];
}
void ContainerWidget::setSlot(size_t slot, Widget::shared_ptr ptr)
{
widgets[slot] = ptr;
}
void ContainerWidget::UpdateWidgets()
{
for(auto& el : widgets)
{
if(el)
{
el->Update();
}
}
}
} // namespace frame::widgets