add: Container Widget
This commit is contained in:
34
frame/src/widgets/ContainerWidget.cpp
Normal file
34
frame/src/widgets/ContainerWidget.cpp
Normal 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
|
||||
Reference in New Issue
Block a user