25#include "guillaume/entities/divider.hpp"
26#include "guillaume/entities/builder_base.hpp"
27#include "guillaume/systems/divider.hpp"
29#include "guillaume/theme.hpp"
44 _length, _thickness, _inset, _variant);
50 _pose = utility::graphic::PoseF();
55 _variant = Variant::FullWidth;
80 _thickness = thickness;
96 std::shared_ptr<Divider>
100 return withLength(length).withVariant(variant).registerEntity(parent);
104 const utility::graphic::PoseF &pose,
105 const utility::graphic::Color32Bit &color,
float length,
106 float thickness,
float inset,
Variant variant)
117 .setAppliedPose(pose)
120 .setThickness(thickness)
122 .setVariant(variant);
143 void Divider::apply(
void)
195 return config().getVariant();
State of a divider: a thin horizontal line separating content.
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.
EntityFiller(ComponentRegistry &componentRegistry)
ComponentRegistry & getComponentRegistry(void)
Owns entities and gives the systems the list of entities to visit.
Entity::Identifier getIdentifier(void) const noexcept
Get the identifier of the entity.
Configures Divider widgets and registers them in the scene's entity registry.
Builder & withLength(float length)
Set the total length.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Construct a builder holding the defaults of reset().
Builder & withInset(float inset)
Set how much an inset end is shortened.
Builder & withVariant(Variant variant)
Choose which ends of the line are inset.
std::shared_ptr< Divider > buildEntity(void) override
Build a divider from the current configuration, without registering it or giving it a parent.
std::shared_ptr< Divider > makeDivider(std::shared_ptr< Entity > parent, float length, Variant variant)
Build a divider, register it under parent and reset the builder.
Builder & withPose(const utility::graphic::PoseF &pose)
Set where the line starts.
Builder & withColor(const utility::graphic::Color32Bit &color)
Set the stroke color.
void reset(void) override
Restore the defaults: default pose, the OutlineVariant color of the active theme, length 100 dp,...
Builder & withThickness(float thickness)
Set the stroke thickness.
static std::shared_ptr< Divider > create(Arguments &&...arguments)
Build a divider without registering it in an entity registry.
static constexpr float BoldThickness
Stroke thickness of a bold divider, in dp (Paper bold).
Divider & setLength(float length)
Set the total length. Resizes the line at once.
~Divider(void) override
Destructor.
Divider & setVariant(Variant variant)
Choose which ends of the line are inset. Moves and resizes the line at once.
components::Divider::Variant Variant
Which ends of the line are shortened by the inset: FullWidth (none), Inset (leading end) or Middle (b...
bool isBold(void) const
Check whether the divider uses the bold stroke.
static constexpr float HairlineThickness
Default stroke thickness, in dp: a hairline (Paper StyleSheet.hairlineWidth on a 2x display).
Variant getVariant(void) const
Tell which ends of the line are inset.
Divider & setThickness(float thickness)
Set the stroke thickness. Restyles at once.
Divider & setBold(bool bold)
Switch between the hairline and the bold stroke (Paper bold). Restyles at once.
Divider & setColor(const utility::graphic::Color32Bit &color)
Set the stroke color. Restyles at once.
Divider & setInset(float inset)
Set how much an inset end is shortened. Moves and resizes the line at once.
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
static void apply(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Write the geometry of one divider from its configuration.
State. Every class here is plain data attached to an entity.
The entity-component-system core, independent of any widget.
Widgets: the classes used to create entities with the right components and children.
utility::graphic::Color32Bit getActiveColor(SchemeColorRole role)
Get the color the active scheme gives to a role.