23#include "guillaume/components/accessibility.hpp"
36 if (_label != label) {
78 if (_selected != selected) {
93 if (_checked != checked) {
107 if (_expanded != expanded) {
108 _expanded = expanded;
122 if (value.has_value()
123 && (value->min > value->max || value->now < value->min
124 || value->now > value->max)) {
125 throw std::invalid_argument(
126 "Accessibility value must satisfy min <= now <= max");
140 if (_liveRegion != liveRegion) {
141 _liveRegion = liveRegion;
154 if (focusOrder < 0) {
155 throw std::invalid_argument(
"Focus order must be non-negative");
157 if (_focusOrder != focusOrder) {
158 _focusOrder = focusOrder;
171 if (_focusable != focusable) {
172 _focusable = focusable;
What an entity means to a user who does not see it: its name, its role, its state and its place in th...
Accessibility & setLiveRegion(LiveRegion liveRegion)
Set how urgently a change of the entity is announced.
const std::string & getHint(void) const
Get the sentence describing what activating the entity does.
std::optional< CheckedState > getChecked(void) const
Get whether the entity is ticked.
std::optional< bool > getExpanded(void) const
Get whether the entity shows the content it controls (an open menu, an unfolded section).
AccessibilityRole getRole(void) const
Get what kind of control the entity is.
LiveRegion getLiveRegion(void) const
Get how urgently a change of the entity is announced.
Accessibility & setHint(const std::string &hint)
Set the sentence describing what activating the entity does, such as "Closes the dialog".
const std::string & getLabel(void) const
Get the name announced for the entity.
Accessibility & setExpanded(std::optional< bool > expanded)
Set whether the entity shows the content it controls.
Accessibility & setFocusOrder(int focusOrder)
Set the rank of the entity in the Tab traversal.
Accessibility(void)=default
Construct a description with no label, no role, no state, a focus order of 0 and the focusable flag s...
int getFocusOrder(void) const
Get the rank of the entity in the Tab traversal.
Accessibility & setFocusable(bool focusable)
Include the entity in the Tab traversal or leave it out.
Accessibility & setRole(AccessibilityRole role)
Set what kind of control the entity is.
bool isSelected(void) const
Check whether the entity is the selected one of its group (the active navigation destination,...
Accessibility & setSelected(bool selected)
Set whether the entity is the selected one of its group.
const std::optional< AccessibilityValue > & getValue(void) const
Get the position of the entity within its range.
bool isFocusable(void) const
Check whether the Tab traversal stops on the entity.
Accessibility & setLabel(const std::string &label)
Set the name announced for the entity, such as "Close".
Accessibility & setChecked(std::optional< CheckedState > checked)
Set whether the entity is ticked.
Accessibility & setValue(std::optional< AccessibilityValue > value)
Set the position of the entity within its range.
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
State. Every class here is plain data attached to an entity.
AccessibilityRole
What an entity is for a screen reader or another assistive technology. The values mirror react-native...
LiveRegion
How urgently a change of the entity is announced to the user.