| 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
8 #import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterViewController.h"
9
10 #include <memory>
11
12 #import "flutter/shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMac.h"
13 #import "flutter/shell/platform/darwin/macos/framework/Source/FlutterKeyboardViewDelegate.h"
14 #import "flutter/shell/platform/darwin/macos/framework/Source/FlutterTextInputPlugin.h"
15 #import "flutter/shell/platform/darwin/macos/framework/Source/FlutterView.h"
16
17 @interface FlutterViewController () <FlutterKeyboardViewDelegate>
18
19 /**
20 * The identifier for this view controller.
21 *
22 * The ID is assigned by FlutterEngine when the view controller is attached.
23 *
24 * If the view controller is unattached (see FlutterViewController#attached),
25 * reading this property throws an assertion.
26 */
27 @property(nonatomic, readonly) FlutterViewId viewId;
28
29 // The FlutterView for this view controller.
30 @property(nonatomic, readonly, nullable) FlutterView* flutterView;
31
32 /**
33 * The text input plugin that handles text editing state for text fields.
34 */
35 @property(nonatomic, readonly, nonnull) FlutterTextInputPlugin* textInputPlugin;
36
37 @property(nonatomic, readonly) std::weak_ptr<flutter::AccessibilityBridgeMac> accessibilityBridge;
38
39 /**
40 * Returns YES if provided event is being currently redispatched by keyboard manager.
41 */
42 - (BOOL)isDispatchingKeyEvent:(nonnull NSEvent*)event;
43
44 /**
45 * Set up the controller with `engine` and `id`, and other engine-level classes.
46 *
47 * This method is called by FlutterEngine. A view controller must be set up
48 * before being used, and must be set up only once until detachFromEngine:.
49 */
50 - (void)setUpWithEngine:(nonnull FlutterEngine*)engine
51 viewId:(FlutterViewId)viewId
52 threadSynchronizer:(nonnull FlutterThreadSynchronizer*)threadSynchronizer;
53
54 /**
55 * Reset the `engine` and `id` of this controller.
56 *
57 * This method is called by FlutterEngine.
58 */
59 - (void)detachFromEngine;
60
61 /**
62 * Called by the associated FlutterEngine when FlutterEngine#semanticsEnabled
63 * has changed.
64 */
65 - (void)notifySemanticsEnabledChanged;
66
67 /**
68 * Notify from the framework that the semantics for this view needs to be
69 * updated.
70 */
71 - (void)updateSemantics:(nonnull const FlutterSemanticsUpdate2*)update;
72
73 @end
74
75 // Private methods made visible for testing
76 @interface FlutterViewController (TestMethods)
77 - (void)onAccessibilityStatusChanged:(BOOL)enabled;
78
79 /* Creates an accessibility bridge with the provided parameters.
80 *
81 * By default this method calls AccessibilityBridgeMac's initializer. Exposing
82 * this method allows unit tests to override.
83 */
84 - (std::shared_ptr<flutter::AccessibilityBridgeMac>)createAccessibilityBridgeWithEngine:
85 (nonnull FlutterEngine*)engine;
86
87 - (nonnull FlutterView*)createFlutterViewWithMTLDevice:(nonnull id<MTLDevice>)device
88 commandQueue:(nonnull id<MTLCommandQueue>)commandQueue;
89
90 @end
91
92 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERVIEWCONTROLLER_INTERNAL_H_
FlutterEngine
Definition: FlutterEngine.h:30
FlutterKeyboardViewDelegate-p
Definition: FlutterKeyboardViewDelegate.h:42
FlutterViewController
Definition: FlutterViewController.h:65
FlutterKeyboardViewDelegate.h
FlutterTextInputPlugin.h
AccessibilityBridgeMac.h
FlutterViewController(TestMethods)
Definition: FlutterViewController_Internal.h:76
FlutterThreadSynchronizer
Definition: FlutterThreadSynchronizer.h:16
FlutterTextInputPlugin
Definition: FlutterTextInputPlugin.h:27
FlutterView
Definition: FlutterView.h:48
FlutterView.h
FlutterViewController.h
FlutterViewId
int64_t FlutterViewId
Definition: FlutterView.h:15