23#include "guillaume/components/search.hpp"
36 return assign(_variant, variant);
46 return assign(_placeholder, placeholder);
56 return assign(_text, text);
66 return assign(_iconGlyph, glyph);
71 return _trailingGlyph;
76 return assign(_trailingGlyph, glyph);
86 return assign(_loading, loading);
96 _onIconPress = std::move(handler);
100 const std::function<void(
void)> &
103 return _onClearIconPress;
108 _onClearIconPress = std::move(handler);
112 const std::function<void(
void)> &
115 return _onTrailingIconPress;
120 _onTrailingIconPress = std::move(handler);
131 return assign(_searchIcon, identifier);
141 return assign(_textEntity, identifier);
146 return _placeholderEntity;
151 return assign(_placeholderEntity, identifier);
161 return assign(_clearIcon, identifier);
171 return assign(_loadingIcon, identifier);
176 return _trailingIcon;
181 return assign(_trailingIcon, identifier);
Search & setTextEntity(ecs::Entity::Identifier identifier)
Record the child the user types the query in.
ecs::Entity::Identifier getLoadingIcon(void) const noexcept
Get the child that draws the loading glyph.
const std::function< void(void)> & getOnIconPress(void) const noexcept
Get the callback run when the leading icon is pressed.
Variant getVariant(void) const noexcept
Get the shape of the field.
const std::string & getIconGlyph(void) const noexcept
Get the icon at the leading edge of the field.
ecs::Entity::Identifier getClearIcon(void) const noexcept
Get the pressable child that draws the clear button.
Search & setLoadingIcon(ecs::Entity::Identifier identifier)
Record the child that draws the loading glyph.
Search & setClearIcon(ecs::Entity::Identifier identifier)
Record the pressable child that draws the clear button.
Variant
Shape of the search field.
const std::string & getText(void) const noexcept
Get the query.
ecs::Entity::Identifier getSearchIcon(void) const noexcept
Get the pressable child that draws the leading icon.
Search & setLoading(bool loading)
Show or hide the loading glyph.
const std::function< void(void)> & getOnTrailingIconPress(void) const noexcept
Get the callback run when the trailing icon is pressed.
Search & setText(const std::string &text)
Store the query.
Search & setPlaceholderEntity(ecs::Entity::Identifier identifier)
Record the child that draws the placeholder.
Search & setTrailingIcon(ecs::Entity::Identifier identifier)
Record the pressable child that draws the trailing icon.
const std::string & getPlaceholder(void) const noexcept
Get the hint shown while the query is empty.
Search & setOnIconPress(std::function< void(void)> handler)
Set the callback run when the leading icon is pressed.
Search & setIconGlyph(const std::string &glyph)
Set the icon at the leading edge of the field, such as "arrow_back".
Search & setOnTrailingIconPress(std::function< void(void)> handler)
Set the callback run when the trailing icon is pressed.
const std::string & getTrailingGlyph(void) const noexcept
Get the icon at the trailing edge of the field.
Search & setSearchIcon(ecs::Entity::Identifier identifier)
Record the pressable child that draws the leading icon.
ecs::Entity::Identifier getTrailingIcon(void) const noexcept
Get the pressable child that draws the trailing icon.
ecs::Entity::Identifier getPlaceholderEntity(void) const noexcept
Get the child that draws the placeholder.
ecs::Entity::Identifier getTextEntity(void) const noexcept
Get the child the user types the query in.
Search & setPlaceholder(const std::string &placeholder)
Set the hint shown while the query is empty, such as "Search".
Search(void)=default
Create the configuration of an empty search bar with the "search" leading icon.
Search & setTrailingGlyph(const std::string &glyph)
Set the icon at the trailing edge of the field, such as "mic".
Search & setVariant(Variant variant)
Set the shape of the field.
bool isLoading(void) const noexcept
Tell whether the field shows its loading glyph.
const std::function< void(void)> & getOnClearIconPress(void) const noexcept
Get the callback run when the clear button is pressed.
Search & setOnClearIconPress(std::function< void(void)> handler)
Set the callback run when the clear button is pressed.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
State. Every class here is plain data attached to an entity.