35 lines
703 B
C++
35 lines
703 B
C++
#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)
|
|
{
|
|
ptr->setParent(this);
|
|
widgets[slot] = ptr;
|
|
}
|
|
|
|
void ContainerWidget::UpdateWidgets()
|
|
{
|
|
for(auto& el : widgets)
|
|
{
|
|
if(el)
|
|
{
|
|
el->Update();
|
|
}
|
|
}
|
|
}
|
|
|
|
} // namespace frame::widgets
|