#include namespace psemek::ui { std::shared_ptr frame::set_child(std::shared_ptr c) { auto old = std::move(child_); if (old) old->set_parent(nullptr); child_ = std::move(c); if (child_) child_->set_parent(this); children_[0] = child_.get(); return old; } void frame::set_min_size(std::optional> const & size) { min_size_ = size; post_reshape(); } void frame::set_max_size(std::optional> const & size) { max_size_ = size; post_reshape(); } void frame::set_fixed_size(geom::vector const & size) { min_size_ = size; max_size_ = size; post_reshape(); } geom::box frame::size_constraints() const { geom::box r = element::size_constraints(); if (child_) r = child_->size_constraints(); if (min_size_) { r[0].min = (*min_size_)[0]; r[1].min = (*min_size_)[1]; } if (max_size_) { r[0].max = (*max_size_)[0]; r[1].max = (*max_size_)[1]; } return r; } }