28#include <utility/graphic/color.hpp>
29#include <utility/graphic/pose.hpp>
31#include "guillaume/ecs/component_registry.hpp"
32#include "guillaume/entities/builder_base.hpp"
33#include "guillaume/ecs/entity_builder.hpp"
34#include "guillaume/ecs/entity_filler.hpp"
36#include "guillaume/components/bound.hpp"
37#include "guillaume/components/color.hpp"
38#include "guillaume/components/divider.hpp"
39#include "guillaume/components/line.hpp"
40#include "guillaume/components/transform.hpp"
86 components::Color, components::Line,
116 utility::graphic::PoseF
118 utility::graphic::Color32Bit _color {};
119 float _length { 100.0f };
122 float _inset { 16.0f };
123 Variant _variant { Variant::FullWidth };
142 std::shared_ptr<Divider>
buildEntity(
void)
override;
150 void reset(
void)
override;
211 std::shared_ptr<Divider>
makeDivider(std::shared_ptr<Entity> parent,
212 float length,
Variant variant);
227 template<
typename... Arguments>
228 static std::shared_ptr<Divider>
create(Arguments &&...arguments)
230 std::shared_ptr<Divider> entity(
231 new Divider(std::forward<Arguments>(arguments)...));
334 const utility::graphic::PoseF &pose,
335 const utility::graphic::Color32Bit &color,
float length,
336 float thickness,
float inset,
Variant variant);
State of a divider: a thin horizontal line separating content.
Variant
Which ends of the divider are inset.
static constexpr float BoldThickness
Thickness of a bold stroke, in dp.
static constexpr float HairlineThickness
Default stroke thickness, in dp.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
The base class of a widget without children: an Entity that creates its components when it is constru...
Owns entities and gives the systems the list of entities to visit.
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.
A thin horizontal line separating two pieces of content.
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)
Widgets: the classes used to create entities with the right components and children.