27#include "guillaume/ecs/system_filler.hpp"
29#include "guillaume/components/text.hpp"
30#include "guillaume/components/text_field.hpp"
31#include "guillaume/components/text_field_configuration.hpp"
32#include "guillaume/theme/tokens.hpp"
87 static constexpr float Height = 56.0f;
254 const std::string &
text);
The texts around the input of a text field, and its error state: placeholder, label,...
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
The base class to derive a system from: a System whose signature is the list of component types given...
static constexpr float Height
Height of a single-line field that is not dense, in dp.
static bool isFocused(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Whether the field has the input focus.
static constexpr float Padding
static constexpr float DenseHeight
Height of a dense single-line field without a label, in dp.
static void install(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Make an entity focusable and hoverable as a text field.
static std::string text(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Get the text the field holds.
static constexpr float DenseLabelHeight
Height of a dense single-line field that has a label, in dp.
static void setDisabled(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, bool disabled)
Enable or disable the field and restyle it.
~TextField(void) override=default
Default destructor.
static void applyEditing(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Let the input child receive typed text only while the field is being edited.
static constexpr float IconSize
static void applyContainer(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Style the container only, leaving the children alone.
static bool isDisabled(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Whether the field ignores input.
static void setText(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, const std::string &text)
Replace the text from code and restyle the field.
static constexpr float SupportingGap
static bool reconcile(components::TextField &textField, bool hasContent)
Derive the label-floating flag of a field that has no configuration, and store it.
void update(const ecs::Entity::Identifier &entityIdentifier) override
Update one entity that has a components::TextField; called by the frame loop.
static void apply(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Report an edit, then style one text field and arrange its children.
TextField(void)
Create the system in the Layout phase.
static constexpr float Spacing
Gap between the icons, the affixes and the input: 12 dp.
static bool isLabelFloating(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Whether the label is in its floating position.
static std::string supportingText(const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Get the text shown below the field.
static constexpr float get(unsigned int steps)
Get a spacing as a number of grid units.
Rules. Every class here runs each frame on the entities that have the components it declares.