| 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"
12 #include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.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 */
34 struct _FlAccessibleNodeClass {
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_perform_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_
fl_accessible_node_perform_action
void fl_accessible_node_perform_action(FlAccessibleNode *node, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.cc:661
G_DECLARE_DERIVABLE_TYPE
G_BEGIN_DECLS G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode, fl_accessible_node, FL, ACCESSIBLE_NODE, AtkObject)
fl_accessible_node_set_actions
void fl_accessible_node_set_actions(FlAccessibleNode *node, FlutterSemanticsAction actions)
Definition: fl_accessible_node.cc:631
fl_accessible_node_set_text_selection
void fl_accessible_node_set_text_selection(FlAccessibleNode *node, gint base, gint extent)
Definition: fl_accessible_node.cc:644
fl_accessible_node_set_flags
void fl_accessible_node_set_flags(FlAccessibleNode *node, FlutterSemanticsFlags *flags)
Definition: fl_accessible_node.cc:624
fl_accessible_node_set_children
void fl_accessible_node_set_children(FlAccessibleNode *node, GPtrArray *children)
Definition: fl_accessible_node.cc:580
fl_accessible_node_set_value
void fl_accessible_node_set_value(FlAccessibleNode *node, const gchar *value)
Definition: fl_accessible_node.cc:638
fl_accessible_node_set_extents
void fl_accessible_node_set_extents(FlAccessibleNode *node, gint x, gint y, gint width, gint height)
Definition: fl_accessible_node.cc:613
fl_accessible_node_set_name
void fl_accessible_node_set_name(FlAccessibleNode *node, const gchar *name)
Definition: fl_accessible_node.cc:607
fl_accessible_node_set_text_direction
void fl_accessible_node_set_text_direction(FlAccessibleNode *node, FlutterTextDirection direction)
Definition: fl_accessible_node.cc:653
fl_accessible_node_new
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, FlutterViewId view_id, int32_t node_id)
Definition: fl_accessible_node.cc:560
fl_accessible_node_set_parent
void fl_accessible_node_set_parent(FlAccessibleNode *node, AtkObject *parent, gint index)
Definition: fl_accessible_node.cc:569
FL
FL
Definition: fl_binary_messenger.cc:27
height
self height
Definition: fl_compositor_software.cc:43
width
self width
Definition: fl_compositor_software.cc:42
fl_engine.h
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
view_id
G_BEGIN_DECLS FlutterViewId view_id
Definition: fl_view_accessible.h:49
_FlAccessibleNodeClass
Definition: fl_accessible_node.h:34
_FlAccessibleNodeClass::perform_action
void(* perform_action)(FlAccessibleNode *node, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.h:50
_FlAccessibleNodeClass::set_name
void(* set_name)(FlAccessibleNode *node, const gchar *name)
Definition: fl_accessible_node.h:37
_FlAccessibleNodeClass::set_text_direction
void(* set_text_direction)(FlAccessibleNode *node, FlutterTextDirection direction)
Definition: fl_accessible_node.h:47
_FlAccessibleNodeClass::set_actions
void(* set_actions)(FlAccessibleNode *node, FlutterSemanticsAction actions)
Definition: fl_accessible_node.h:44
_FlAccessibleNodeClass::set_text_selection
void(* set_text_selection)(FlAccessibleNode *node, gint base, gint extent)
Definition: fl_accessible_node.h:46
_FlAccessibleNodeClass::set_value
void(* set_value)(FlAccessibleNode *node, const gchar *value)
Definition: fl_accessible_node.h:45
_FlAccessibleNodeClass::parent_class
AtkObjectClass parent_class
Definition: fl_accessible_node.h:35
_FlAccessibleNodeClass::set_extents
void(* set_extents)(FlAccessibleNode *node, gint x, gint y, gint width, gint height)
Definition: fl_accessible_node.h:38
_FlAccessibleNodeClass::set_flags
void(* set_flags)(FlAccessibleNode *node, FlutterSemanticsFlags *flags)
Definition: fl_accessible_node.h:43