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 #import <Cocoa/Cocoa.h> 6 7 #import "FlutterEngine.h" 8 #import "FlutterMacros.h" 9 #import "FlutterPluginRegistrarMacOS.h" 10 11 /** 12 * Values for the `mouseTrackingMode` property. 13 */ 14 typedef NS_ENUM(NSInteger, FlutterMouseTrackingMode) { 15 // Hover events will never be sent to Flutter. 16 FlutterMouseTrackingModeNone = 0, 17 // Hover events will be sent to Flutter when the view is in the key window. 18 FlutterMouseTrackingModeInKeyWindow, 19 // Hover events will be sent to Flutter when the view is in the active app. 20 FlutterMouseTrackingModeInActiveApp, 21 // Hover events will be sent to Flutter regardless of window and app focus. 22 FlutterMouseTrackingModeAlways, 23 }; 24 25 /** 26 * Controls a view that displays Flutter content and manages input. 27 */ 28 FLUTTER_EXPORT 29 @interface FlutterViewController : NSViewController <FlutterPluginRegistry> 30 31 /** 32 * The Flutter engine associated with this view controller. 33 */ 34 @property(nonatomic, nonnull, readonly) FlutterEngine* engine; 35 36 /** 37 * The style of mouse tracking to use for the view. Defaults to 38 * FlutterMouseTrackingModeInKeyWindow. 39 */ 40 @property(nonatomic) FlutterMouseTrackingMode mouseTrackingMode; 41 42 /** 43 * Initializes a controller that will run the given project. 44 * 45 * @param project The project to run in this view controller. If nil, a default `FlutterDartProject` 46 * will be used. 47 */ 48 - (nonnull instancetype)initWithProject:(nullable FlutterDartProject*)project 49 NS_DESIGNATED_INITIALIZER; 50 51 - (nonnull instancetype)initWithNibName:(nullable NSString*)nibNameOrNil 52 bundle:(nullable NSBundle*)nibBundleOrNil 53 NS_DESIGNATED_INITIALIZER; 54 - (nonnull instancetype)initWithCoder:(nonnull NSCoder*)nibNameOrNil NS_DESIGNATED_INITIALIZER; 55 56 @end 57