Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
14G_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)
19G_DEFINE_AUTOPTR_CLEANUP_FUNC(AtkObject, g_object_unref)
20#endif
21
22#define FL_TYPE_ACCESSIBLE_NODE fl_accessible_node_get_type()
23G_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,
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 */
66FlAccessibleNode* 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 */
76void 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 */
87void 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 */
97void 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 */
109void 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 */
122void fl_accessible_node_set_flags(FlAccessibleNode* node,
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 */
132void 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 */
142void 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 */
152void 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 */
163void 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 */
174void fl_accessible_node_perform_action(FlAccessibleNode* node,
176 GBytes* data);
177
178G_END_DECLS
179
180#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_ACCESSIBLE_NODE_H_
FlutterSemanticsAction
Definition embedder.h:113
FlutterTextDirection
Definition embedder.h:246
FlutterSemanticsFlag
Definition embedder.h:170
FlutterEngine engine
Definition main.cc:68
FlutterSemanticsFlag flags
void fl_accessible_node_perform_action(FlAccessibleNode *node, FlutterSemanticsAction action, GBytes *data)
void fl_accessible_node_set_actions(FlAccessibleNode *node, FlutterSemanticsAction actions)
G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode, fl_accessible_node, FL, ACCESSIBLE_NODE, AtkObject)
void fl_accessible_node_set_text_selection(FlAccessibleNode *node, gint base, gint extent)
void fl_accessible_node_set_flags(FlAccessibleNode *node, FlutterSemanticsFlag 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, int32_t id)
void fl_accessible_node_set_parent(FlAccessibleNode *node, AtkObject *parent, gint index)
uint8_t value
const char * name
Definition fuchsia.cc:50
double y
double x
int32_t height
int32_t width
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_flags)(FlAccessibleNode *node, FlutterSemanticsFlag flags)
void(* set_extents)(FlAccessibleNode *node, gint x, gint y, gint width, gint height)