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