23#include "guillaume/components/text_field.hpp"
34 if (_placeholder == placeholder) {
37 _placeholder = placeholder;
49 if (_label == label) {
59 return _supportingText;
64 if (_supportingText == supportingText) {
67 _supportingText = supportingText;
79 if (_prefix == prefix) {
94 if (_suffix == suffix) {
109 if (_errorText == errorText) {
112 _errorText = errorText;
124 if (_error == error) {
134 return _labelFloating;
139 if (_labelFloating == floating) {
142 _labelFloating = floating;
bool isLabelFloating(void) const
Tell whether the label is drawn small, above the input.
bool isError(void) const
Tell whether the field is in error.
TextField & setPlaceholder(const std::string &placeholder)
Set the placeholder: the text that names the field, such as "Email".
TextField & setError(bool error)
Put the field in error or clear the error.
const std::string & getErrorText(void) const
Get the message shown under the field while it is in error.
TextField & setErrorText(const std::string &errorText)
Set the message shown under the field while it is in error.
const std::string & getPrefix(void) const
Get the fixed text shown before the input.
TextField & setLabel(const std::string &label)
Store the label.
const std::string & getSupportingText(void) const
Get the helper text shown under the field.
TextField(void)=default
Create a field with no text and no error.
const std::string & getSuffix(void) const
Get the fixed text shown after the input.
const std::string & getPlaceholder(void) const
Get the placeholder: the text that names the field.
TextField & setSupportingText(const std::string &supportingText)
Set the helper text shown under the field, such as "Atleast 8 characters".
TextField & setLabelFloating(bool floating)
Store whether the label floats above the input.
const std::string & getLabel(void) const
Get the label.
TextField & setPrefix(const std::string &prefix)
Set the fixed text shown before the input, such as "$".
TextField & setSuffix(const std::string &suffix)
Set the fixed text shown after the input, such as "kg".
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
State. Every class here is plain data attached to an entity.