Flutter macOS Embedder
FlutterViewController_Internal.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_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERVIEWCONTROLLER_INTERNAL_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERVIEWCONTROLLER_INTERNAL_H_
7 
9 
10 #include <memory>
11 
15 
16 @interface FlutterViewController ()
17 
18 // The FlutterView for this view controller.
19 @property(nonatomic, readonly, nullable) FlutterView* flutterView;
20 
21 @property(nonatomic, readonly) std::weak_ptr<flutter::AccessibilityBridgeMac> accessibilityBridge;
22 
23 /**
24  * Returns YES if provided event is being currently redispatched by keyboard manager.
25  */
26 - (BOOL)isDispatchingKeyEvent:(nonnull NSEvent*)event;
27 
28 /**
29  * Set up the controller with `engine` and `id`, and other engine-level classes.
30  *
31  * This method is called by FlutterEngine. A view controller must be set up
32  * before being used, and must be set up only once until detachFromEngine:.
33  */
34 - (void)setUpWithEngine:(nonnull FlutterEngine*)engine
35  viewIdentifier:(FlutterViewIdentifier)viewIdentifier;
36 
37 /**
38  * Reset the `engine` and `id` of this controller.
39  *
40  * This method is called by FlutterEngine.
41  */
42 - (void)detachFromEngine;
43 
44 /**
45  * Called by the associated FlutterEngine when FlutterEngine#semanticsEnabled
46  * has changed.
47  */
48 - (void)notifySemanticsEnabledChanged;
49 
50 /**
51  * Notify from the framework that the semantics for this view needs to be
52  * updated.
53  */
54 - (void)updateSemantics:(nonnull const FlutterSemanticsUpdate2*)update;
55 
56 @end
57 
58 // Private methods made visible for testing
60 - (void)onAccessibilityStatusChanged:(BOOL)enabled;
61 
62 /* Creates an accessibility bridge with the provided parameters.
63  *
64  * By default this method calls AccessibilityBridgeMac's initializer. Exposing
65  * this method allows unit tests to override.
66  */
67 - (std::shared_ptr<flutter::AccessibilityBridgeMac>)createAccessibilityBridgeWithEngine:
68  (nonnull FlutterEngine*)engine;
69 
70 - (nonnull FlutterView*)createFlutterViewWithMTLDevice:(nonnull id<MTLDevice>)device
71  commandQueue:(nonnull id<MTLCommandQueue>)commandQueue;
72 
73 @end
74 
75 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERVIEWCONTROLLER_INTERNAL_H_
int64_t FlutterViewIdentifier