| Flutter macOS Embedder |

FlutterMutatorView.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_FLUTTERMUTATORVIEW_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERMUTATORVIEW_H_
7
8 #import <Cocoa/Cocoa.h>
9 #include <vector>
10
11 #include "flutter/shell/platform/embedder/embedder.h"
12
13 namespace flutter {
14
15 /// Represents a platform view layer, including all mutations.
16 class PlatformViewLayer {
17 public:
18 /// Creates platform view from provided FlutterLayer, which must be
19 /// of type kFlutterLayerContentTypePlatformView.
20 explicit PlatformViewLayer(const FlutterLayer* _Nonnull layer);
21
22 PlatformViewLayer(FlutterPlatformViewIdentifier identifier,
23 const std::vector<FlutterPlatformViewMutation>& mutations,
24 FlutterPoint offset,
25 FlutterSize size);
26
27 FlutterPlatformViewIdentifier identifier() const { return identifier_; }
28 const std::vector<FlutterPlatformViewMutation>& mutations() const { return mutations_; }
29 FlutterPoint offset() const { return offset_; }
30 FlutterSize size() const { return size_; }
31
32 private:
33 FlutterPlatformViewIdentifier identifier_;
34 std::vector<FlutterPlatformViewMutation> mutations_;
35 FlutterPoint offset_;
36 FlutterSize size_;
37 };
38 } // namespace flutter
39
40 @class FlutterView;
41 @class FlutterMutatorView;
42
43 /// FlutterCursorCoordinator is responsible for coordinating cursor changes between
44 /// platform views and overlays of single FlutterView.
45 @interface FlutterCursorCoordinator : NSObject
46
47 - (nonnull FlutterCursorCoordinator*)initWithFlutterView:(nonnull FlutterView*)flutterView;
48
49 @end
50
51 /// Exposed methods for testing.
52 @interface FlutterCursorCoordinator (Private)
53
54 @property(readonly, nonatomic) BOOL cleanupScheduled;
55
56 - (void)processMouseMoveEvent:(nonnull NSEvent*)event
57 forMutatorView:(nonnull FlutterMutatorView*)view
58 overlayRegion:(const std::vector<CGRect>&)region;
59 @end
60
61 /// FlutterMutatorView contains platform view and is responsible for applying
62 /// FlutterLayer mutations to it.
63 @interface FlutterMutatorView : NSView
64
65 /// Designated initializer.
66 - (nonnull instancetype)initWithPlatformView:(nonnull NSView*)platformView
67 cursorCoordiator:(nullable FlutterCursorCoordinator*)coordinator;
68
69 - (nonnull instancetype)initWithPlatformView:(nonnull NSView*)platformView;
70
71 /// Returns wrapped platform view.
72 @property(readonly, nonnull) NSView* platformView;
73
74 /// Applies mutations from FlutterLayer to the platform view. This may involve
75 /// creating or removing intermediate subviews depending on current state and
76 /// requested mutations.
77 - (void)applyFlutterLayer:(nonnull const flutter::PlatformViewLayer*)layer;
78
79 /// Resets hit hit testing region for this mutator view.
80 - (void)resetHitTestRegion;
81
82 /// Adds rectangle (in local vie coordinates) to hit test ignore region
83 /// (part of view obscured by Flutter contents).
84 - (void)addHitTestIgnoreRegion:(CGRect)region;
85
86 @end
87
88 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERMUTATORVIEW_H_
FlutterCursorCoordinator(Private)
Exposed methods for testing.
Definition: FlutterMutatorView.h:52
flutter::PlatformViewLayer
Represents a platform view layer, including all mutations.
Definition: FlutterMutatorView.h:16
flutter::PlatformViewLayer::mutations
const std::vector< FlutterPlatformViewMutation > & mutations() const
Definition: FlutterMutatorView.h:28
flutter::PlatformViewLayer::PlatformViewLayer
PlatformViewLayer(const FlutterLayer *_Nonnull layer)
flutter::PlatformViewLayer::size
FlutterSize size() const
Definition: FlutterMutatorView.h:30
flutter::PlatformViewLayer::identifier
FlutterPlatformViewIdentifier identifier() const
Definition: FlutterMutatorView.h:27
flutter::PlatformViewLayer::offset
FlutterPoint offset() const
Definition: FlutterMutatorView.h:29
FlutterCursorCoordinator
Definition: FlutterMutatorView.h:46
FlutterMutatorView
Definition: FlutterMutatorView.h:64
FlutterMutatorView::platformView
NSView * platformView
Returns wrapped platform view.
Definition: FlutterMutatorView.h:72
-[FlutterMutatorView resetHitTestRegion]
void resetHitTestRegion()
Resets hit hit testing region for this mutator view.
Definition: FlutterMutatorView.mm:526
FlutterView
Definition: FlutterView.h:36
flutter
Definition: AccessibilityBridgeMac.h:16