| 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 /// FlutterMutatorView contains platform view and is responsible for applying
41 /// FlutterLayer mutations to it.
42 @interface FlutterMutatorView : NSView
43
44 /// Designated initializer.
45 - (nonnull instancetype)initWithPlatformView:(nonnull NSView*)platformView;
46
47 /// Returns wrapped platform view.
48 @property(readonly, nonnull) NSView* platformView;
49
50 /// Applies mutations from FlutterLayer to the platform view. This may involve
51 /// creating or removing intermediate subviews depending on current state and
52 /// requested mutations.
53 - (void)applyFlutterLayer:(nonnull const flutter::PlatformViewLayer*)layer;
54
55 @end
56
57 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERMUTATORVIEW_H_
FlutterMutatorView
Definition: FlutterMutatorView.h:42
flutter::PlatformViewLayer::size
FlutterSize size() const
Definition: FlutterMutatorView.h:30
FlutterMutatorView::platformView
NSView * platformView
Returns wrapped platform view.
Definition: FlutterMutatorView.h:48
flutter::PlatformViewLayer::offset
FlutterPoint offset() const
Definition: FlutterMutatorView.h:29
flutter::PlatformViewLayer::identifier
FlutterPlatformViewIdentifier identifier() const
Definition: FlutterMutatorView.h:27
flutter
Definition: AccessibilityBridgeMac.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
Represents a platform view layer, including all mutations.
Definition: FlutterMutatorView.h:16