37 lines
693 B
C++
37 lines
693 B
C++
#include <psemek/ui/frame.hpp>
|
|
|
|
namespace psemek::ui
|
|
{
|
|
|
|
std::shared_ptr<element> frame::set_child(std::shared_ptr<element> 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<geom::vector<float, 2>> const & size)
|
|
{
|
|
min_size_ = size;
|
|
post_reshape();
|
|
}
|
|
|
|
void frame::set_max_size(std::optional<geom::vector<float, 2>> const & size)
|
|
{
|
|
max_size_ = size;
|
|
post_reshape();
|
|
}
|
|
|
|
void frame::set_fixed_size(geom::vector<float, 2> const & size)
|
|
{
|
|
min_size_ = size;
|
|
max_size_ = size;
|
|
post_reshape();
|
|
}
|
|
|
|
}
|