2#include "Container.hpp"
6Container::Container(
int layout,
int padding)
10 this->padding = padding;
13Element* Container::add(std::unique_ptr<Element> elem)
15 int newPosX = (layout == ROW_LAYOUT) ? this->
width + padding : this->x;
16 int newPosY = (layout == COL_LAYOUT) ? this->height + padding : this->y;
18 Element* rawPtr = elem.get();
19 rawPtr->setPosition(newPosX, newPosY);
20 addNode(std::move(elem));
22 this->
width = (layout == ROW_LAYOUT) ? this->
width + rawPtr->width + padding : std::max(this->width, rawPtr->width);
23 this->height = (layout == COL_LAYOUT) ? this->height + rawPtr->height + padding : std::max(this->height, rawPtr->height);
int width
width and height of this element (must be manually set, isn't usually calculated (but is in some case...