31#include <utility/graphic/color.hpp>
32#include <utility/graphic/pose.hpp>
34#include "guillaume/ecs/component_registry.hpp"
35#include "guillaume/ecs/entity_builder.hpp"
37#include "guillaume/components/checkbox.hpp"
38#include "guillaume/components/line.hpp"
39#include "guillaume/components/selection.hpp"
41#include "guillaume/entities/icon.hpp"
42#include "guillaume/entities/builder_base.hpp"
43#include "guillaume/entities/surface.hpp"
44#include "guillaume/entities/text.hpp"
90 public SurfaceBase<components::Selectable, components::Line,
111 State _state { State::Unchecked };
112 Variant _variant { Variant::Enabled };
113 std::string _label {};
136 std::shared_ptr<Checkbox>
buildEntity(
void)
override;
145 void reset(
void)
override;
190 std::shared_ptr<Checkbox>
192 Variant variant,
const std::string &label);
208 template<
typename... Arguments>
209 static std::shared_ptr<Checkbox>
create(Arguments &&...arguments)
211 std::shared_ptr<Checkbox> entity(
212 new Checkbox(std::forward<Arguments>(arguments)...));
260 Checkbox &
setLabel(
const std::string &label);
321 std::optional<utility::graphic::Color32Bit> color);
349 State state,
Variant variant,
const std::string &label);
static constexpr float LabelGap
Gap between the touch target and the label, in dp.
static constexpr float TouchTarget
Edge of the square touch target centered on the box, in dp.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
Owns entities and gives the systems the list of entities to visit.
Builder & withState(State state)
Set the state the checkbox starts in.
void reset(void) override
Restore the default configuration.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Construct a builder with the default configuration (see reset()).
Builder & withVariant(Variant variant)
Set the visual variant.
Builder & withPose(const utility::graphic::PoseF &pose)
Set the position and orientation of the box.
Builder & withLabel(const std::string &label)
Set the label shown to the right of the box.
std::shared_ptr< Checkbox > makeCheckbox(std::shared_ptr< ecs::Entity > parent, State state, Variant variant, const std::string &label)
Build a checkbox, register it under parent and reset the builder.
std::shared_ptr< Checkbox > buildEntity(void) override
Build a Checkbox, with its check glyph and label children, from the current configuration,...
bool isChecked(void) const
Check whether the checkbox's components::Selectable is selected.
~Checkbox(void) override=default
Default destructor.
components::Checkbox::Variant Variant
Checkbox & setCheckedColor(std::optional< utility::graphic::Color32Bit > color)
Override the fill color of the checked and indeterminate box (Paper color). Restyles at once.
static constexpr float TouchTarget
Side of the square that answers input, centered on the box, in dp.
State getState(void) const
Get the state.
Variant getVariant(void) const
Get the visual variant.
Checkbox & setVariant(Variant variant)
Set the visual variant. Restyles at once.
Checkbox & setOnValueChange(std::function< void(State)> onValueChange)
Set the handler called when the user toggles the box, or when toggle() is called.
Checkbox & toggle(void)
Toggle as a user activation would: a checked box becomes unchecked, an unchecked or indeterminate box...
bool isDisabled(void) const
Check whether the checkbox ignores input.
Checkbox & setState(State state)
Set the state. Restyles at once.
components::Checkbox::State State
Checked state: Unchecked, Checked or Indeterminate.
Checkbox & setLabel(const std::string &label)
Set the label text and the accessibility label. Restyles at once.
static std::shared_ptr< Checkbox > create(Arguments &&...arguments)
Create a checkbox and its check glyph and label children, without registering it in an entity registr...
Checkbox & setUncheckedColor(std::optional< utility::graphic::Color32Bit > color)
Override the outline color of the unchecked box (Paper uncheckedColor). Restyles at once.
static constexpr float LabelGap
Gap between the touch target and the label, in dp.
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
SurfaceBase(ecs::ComponentRegistry ®istry, const SurfaceConfig &config)
Widgets: the classes used to create entities with the right components and children.
Everything needed to set up a surface in one value: where it is, how it looks and how it arranges its...