Flutter Linux Embedder
fl_accessible_node.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBLE_NODE_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBLE_NODE_H_
7 
8 #include <atk/atk.h>
9 #include <gio/gio.h>
10 
11 #include "flutter/shell/platform/embedder/embedder.h"
13 
14 G_BEGIN_DECLS
15 
16 // ATK g_autoptr macros weren't added until 2.37. Add them manually.
17 // https://gitlab.gnome.org/GNOME/atk/-/issues/10
18 #if !ATK_CHECK_VERSION(2, 37, 0)
19 G_DEFINE_AUTOPTR_CLEANUP_FUNC(AtkObject, g_object_unref)
20 #endif
21 
22 G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode,
23  fl_accessible_node,
24  FL,
25  ACCESSIBLE_NODE,
26  AtkObject);
27 
28 /**
29  * FlAccessibleNode:
30  *
31  * #FlAccessibleNode is an object that exposes a Flutter accessibility node to
32  * ATK.
33  */
35  AtkObjectClass parent_class;
36 
37  void (*set_name)(FlAccessibleNode* node, const gchar* name);
38  void (*set_extents)(FlAccessibleNode* node,
39  gint x,
40  gint y,
41  gint width,
42  gint height);
43  void (*set_flags)(FlAccessibleNode* node, FlutterSemanticsFlags* flags);
44  void (*set_actions)(FlAccessibleNode* node, FlutterSemanticsAction actions);
45  void (*set_value)(FlAccessibleNode* node, const gchar* value);
46  void (*set_text_selection)(FlAccessibleNode* node, gint base, gint extent);
47  void (*set_text_direction)(FlAccessibleNode* node,
48  FlutterTextDirection direction);
49 
50  void (*perform_action)(FlAccessibleNode* node,
51  FlutterSemanticsAction action,
52  GBytes* data);
53 };
54 
55 /**
56  * fl_accessible_node_new:
57  * @engine: the #FlEngine this node came from.
58  * @view_id: the view ID this object represents.
59  * @node_id: the semantics node ID this object represents.
60  *
61  * Creates a new accessibility object that exposes Flutter accessibility
62  * information to ATK.
63  *
64  * Returns: a new #FlAccessibleNode.
65  */
66 FlAccessibleNode* fl_accessible_node_new(FlEngine* engine,
67  FlutterViewId view_id,
68  int32_t node_id);
69 
70 /**
71  * fl_accessible_node_set_parent:
72  * @node: an #FlAccessibleNode.
73  * @parent: an #AtkObject.
74  * @index: the index of this node in the parent.
75  *
76  * Sets the parent of this node. The parent can be changed at any time.
77  */
78 void fl_accessible_node_set_parent(FlAccessibleNode* node,
79  AtkObject* parent,
80  gint index);
81 
82 /**
83  * fl_accessible_node_set_children:
84  * @node: an #FlAccessibleNode.
85  * @children: (transfer none) (element-type AtkObject): a list of #AtkObject.
86  *
87  * Sets the children of this node. The children can be changed at any time.
88  */
89 void fl_accessible_node_set_children(FlAccessibleNode* node,
90  GPtrArray* children);
91 
92 /**
93  * fl_accessible_node_set_name:
94  * @node: an #FlAccessibleNode.
95  * @name: a node name.
96  *
97  * Sets the name of this node as reported to the a11y consumer.
98  */
99 void fl_accessible_node_set_name(FlAccessibleNode* node, const gchar* name);
100 
101 /**
102  * fl_accessible_node_set_extents:
103  * @node: an #FlAccessibleNode.
104  * @x: x co-ordinate of this node relative to its parent.
105  * @y: y co-ordinate of this node relative to its parent.
106  * @width: width of this node in pixels.
107  * @height: height of this node in pixels.
108  *
109  * Sets the position and size of this node.
110  */
111 void fl_accessible_node_set_extents(FlAccessibleNode* node,
112  gint x,
113  gint y,
114  gint width,
115  gint height);
116 
117 /**
118  * fl_accessible_node_set_flags:
119  * @node: an #FlAccessibleNode.
120  * @flags: the flags for this node.
121  *
122  * Sets the flags for this node.
123  */
124 void fl_accessible_node_set_flags(FlAccessibleNode* node,
125  FlutterSemanticsFlags* flags);
126 
127 /**
128  * fl_accessible_node_set_actions:
129  * @node: an #FlAccessibleNode.
130  * @actions: the actions this node can perform.
131  *
132  * Sets the actions that this node can perform.
133  */
134 void fl_accessible_node_set_actions(FlAccessibleNode* node,
135  FlutterSemanticsAction actions);
136 
137 /**
138  * fl_accessible_node_set_value:
139  * @node: an #FlAccessibleNode.
140  * @value: a node value.
141  *
142  * Sets the value of this node.
143  */
144 void fl_accessible_node_set_value(FlAccessibleNode* node, const gchar* value);
145 
146 /**
147  * fl_accessible_node_set_text_selection:
148  * @node: an #FlAccessibleNode.
149  * @base: the position at which the text selection originates.
150  * @extent: the position at which the text selection terminates.
151  *
152  * Sets the text selection of this node.
153  */
154 void fl_accessible_node_set_text_selection(FlAccessibleNode* node,
155  gint base,
156  gint extent);
157 
158 /**
159  * fl_accessible_node_set_text_direction:
160  * @node: an #FlAccessibleNode.
161  * @direction: the direction of the text.
162  *
163  * Sets the text direction of this node.
164  */
165 void fl_accessible_node_set_text_direction(FlAccessibleNode* node,
166  FlutterTextDirection direction);
167 
168 /**
169  * fl_accessible_node_dispatch_action:
170  * @node: an #FlAccessibleNode.
171  * @action: the action being dispatched.
172  * @data: (allow-none): data associated with the action.
173  *
174  * Performs a semantic action for this node.
175  */
176 void fl_accessible_node_perform_action(FlAccessibleNode* node,
177  FlutterSemanticsAction action,
178  GBytes* data);
179 
180 G_END_DECLS
181 
182 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBLE_NODE_H_
FlutterSemanticsAction action
void fl_accessible_node_perform_action(FlAccessibleNode *node, FlutterSemanticsAction action, GBytes *data)
G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode, fl_accessible_node, FL, ACCESSIBLE_NODE, AtkObject)
void fl_accessible_node_set_actions(FlAccessibleNode *node, FlutterSemanticsAction actions)
void fl_accessible_node_set_text_selection(FlAccessibleNode *node, gint base, gint extent)
void fl_accessible_node_set_flags(FlAccessibleNode *node, FlutterSemanticsFlags *flags)
void fl_accessible_node_set_children(FlAccessibleNode *node, GPtrArray *children)
void fl_accessible_node_set_value(FlAccessibleNode *node, const gchar *value)
void fl_accessible_node_set_extents(FlAccessibleNode *node, gint x, gint y, gint width, gint height)
void fl_accessible_node_set_name(FlAccessibleNode *node, const gchar *name)
void fl_accessible_node_set_text_direction(FlAccessibleNode *node, FlutterTextDirection direction)
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, FlutterViewId view_id, int32_t node_id)
void fl_accessible_node_set_parent(FlAccessibleNode *node, AtkObject *parent, gint index)
const uint8_t uint32_t uint32_t * height
const uint8_t uint32_t * width
uint8_t value
G_BEGIN_DECLS FlutterViewId view_id
void(* perform_action)(FlAccessibleNode *node, FlutterSemanticsAction action, GBytes *data)
void(* set_name)(FlAccessibleNode *node, const gchar *name)
void(* set_text_direction)(FlAccessibleNode *node, FlutterTextDirection direction)
void(* set_actions)(FlAccessibleNode *node, FlutterSemanticsAction actions)
void(* set_text_selection)(FlAccessibleNode *node, gint base, gint extent)
void(* set_value)(FlAccessibleNode *node, const gchar *value)
void(* set_extents)(FlAccessibleNode *node, gint x, gint y, gint width, gint height)
void(* set_flags)(FlAccessibleNode *node, FlutterSemanticsFlags *flags)