#include #include namespace psemek::ui::impl { storage_base::storage_base() : child_size_constraints_(size_constraints::max()) , size_constraints_(react::join(child_size_constraints_)) {} void storage_base::reshape(geom::box const & new_shape) { single_container::reshape(new_shape); if (auto child = this->child()) child->reshape(new_shape); } react::value storage_base::size_constraints() const { if (auto child = this->child()) return child->size_constraints(); return impl::size_constraints::max(); } void storage_base::set_child(std::unique_ptr child) { if (child) child_size_constraints_.set(child->size_constraints()); else child_size_constraints_.set(size_constraints::max()); single_container::set_child(std::move(child)); } std::unique_ptr storage_base::release_child() { child_size_constraints_.set(size_constraints::max()); return single_container::release_child(); } void storage_base::update(storage const & value) { util::hash_map> new_values; for (auto const & p : value.values) { auto & v = (new_values[p.first] = p.second); if (auto it = values_.find(p.first); it != values_.end()) v.set(*(it->second)); } values_ = std::move(new_values); } }