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_LIB_UI_SEMANTICS_SEMANTICS_UPDATE_BUILDER_H_ |
6 | #define FLUTTER_LIB_UI_SEMANTICS_SEMANTICS_UPDATE_BUILDER_H_ |
7 | |
8 | #include "flutter/lib/ui/dart_wrapper.h" |
9 | #include "flutter/lib/ui/semantics/semantics_update.h" |
10 | #include "third_party/tonic/typed_data/typed_list.h" |
11 | |
12 | namespace flutter { |
13 | |
14 | class SemanticsUpdateBuilder |
15 | : public RefCountedDartWrappable<SemanticsUpdateBuilder> { |
16 | DEFINE_WRAPPERTYPEINFO(); |
17 | FML_FRIEND_MAKE_REF_COUNTED(SemanticsUpdateBuilder); |
18 | |
19 | public: |
20 | static fml::RefPtr<SemanticsUpdateBuilder> create() { |
21 | return fml::MakeRefCounted<SemanticsUpdateBuilder>(); |
22 | } |
23 | |
24 | ~SemanticsUpdateBuilder() override; |
25 | |
26 | void updateNode(int id, |
27 | int flags, |
28 | int actions, |
29 | int maxValueLength, |
30 | int currentValueLength, |
31 | int textSelectionBase, |
32 | int textSelectionExtent, |
33 | int platformViewId, |
34 | int scrollChildren, |
35 | int scrollIndex, |
36 | double scrollPosition, |
37 | double scrollExtentMax, |
38 | double scrollExtentMin, |
39 | double left, |
40 | double top, |
41 | double right, |
42 | double bottom, |
43 | double elevation, |
44 | double thickness, |
45 | std::string label, |
46 | std::string hint, |
47 | std::string value, |
48 | std::string increasedValue, |
49 | std::string decreasedValue, |
50 | int textDirection, |
51 | const tonic::Float64List& transform, |
52 | const tonic::Int32List& childrenInTraversalOrder, |
53 | const tonic::Int32List& childrenInHitTestOrder, |
54 | const tonic::Int32List& customAccessibilityActions); |
55 | |
56 | void updateCustomAction(int id, |
57 | std::string label, |
58 | std::string hint, |
59 | int overrideId); |
60 | |
61 | void build(Dart_Handle semantics_update_handle); |
62 | |
63 | static void RegisterNatives(tonic::DartLibraryNatives* natives); |
64 | |
65 | private: |
66 | explicit SemanticsUpdateBuilder(); |
67 | |
68 | SemanticsNodeUpdates nodes_; |
69 | CustomAccessibilityActionUpdates actions_; |
70 | }; |
71 | |
72 | } // namespace flutter |
73 | |
74 | #endif // FLUTTER_LIB_UI_SEMANTICS_SEMANTICS_UPDATE_BUILDER_H_ |
75 | |