• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
8  * Listener for view resizing.
9  */
10 @protocol FlutterViewReshapeListener <NSObject>
11 /**
12  * Called when the view's backing store changes size.
13  */
14 - (void)viewDidReshape:(nonnull NSView*)view;
15 @end
16 
17 /**
18  * View capable of acting as a rendering target and input source for the Flutter
19  * engine.
20  */
21 @interface FlutterView : NSOpenGLView
22 
23 - (nullable instancetype)initWithFrame:(NSRect)frame
24                           shareContext:(nonnull NSOpenGLContext*)shareContext
25                        reshapeListener:(nonnull id<FlutterViewReshapeListener>)reshapeListener
26     NS_DESIGNATED_INITIALIZER;
27 
28 - (nullable instancetype)initWithShareContext:(nonnull NSOpenGLContext*)shareContext
29                               reshapeListener:
30                                   (nonnull id<FlutterViewReshapeListener>)reshapeListener;
31 
32 - (nullable instancetype)initWithFrame:(NSRect)frameRect
33                            pixelFormat:(nullable NSOpenGLPixelFormat*)format NS_UNAVAILABLE;
34 - (nonnull instancetype)initWithFrame:(NSRect)frameRect NS_UNAVAILABLE;
35 - (nullable instancetype)initWithCoder:(nonnull NSCoder*)coder NS_UNAVAILABLE;
36 - (nonnull instancetype)init NS_UNAVAILABLE;
37 
38 /**
39  * Sets this view as the current context object for OpenGL drawing.
40  */
41 - (void)makeCurrentContext;
42 
43 /**
44  * Called when the OpenGL display should be updated.
45  */
46 - (void)onPresent;
47 
48 @end
49