#include #include #include namespace psemek::ui { label::label(std::string text) : text_(std::move(text)) {} void label::set_text(std::string text) { text_ = std::move(text); on_state_changed(); } void label::set_halign(halignment value) { halign_ = value; on_state_changed(); } void label::set_valign(valignment value) { valign_ = value; on_state_changed(); } void label::set_wrap(bool value) { wrap_ = value; on_state_changed(); } void label::set_skip_spaces(bool value) { skip_spaces_ = value; on_state_changed(); } void label::set_overflow(overflow_mode value) { overflow_ = value; on_state_changed(); } void label::reshape(geom::box const & bbox) { shape_.box = bbox; cached_state_.reset(); } geom::box label::size_constraints() const { static float const inf = std::numeric_limits::infinity(); if (!cached_state_inf_) cached_state_inf_ = cached_state_for({{{0.f, inf}, {0.f, inf}}}); return {{{cached_state_inf_->size[0], inf}, {cached_state_inf_->size[1], inf}}}; } std::shared_ptr