| 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, FlutterSemanticsFlag 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 * @id: the semantics node ID this object represents.
59 *
60 * Creates a new accessibility object that exposes Flutter accessibility
61 * information to ATK.
62 *
63 * Returns: a new #FlAccessibleNode.
64 */
65 FlAccessibleNode* fl_accessible_node_new(FlEngine* engine, int32_t id);
66
67 /**
68 * fl_accessible_node_set_parent:
69 * @node: an #FlAccessibleNode.
70 * @parent: an #AtkObject.
71 * @index: the index of this node in the parent.
72 *
73 * Sets the parent of this node. The parent can be changed at any time.
74 */
75 void fl_accessible_node_set_parent(FlAccessibleNode* node,
76 AtkObject* parent,
77 gint index);
78
79 /**
80 * fl_accessible_node_set_children:
81 * @node: an #FlAccessibleNode.
82 * @children: (transfer none) (element-type AtkObject): a list of #AtkObject.
83 *
84 * Sets the children of this node. The children can be changed at any time.
85 */
86 void fl_accessible_node_set_children(FlAccessibleNode* node,
87 GPtrArray* children);
88
89 /**
90 * fl_accessible_node_set_name:
91 * @node: an #FlAccessibleNode.
92 * @name: a node name.
93 *
94 * Sets the name of this node as reported to the a11y consumer.
95 */
96 void fl_accessible_node_set_name(FlAccessibleNode* node, const gchar* name);
97
98 /**
99 * fl_accessible_node_set_extents:
100 * @node: an #FlAccessibleNode.
101 * @x: x co-ordinate of this node relative to its parent.
102 * @y: y co-ordinate of this node relative to its parent.
103 * @width: width of this node in pixels.
104 * @height: height of this node in pixels.
105 *
106 * Sets the position and size of this node.
107 */
108 void fl_accessible_node_set_extents(FlAccessibleNode* node,
109 gint x,
110 gint y,
111 gint width,
112 gint height);
113
114 /**
115 * fl_accessible_node_set_flags:
116 * @node: an #FlAccessibleNode.
117 * @flags: the flags for this node.
118 *
119 * Sets the flags for this node.
120 */
121 void fl_accessible_node_set_flags(FlAccessibleNode* node,
122 FlutterSemanticsFlag flags);
123
124 /**
125 * fl_accessible_node_set_actions:
126 * @node: an #FlAccessibleNode.
127 * @actions: the actions this node can perform.
128 *
129 * Sets the actions that this node can perform.
130 */
131 void fl_accessible_node_set_actions(FlAccessibleNode* node,
132 FlutterSemanticsAction actions);
133
134 /**
135 * fl_accessible_node_set_value:
136 * @node: an #FlAccessibleNode.
137 * @value: a node value.
138 *
139 * Sets the value of this node.
140 */
141 void fl_accessible_node_set_value(FlAccessibleNode* node, const gchar* value);
142
143 /**
144 * fl_accessible_node_set_text_selection:
145 * @node: an #FlAccessibleNode.
146 * @base: the position at which the text selection originates.
147 * @extent: the position at which the text selection terminates.
148 *
149 * Sets the text selection of this node.
150 */
151 void fl_accessible_node_set_text_selection(FlAccessibleNode* node,
152 gint base,
153 gint extent);
154
155 /**
156 * fl_accessible_node_set_text_direction:
157 * @node: an #FlAccessibleNode.
158 * @direction: the direction of the text.
159 *
160 * Sets the text direction of this node.
161 */
162 void fl_accessible_node_set_text_direction(FlAccessibleNode* node,
163 FlutterTextDirection direction);
164
165 /**
166 * fl_accessible_node_dispatch_action:
167 * @node: an #FlAccessibleNode.
168 * @action: the action being dispatched.
169 * @data: (allow-none): data associated with the action.
170 *
171 * Performs a semantic action for this node.
172 */
173 void fl_accessible_node_perform_action(FlAccessibleNode* node,
174 FlutterSemanticsAction action,
175 GBytes* data);
176
177 G_END_DECLS
178
179 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBLE_NODE_H_
flags
FlutterSemanticsFlag flags
Definition: fl_accessible_node.cc:106
fl_accessible_node_perform_action
void fl_accessible_node_perform_action(FlAccessibleNode *node, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.cc:580
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:550
fl_accessible_node_set_text_selection
void fl_accessible_node_set_text_selection(FlAccessibleNode *node, gint base, gint extent)
Definition: fl_accessible_node.cc:563
fl_accessible_node_new
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, int32_t id)
Definition: fl_accessible_node.cc:482
fl_accessible_node_set_flags
void fl_accessible_node_set_flags(FlAccessibleNode *node, FlutterSemanticsFlag flags)
Definition: fl_accessible_node.cc:543
fl_accessible_node_set_children
void fl_accessible_node_set_children(FlAccessibleNode *node, GPtrArray *children)
Definition: fl_accessible_node.cc:499
fl_accessible_node_set_value
void fl_accessible_node_set_value(FlAccessibleNode *node, const gchar *value)
Definition: fl_accessible_node.cc:557
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:532
fl_accessible_node_set_name
void fl_accessible_node_set_name(FlAccessibleNode *node, const gchar *name)
Definition: fl_accessible_node.cc:526
fl_accessible_node_set_text_direction
void fl_accessible_node_set_text_direction(FlAccessibleNode *node, FlutterTextDirection direction)
Definition: fl_accessible_node.cc:572
fl_accessible_node_set_parent
void fl_accessible_node_set_parent(FlAccessibleNode *node, AtkObject *parent, gint index)
Definition: fl_accessible_node.cc:488
FL
FL
Definition: fl_binary_messenger.cc:27
fl_engine.h
height
const uint8_t uint32_t uint32_t * height
Definition: fl_pixel_buffer_texture_test.cc:39
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
_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::set_flags
void(* set_flags)(FlAccessibleNode *node, FlutterSemanticsFlag flags)
Definition: fl_accessible_node.h:43
_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