23#include "guillaume/entities/tooltip.hpp"
29#include "guillaume/entities/content_helpers.hpp"
30#include "guillaume/entities/builder_base.hpp"
32#include "guillaume/systems/tooltip.hpp"
33#include "guillaume/theme.hpp"
47 _variant, _text, _title);
54 _variant = Variant::Plain;
59 _config.mainAxisAlignment =
61 _config.crossAxisAlignment =
63 _config.padding = 8.0f;
64 _config.spacing = 2.0f;
94 _config.hasFixedWidth =
true;
95 _config.fixedWidth = width;
99 std::shared_ptr<Tooltip>
101 Variant variant,
const std::string &text,
102 const std::string &title)
107 .registerEntity(parent);
112 const std::string &text,
const std::string &title)
130 ? anchor->getIdentifier()
229 void Tooltip::build(
void)
235 void Tooltip::buildContent(
void)
238 if (weak_from_this().expired()) {
248 if (tooltip.getVariant() == Variant::Rich
251 registry, *
this, shared_from_this(), tooltip.getTitle(),
253 if (title !=
nullptr) {
254 tooltip.setTitleEntity(title->getIdentifier());
260 registry, *
this, shared_from_this(), tooltip.getText(),
262 if (text !=
nullptr) {
263 tooltip.setTextEntity(text->getIdentifier());
269 std::vector<std::shared_ptr<ecs::Entity>> children;
270 if (tooltip.getVariant() == Variant::Rich) {
272 children.push_back(std::move(title));
276 children.push_back(std::move(text));
@ Start
At the top (row) or left (column).
@ Center
Packed in the middle.
@ Vertical
Column: children placed top to bottom.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
ComponentType & getComponent(const Entity::Identifier &entityIdentifier)
Get a component of an entity, to read or modify it.
ComponentRegistry & getComponentRegistry(void)
Get the registry in which the builder creates components.
Owns entities and gives the systems the list of entities to visit.
std::shared_ptr< EntityType > getEntity(Entity::Identifier identifier)
Find an entity owned directly by this registry, by identifier.
Entity::Identifier getIdentifier(void) const noexcept
Get the identifier of the entity.
static constexpr Identifier InvalidIdentifier
"No entity": never the identifier of a real entity
ComponentRegistry & getComponentRegistry(void)
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
SurfaceBase(ecs::ComponentRegistry ®istry, const SurfaceConfig &config)
SurfaceBase & setChildren(const Children &children)
Makes the color helpers callable from guillaume::entities without qualification.
State. Every class here is plain data attached to an entity.
Widgets: the classes used to create entities with the right components and children.
utility::graphic::Color32Bit transparentColor(void)
The color written to hide a fill or an outline without removing its component.
std::shared_ptr< Text > buildText(ecs::ComponentRegistry ®istry, ecs::EntityRegistry &entityRegistry, std::shared_ptr< ecs::Entity > parent, const std::string &content, float fontSize, const utility::graphic::Color32Bit &color)
Create a Text of a given font size as a child of a widget, or nothing when there is no content.
@ TitleSmall
14 / 20, medium weight.
@ BodySmall
12 / 16, regular.
Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its...