24 "MoveCursorForwardByCharacter"},
26 "MoveCursorBackwardByCharacter"},
31 "DidGainAccessibilityFocus"},
33 "DidLoseAccessibilityFocus"},
38 "MoveCursorBackwardByWord"},
68#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node) \
69 ((FlAccessibleNodePrivate*)fl_accessible_node_get_instance_private( \
70 FL_ACCESSIBLE_NODE(node)))
73 AtkComponentIface* iface);
80 G_ADD_PRIVATE(FlAccessibleNode)
81 G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT,
83 G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION,
126 return (actions &
action) != 0;
131 if (index < 0 ||
static_cast<guint
>(index) >=
priv->actions->len) {
134 return static_cast<ActionData*
>(g_ptr_array_index(
priv->actions, index));
138static gboolean
has_child(GPtrArray* children, AtkObject*
object) {
139 for (guint
i = 0;
i < children->len;
i++) {
140 if (g_ptr_array_index(children,
i) ==
object) {
158 priv->view_id = g_value_get_int64(
value);
164 G_OBJECT_WARN_INVALID_PROPERTY_ID(
object,
prop_id,
pspec);
173 g_weak_ref_clear(&
priv->parent);
174 g_clear_pointer(&
priv->name, g_free);
175 g_clear_pointer(&
priv->actions, g_ptr_array_unref);
176 g_clear_pointer(&
priv->children, g_ptr_array_unref);
178 G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(
object);
190 g_autoptr(AtkObject) parent = ATK_OBJECT(g_weak_ref_get(&
priv->parent));
203 return priv->children->len;
210 if (
i < 0 ||
static_cast<guint
>(
i) >=
priv->children->len) {
214 return ATK_OBJECT(g_object_ref(g_ptr_array_index(
priv->children,
i)));
220 if (
priv->flags.is_button) {
221 return ATK_ROLE_PUSH_BUTTON;
223 if (
priv->flags.is_in_mutually_exclusive_group &&
225 return ATK_ROLE_RADIO_BUTTON;
228 return ATK_ROLE_CHECK_BOX;
231 return ATK_ROLE_TOGGLE_BUTTON;
233 if (
priv->flags.is_slider) {
234 return ATK_ROLE_SLIDER;
236 if (
priv->flags.is_text_field &&
priv->flags.is_obscured) {
237 return ATK_ROLE_PASSWORD_TEXT;
239 if (
priv->flags.is_text_field) {
240 return ATK_ROLE_TEXT;
242 if (
priv->flags.is_header) {
243 return ATK_ROLE_HEADER;
245 if (
priv->flags.is_link) {
246 return ATK_ROLE_LINK;
248 if (
priv->flags.is_image) {
249 return ATK_ROLE_IMAGE;
252 return ATK_ROLE_PANEL;
259 AtkStateSet* state_set = atk_state_set_new();
261 if (!
priv->flags.is_obscured) {
262 atk_state_set_add_state(state_set, ATK_STATE_SHOWING);
264 if (!
priv->flags.is_hidden) {
265 atk_state_set_add_state(state_set, ATK_STATE_VISIBLE);
267 if (is_checkable(
priv->flags)) {
268 atk_state_set_add_state(state_set, ATK_STATE_CHECKABLE);
271 atk_state_set_add_state(state_set, ATK_STATE_CHECKED);
274 atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
277 atk_state_set_add_state(state_set, ATK_STATE_FOCUSED);
280 atk_state_set_add_state(state_set, ATK_STATE_SELECTED);
283 atk_state_set_add_state(state_set, ATK_STATE_ENABLED);
286 atk_state_set_add_state(state_set, ATK_STATE_SENSITIVE);
288 if (
priv->flags.is_read_only) {
289 atk_state_set_add_state(state_set, ATK_STATE_READ_ONLY);
291 if (
priv->flags.is_text_field) {
292 atk_state_set_add_state(state_set, ATK_STATE_EDITABLE);
304 AtkCoordType coord_type) {
309 g_autoptr(AtkObject) parent = ATK_OBJECT(g_weak_ref_get(&
priv->parent));
310 if (parent !=
nullptr) {
311 atk_component_get_extents(ATK_COMPONENT(parent),
x,
y,
nullptr,
nullptr,
323 return ATK_LAYER_WIDGET;
336 if (data ==
nullptr) {
348 return priv->actions->len;
356 if (data ==
nullptr) {
387 return !old_flag != !new_flag;
396 priv->flags = *flags;
408 is_checkable(
priv->flags));
446 FlAccessibleNode*
self,
455 g_ptr_array_remove_range(
priv->actions, 0,
priv->actions->len);
465 const gchar* value) {}
474 FlAccessibleNode*
self,
479 FlAccessibleNode*
self,
496 ATK_OBJECT_CLASS(klass)->get_index_in_parent =
503 FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
505 FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
507 FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
509 FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
511 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
513 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
515 FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
518 g_object_class_install_property(
521 "engine",
"engine",
"Flutter engine", fl_engine_get_type(),
522 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
523 G_PARAM_STATIC_STRINGS)));
524 g_object_class_install_property(
527 "view-id",
"view-id",
"View ID that this node belongs to", 0,
529 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
530 g_object_class_install_property(
531 G_OBJECT_CLASS(klass),
PROP_ID,
533 "node-id",
"node-id",
"Accessibility node ID", 0, G_MAXINT, 0,
534 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
535 G_PARAM_STATIC_STRINGS)));
539 AtkComponentIface* iface) {
553 g_weak_ref_init(&
priv->parent,
nullptr);
554 priv->actions = g_ptr_array_new();
555 priv->children = g_ptr_array_new_with_free_func(g_object_unref);
561 FlAccessibleNode*
self = FL_ACCESSIBLE_NODE(
562 g_object_new(fl_accessible_node_get_type(),
"engine",
engine,
"view-id",
563 view_id,
"node-id", node_id,
nullptr));
570 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
572 g_weak_ref_set(&
priv->parent, parent);
577 GPtrArray* children) {
578 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
582 for (guint
i = 0;
i <
priv->children->len;) {
583 AtkObject*
object = ATK_OBJECT(g_ptr_array_index(
priv->children,
i));
587 g_signal_emit_by_name(
self,
"children-changed::remove",
i,
object,
589 g_ptr_array_remove_index(
priv->children,
i);
594 for (guint
i = 0;
i < children->len;
i++) {
595 AtkObject*
object = ATK_OBJECT(g_ptr_array_index(children,
i));
597 g_ptr_array_add(
priv->children, g_object_ref(
object));
598 g_signal_emit_by_name(
self,
"children-changed::add",
i,
object,
nullptr);
604 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
606 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_name(
self,
name);
614 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
616 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_extents(
self,
x,
y,
width,
622 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
624 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_flags(
self, flags);
629 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
631 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_actions(
self, actions);
635 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
637 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_value(
self,
value);
643 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
645 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_text_selection(
self,
base,
651 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
653 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_text_direction(
self,
660 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
662 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->perform_action(
self,
action, data);
@ kFlutterCheckStateNone
The semantics node does not have check state.
@ kFlutterCheckStateTrue
The semantics node is checked.
@ kFlutterSemanticsActionMoveCursorForwardByCharacter
Move the cursor forward by one character.
@ kFlutterSemanticsActionDidLoseAccessibilityFocus
Indicate that the node has lost accessibility focus.
@ kFlutterSemanticsActionExpand
A request that the node should be expanded.
@ kFlutterSemanticsActionDecrease
Decrease the value represented by the semantics node.
@ kFlutterSemanticsActionCollapse
A request that the node should be collapsed.
@ kFlutterSemanticsActionScrollDown
@ kFlutterSemanticsActionMoveCursorBackwardByCharacter
Move the cursor backward by one character.
@ kFlutterSemanticsActionMoveCursorForwardByWord
Move the cursor forward by one word.
@ kFlutterSemanticsActionLongPress
@ kFlutterSemanticsActionScrollRight
@ kFlutterSemanticsActionShowOnScreen
A request to fully show the semantics node on screen.
@ kFlutterSemanticsActionDismiss
A request that the node should be dismissed.
@ kFlutterSemanticsActionFocus
Request that the respective focusable widget gain input focus.
@ kFlutterSemanticsActionPaste
Paste the current content of the clipboard.
@ kFlutterSemanticsActionScrollUp
@ kFlutterSemanticsActionCut
Cut the current selection and place it in the clipboard.
@ kFlutterSemanticsActionCustomAction
Indicate that the user has invoked a custom accessibility action.
@ kFlutterSemanticsActionCopy
Copy the current selection to the clipboard.
@ kFlutterSemanticsActionMoveCursorBackwardByWord
Move the cursor backward by one word.
@ kFlutterSemanticsActionIncrease
Increase the value represented by the semantics node.
@ kFlutterSemanticsActionScrollLeft
@ kFlutterSemanticsActionDidGainAccessibilityFocus
Indicate that the node has gained accessibility focus.
@ kFlutterSemanticsActionTap
@ kFlutterTristateTrue
The property is applicable and its state is "true" or "on".
@ kFlutterTristateNone
The property is not applicable to this semantics node.
FlViewAccessible * accessible
g_autoptr(FlEngine) engine
FlAccessibilityHandlerPrivate * priv
static gboolean has_child(GPtrArray *children, AtkObject *object)
static void fl_accessible_node_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
void fl_accessible_node_set_name(FlAccessibleNode *self, const gchar *name)
static gboolean fl_accessible_node_do_action(AtkAction *action, gint i)
static void fl_accessible_node_action_interface_init(AtkActionIface *iface)
static void fl_accessible_node_set_text_direction_impl(FlAccessibleNode *self, FlutterTextDirection direction)
void fl_accessible_node_set_text_direction(FlAccessibleNode *self, FlutterTextDirection direction)
void fl_accessible_node_perform_action(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static AtkStateSet * fl_accessible_node_ref_state_set(AtkObject *accessible)
static gboolean is_sensitive(FlutterSemanticsFlags flags)
static AtkRole fl_accessible_node_get_role(AtkObject *accessible)
static bool flag_changed(bool old_flag, bool new_flag)
static void fl_accessible_node_set_value_impl(FlAccessibleNode *self, const gchar *value)
void fl_accessible_node_set_text_selection(FlAccessibleNode *self, gint base, gint extent)
static AtkObject * fl_accessible_node_get_parent(AtkObject *accessible)
static void fl_accessible_node_class_init(FlAccessibleNodeClass *klass)
static void fl_accessible_node_set_actions_impl(FlAccessibleNode *self, FlutterSemanticsAction actions)
static void fl_accessible_node_component_interface_init(AtkComponentIface *iface)
void fl_accessible_node_set_actions(FlAccessibleNode *self, FlutterSemanticsAction actions)
static void fl_accessible_node_dispose(GObject *object)
void fl_accessible_node_set_children(FlAccessibleNode *self, GPtrArray *children)
void fl_accessible_node_set_extents(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
static AtkLayer fl_accessible_node_get_layer(AtkComponent *component)
void fl_accessible_node_set_value(FlAccessibleNode *self, const gchar *value)
static gboolean is_enabled(FlutterSemanticsFlags flags)
static void fl_accessible_node_get_extents(AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type)
static gint fl_accessible_node_get_n_actions(AtkAction *action)
G_DEFINE_TYPE_WITH_CODE(FlAccessibleNode, fl_accessible_node, ATK_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT, fl_accessible_node_component_interface_init) G_IMPLEMENT_INTERFACE(ATK_TYPE_ACTION, fl_accessible_node_action_interface_init)) static gboolean is_checkable(FlutterSemanticsFlags flags)
static ActionData * get_action(FlAccessibleNodePrivate *priv, gint index)
static const gchar * fl_accessible_node_get_name(AtkObject *accessible)
static gboolean is_selected(FlutterSemanticsFlags flags)
static gboolean has_action(FlutterSemanticsAction actions, FlutterSemanticsAction action)
static gint fl_accessible_node_get_index_in_parent(AtkObject *accessible)
static gboolean is_focusable(FlutterSemanticsFlags flags)
static void fl_accessible_node_init(FlAccessibleNode *self)
void fl_accessible_node_set_parent(FlAccessibleNode *self, AtkObject *parent, gint index)
static void fl_accessible_node_perform_action_impl(FlAccessibleNode *self, FlutterSemanticsAction action, GBytes *data)
static ActionData action_mapping[]
static void fl_accessible_node_set_text_selection_impl(FlAccessibleNode *self, gint base, gint extent)
void fl_accessible_node_set_flags(FlAccessibleNode *self, FlutterSemanticsFlags *flags)
static gint fl_accessible_node_get_n_children(AtkObject *accessible)
static gboolean is_checked(FlutterSemanticsFlags flags)
static void fl_accessible_node_set_extents_impl(FlAccessibleNode *self, gint x, gint y, gint width, gint height)
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, FlutterViewId view_id, int32_t node_id)
#define FL_ACCESSIBLE_NODE_GET_PRIVATE(node)
static void fl_accessible_node_set_name_impl(FlAccessibleNode *self, const gchar *name)
static AtkObject * fl_accessible_node_ref_child(AtkObject *accessible, gint i)
static gboolean is_focused(FlutterSemanticsFlags flags)
static void fl_accessible_node_set_flags_impl(FlAccessibleNode *self, FlutterSemanticsFlags *flags)
void fl_engine_dispatch_semantics_action(FlEngine *self, FlutterViewId view_id, uint64_t node_id, FlutterSemanticsAction action, GBytes *data)
guint const GValue GParamSpec * pspec
G_BEGIN_DECLS FlutterViewId view_id
void atk_object_notify_state_change(AtkObject *accessible, AtkState state, gboolean value)
FlutterSemanticsAction action
FlutterSemanticsFlags flags
FlutterViewId view_id
The unique identifier of the view to which this node belongs.
AtkObject parent_instance
FlutterTristate is_enabled
Whether a semantic node is currently enabled.
bool is_obscured
Whether the value of the semantics node is obscured.
FlutterTristate is_selected
Whether a semantics node is selected.
FlutterTristate is_toggled
FlutterTristate is_focused
Whether the semantic node currently holds the user's focus.
bool is_hidden
Whether the semantics node is considered hidden.
bool is_text_field
Whether the semantic node represents a text field.
FlutterCheckState is_checked
Whether a semantics node is checked.