Flutter Engine
The Flutter Engine
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
13namespace flutter {
14
15/// Represents a platform view layer, including all mutations.
16class 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
23 const std::vector<FlutterPlatformViewMutation>& mutations,
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:
34 std::vector<FlutterPlatformViewMutation> mutations_;
35 FlutterPoint offset_;
37};
38} // namespace flutter
39
40@class FlutterView;
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.
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_
Exposed methods for testing.
PlatformViewLayer(const FlutterLayer *_Nonnull layer)
PlatformViewLayer(const SkPoint &offset, const SkSize &size, int64_t view_id)
const std::vector< FlutterPlatformViewMutation > & mutations() const
FlutterPlatformViewIdentifier identifier() const
FlutterPoint offset() const
int64_t FlutterPlatformViewIdentifier
Definition: embedder.h:1188
NSView * platformView
Returns wrapped platform view.
void resetHitTestRegion()
Resets hit hit testing region for this mutator view.
Definition: ref_ptr.h:256
A structure to represent a 2D point.
Definition: embedder.h:445
A structure to represent the width and height.
Definition: embedder.h:423
int BOOL
Definition: windows_types.h:37