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) {
155 g_assert(
priv->engine ==
nullptr);
156 priv->engine = FL_ENGINE(g_value_get_object(
value));
157 g_object_add_weak_pointer(
object,
158 reinterpret_cast<gpointer*
>(&
priv->engine));
161 priv->view_id = g_value_get_int64(
value);
167 G_OBJECT_WARN_INVALID_PROPERTY_ID(
object,
prop_id,
pspec);
175 if (
priv->engine !=
nullptr) {
176 g_object_remove_weak_pointer(
object,
177 reinterpret_cast<gpointer*
>(&(
priv->engine)));
178 priv->engine =
nullptr;
180 if (
priv->parent !=
nullptr) {
181 g_object_remove_weak_pointer(
object,
182 reinterpret_cast<gpointer*
>(&(
priv->parent)));
183 priv->parent =
nullptr;
185 g_clear_pointer(&
priv->name, g_free);
186 g_clear_pointer(&
priv->actions, g_ptr_array_unref);
187 g_clear_pointer(&
priv->children, g_ptr_array_unref);
189 G_OBJECT_CLASS(fl_accessible_node_parent_class)->dispose(
object);
213 return priv->children->len;
220 if (
i < 0 ||
static_cast<guint
>(
i) >=
priv->children->len) {
224 return ATK_OBJECT(g_object_ref(g_ptr_array_index(
priv->children,
i)));
230 if (
priv->flags.is_button) {
231 return ATK_ROLE_PUSH_BUTTON;
233 if (
priv->flags.is_in_mutually_exclusive_group &&
235 return ATK_ROLE_RADIO_BUTTON;
238 return ATK_ROLE_CHECK_BOX;
241 return ATK_ROLE_TOGGLE_BUTTON;
243 if (
priv->flags.is_slider) {
244 return ATK_ROLE_SLIDER;
246 if (
priv->flags.is_text_field &&
priv->flags.is_obscured) {
247 return ATK_ROLE_PASSWORD_TEXT;
249 if (
priv->flags.is_text_field) {
250 return ATK_ROLE_TEXT;
252 if (
priv->flags.is_header) {
253 return ATK_ROLE_HEADER;
255 if (
priv->flags.is_link) {
256 return ATK_ROLE_LINK;
258 if (
priv->flags.is_image) {
259 return ATK_ROLE_IMAGE;
262 return ATK_ROLE_PANEL;
269 AtkStateSet* state_set = atk_state_set_new();
271 if (!
priv->flags.is_obscured) {
272 atk_state_set_add_state(state_set, ATK_STATE_SHOWING);
274 if (!
priv->flags.is_hidden) {
275 atk_state_set_add_state(state_set, ATK_STATE_VISIBLE);
277 if (is_checkable(
priv->flags)) {
278 atk_state_set_add_state(state_set, ATK_STATE_CHECKABLE);
281 atk_state_set_add_state(state_set, ATK_STATE_CHECKED);
284 atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
287 atk_state_set_add_state(state_set, ATK_STATE_FOCUSED);
290 atk_state_set_add_state(state_set, ATK_STATE_SELECTED);
293 atk_state_set_add_state(state_set, ATK_STATE_ENABLED);
296 atk_state_set_add_state(state_set, ATK_STATE_SENSITIVE);
298 if (
priv->flags.is_read_only) {
299 atk_state_set_add_state(state_set, ATK_STATE_READ_ONLY);
301 if (
priv->flags.is_text_field) {
302 atk_state_set_add_state(state_set, ATK_STATE_EDITABLE);
314 AtkCoordType coord_type) {
319 if (
priv->parent !=
nullptr) {
320 atk_component_get_extents(ATK_COMPONENT(
priv->parent),
x,
y,
nullptr,
321 nullptr, coord_type);
332 return ATK_LAYER_WIDGET;
339 if (
priv->engine ==
nullptr) {
344 if (
data ==
nullptr) {
356 return priv->actions->len;
364 if (
data ==
nullptr) {
395 return !old_flag != !new_flag;
404 priv->flags = *flags;
416 is_checkable(
priv->flags));
454 FlAccessibleNode*
self,
463 g_ptr_array_remove_range(
priv->actions, 0,
priv->actions->len);
473 const gchar* value) {}
482 FlAccessibleNode*
self,
487 FlAccessibleNode*
self,
500 ATK_OBJECT_CLASS(klass)->get_index_in_parent =
507 FL_ACCESSIBLE_NODE_CLASS(klass)->set_extents =
509 FL_ACCESSIBLE_NODE_CLASS(klass)->set_flags =
511 FL_ACCESSIBLE_NODE_CLASS(klass)->set_actions =
513 FL_ACCESSIBLE_NODE_CLASS(klass)->set_value =
515 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_selection =
517 FL_ACCESSIBLE_NODE_CLASS(klass)->set_text_direction =
519 FL_ACCESSIBLE_NODE_CLASS(klass)->perform_action =
522 g_object_class_install_property(
525 "engine",
"engine",
"Flutter engine", fl_engine_get_type(),
526 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
527 G_PARAM_STATIC_STRINGS)));
528 g_object_class_install_property(
531 "view-id",
"view-id",
"View ID that this node belongs to", 0,
533 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
534 g_object_class_install_property(
535 G_OBJECT_CLASS(klass),
PROP_ID,
537 "node-id",
"node-id",
"Accessibility node ID", 0, G_MAXINT, 0,
538 static_cast<GParamFlags
>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
539 G_PARAM_STATIC_STRINGS)));
543 AtkComponentIface* iface) {
556 priv->actions = g_ptr_array_new();
557 priv->children = g_ptr_array_new_with_free_func(g_object_unref);
563 FlAccessibleNode*
self = FL_ACCESSIBLE_NODE(
564 g_object_new(fl_accessible_node_get_type(),
"engine",
engine,
"view-id",
565 view_id,
"node-id", node_id,
nullptr));
572 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
574 priv->parent = parent;
576 g_object_add_weak_pointer(G_OBJECT(
self),
577 reinterpret_cast<gpointer*
>(&(
priv->parent)));
581 GPtrArray* children) {
582 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
586 for (guint
i = 0;
i <
priv->children->len;) {
587 AtkObject*
object = ATK_OBJECT(g_ptr_array_index(
priv->children,
i));
591 g_signal_emit_by_name(
self,
"children-changed::remove",
i,
object,
593 g_ptr_array_remove_index(
priv->children,
i);
598 for (guint
i = 0;
i < children->len;
i++) {
599 AtkObject*
object = ATK_OBJECT(g_ptr_array_index(children,
i));
601 g_ptr_array_add(
priv->children, g_object_ref(
object));
602 g_signal_emit_by_name(
self,
"children-changed::add",
i,
object,
nullptr);
608 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
610 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_name(
self,
name);
618 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
620 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_extents(
self,
x,
y,
width,
626 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
628 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_flags(
self, flags);
633 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
635 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_actions(
self, actions);
639 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
641 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_value(
self,
value);
647 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
649 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_text_selection(
self,
base,
655 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
657 return FL_ACCESSIBLE_NODE_GET_CLASS(
self)->set_text_direction(
self,
664 g_return_if_fail(FL_IS_ACCESSIBLE_NODE(
self));
@ 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.
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)
FlPixelBufferTexturePrivate * priv
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.
std::shared_ptr< const fml::Mapping > data