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 #define FL_TYPE_ACCESSIBLE_NODE fl_accessible_node_get_type()
23 G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode,
24  fl_accessible_node,
25  FL,
26  ACCESSIBLE_NODE,
27  AtkObject);
28 
29 /**
30  * FlAccessibleNode:
31  *
32  * #FlAccessibleNode is an object that exposes a Flutter accessibility node to
33  * ATK.
34  */
36  AtkObjectClass parent_class;
37 
38  void (*set_name)(FlAccessibleNode* node, const gchar* name);
39  void (*set_extents)(FlAccessibleNode* node,
40  gint x,
41  gint y,
42  gint width,
43  gint height);
44  void (*set_flags)(FlAccessibleNode* node, FlutterSemanticsFlag flags);
45  void (*set_actions)(FlAccessibleNode* node, FlutterSemanticsAction actions);
46  void (*set_value)(FlAccessibleNode* node, const gchar* value);
47  void (*set_text_selection)(FlAccessibleNode* node, gint base, gint extent);
48  void (*set_text_direction)(FlAccessibleNode* node,
49  FlutterTextDirection direction);
50 
51  void (*perform_action)(FlAccessibleNode* node,
52  FlutterSemanticsAction action,
53  GBytes* data);
54 };
55 
56 /**
57  * fl_accessible_node_new:
58  * @engine: the #FlEngine this node came from.
59  * @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, int32_t id);
67 
68 /**
69  * fl_accessible_node_set_parent:
70  * @node: an #FlAccessibleNode.
71  * @parent: an #AtkObject.
72  * @index: the index of this node in the parent.
73  *
74  * Sets the parent of this node. The parent can be changed at any time.
75  */
76 void fl_accessible_node_set_parent(FlAccessibleNode* node,
77  AtkObject* parent,
78  gint index);
79 
80 /**
81  * fl_accessible_node_set_children:
82  * @node: an #FlAccessibleNode.
83  * @children: (transfer none) (element-type AtkObject): a list of #AtkObject.
84  *
85  * Sets the children of this node. The children can be changed at any time.
86  */
87 void fl_accessible_node_set_children(FlAccessibleNode* node,
88  GPtrArray* children);
89 
90 /**
91  * fl_accessible_node_set_name:
92  * @node: an #FlAccessibleNode.
93  * @name: a node name.
94  *
95  * Sets the name of this node as reported to the a11y consumer.
96  */
97 void fl_accessible_node_set_name(FlAccessibleNode* node, const gchar* name);
98 
99 /**
100  * fl_accessible_node_set_extents:
101  * @node: an #FlAccessibleNode.
102  * @x: x co-ordinate of this node relative to its parent.
103  * @y: y co-ordinate of this node relative to its parent.
104  * @width: width of this node in pixels.
105  * @height: height of this node in pixels.
106  *
107  * Sets the position and size of this node.
108  */
109 void fl_accessible_node_set_extents(FlAccessibleNode* node,
110  gint x,
111  gint y,
112  gint width,
113  gint height);
114 
115 /**
116  * fl_accessible_node_set_flags:
117  * @node: an #FlAccessibleNode.
118  * @flags: the flags for this node.
119  *
120  * Sets the flags for this node.
121  */
122 void fl_accessible_node_set_flags(FlAccessibleNode* node,
123  FlutterSemanticsFlag flags);
124 
125 /**
126  * fl_accessible_node_set_actions:
127  * @node: an #FlAccessibleNode.
128  * @actions: the actions this node can perform.
129  *
130  * Sets the actions that this node can perform.
131  */
132 void fl_accessible_node_set_actions(FlAccessibleNode* node,
133  FlutterSemanticsAction actions);
134 
135 /**
136  * fl_accessible_node_set_value:
137  * @node: an #FlAccessibleNode.
138  * @value: a node value.
139  *
140  * Sets the value of this node.
141  */
142 void fl_accessible_node_set_value(FlAccessibleNode* node, const gchar* value);
143 
144 /**
145  * fl_accessible_node_set_text_selection:
146  * @node: an #FlAccessibleNode.
147  * @base: the position at which the text selection originates.
148  * @extent: the position at which the text selection terminates.
149  *
150  * Sets the text selection of this node.
151  */
152 void fl_accessible_node_set_text_selection(FlAccessibleNode* node,
153  gint base,
154  gint extent);
155 
156 /**
157  * fl_accessible_node_set_text_direction:
158  * @node: an #FlAccessibleNode.
159  * @direction: the direction of the text.
160  *
161  * Sets the text direction of this node.
162  */
163 void fl_accessible_node_set_text_direction(FlAccessibleNode* node,
164  FlutterTextDirection direction);
165 
166 /**
167  * fl_accessible_node_dispatch_action:
168  * @node: an #FlAccessibleNode.
169  * @action: the action being dispatched.
170  * @data: (allow-none): data associated with the action.
171  *
172  * Performs a semantic action for this node.
173  */
174 void fl_accessible_node_perform_action(FlAccessibleNode* node,
175  FlutterSemanticsAction action,
176  GBytes* data);
177 
178 G_END_DECLS
179 
180 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBLE_NODE_H_
G_DECLARE_DERIVABLE_TYPE
G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode, fl_accessible_node, FL, ACCESSIBLE_NODE, AtkObject)
fl_accessible_node_perform_action
void fl_accessible_node_perform_action(FlAccessibleNode *node, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.cc:580
fl_accessible_node_set_text_direction
void fl_accessible_node_set_text_direction(FlAccessibleNode *node, FlutterTextDirection direction)
Definition: fl_accessible_node.cc:572
_FlAccessibleNodeClass::set_text_selection
void(* set_text_selection)(FlAccessibleNode *node, gint base, gint extent)
Definition: fl_accessible_node.h:47
_FlAccessibleNodeClass::set_extents
void(* set_extents)(FlAccessibleNode *node, gint x, gint y, gint width, gint height)
Definition: fl_accessible_node.h:39
_FlAccessibleNodeClass
Definition: fl_accessible_node.h:35
_FlAccessibleNodeClass::parent_class
AtkObjectClass parent_class
Definition: fl_accessible_node.h:36
fl_accessible_node_set_children
void fl_accessible_node_set_children(FlAccessibleNode *node, GPtrArray *children)
Definition: fl_accessible_node.cc:499
flags
FlutterSemanticsFlag flags
Definition: fl_accessible_node.cc:106
_FlAccessibleNodeClass::set_text_direction
void(* set_text_direction)(FlAccessibleNode *node, FlutterTextDirection direction)
Definition: fl_accessible_node.h:48
_FlAccessibleNodeClass::set_value
void(* set_value)(FlAccessibleNode *node, const gchar *value)
Definition: fl_accessible_node.h:46
height
G_BEGIN_DECLS int height
Definition: fl_backing_store_provider.h:37
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_new
FlAccessibleNode * fl_accessible_node_new(FlEngine *engine, int32_t id)
Definition: fl_accessible_node.cc:482
_FlAccessibleNodeClass::set_name
void(* set_name)(FlAccessibleNode *node, const gchar *name)
Definition: fl_accessible_node.h:38
_FlAccessibleNodeClass::perform_action
void(* perform_action)(FlAccessibleNode *node, FlutterSemanticsAction action, GBytes *data)
Definition: fl_accessible_node.h:51
FL
FL
Definition: fl_binary_messenger.cc:27
fl_accessible_node_set_parent
void fl_accessible_node_set_parent(FlAccessibleNode *node, AtkObject *parent, gint index)
Definition: fl_accessible_node.cc:488
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_engine.h
_FlAccessibleNodeClass::set_actions
void(* set_actions)(FlAccessibleNode *node, FlutterSemanticsAction actions)
Definition: fl_accessible_node.h:45
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_text_selection
void fl_accessible_node_set_text_selection(FlAccessibleNode *node, gint base, gint extent)
Definition: fl_accessible_node.cc:563
width
const uint8_t uint32_t * width
Definition: fl_pixel_buffer_texture_test.cc:38
_FlAccessibleNodeClass::set_flags
void(* set_flags)(FlAccessibleNode *node, FlutterSemanticsFlag flags)
Definition: fl_accessible_node.h:44
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_value
void fl_accessible_node_set_value(FlAccessibleNode *node, const gchar *value)
Definition: fl_accessible_node.cc:557
value
uint8_t value
Definition: fl_standard_message_codec.cc:36