• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #import <QuartzCore/QuartzCore.h>
9 #import <Cocoa/Cocoa.h>
10 #import "SkWindow.h"
11 
12 class SkEvent;
13 @class SkNSView;
14 
15 @protocol SkNSViewOptionsDelegate <NSObject>
16 @optional
17 // Called when the view needs to handle adding an SkOSMenu
18 - (void) view:(SkNSView*)view didAddMenu:(const SkOSMenu*)menu;
19 - (void) view:(SkNSView*)view didUpdateMenu:(const SkOSMenu*)menu;
20 @end
21 
22 @interface SkNSView : NSView
23 @property (nonatomic, retain) NSString* fTitle;
24 #if SK_SUPPORT_GPU
25 @property (nonatomic, retain) NSOpenGLContext* fGLContext;
26 #endif
27 @property (nonatomic, assign) id<SkNSViewOptionsDelegate> fOptionsDelegate;
28 
29 - (id)initWithDefaults;
30 - (void)setUpWindow;
31 - (void)resizeSkView:(NSSize)newSize;
32 - (void)setSkTitle:(const char*)title;
33 - (void)onAddMenu:(const SkOSMenu*)menu;
34 - (void)onUpdateMenu:(const SkOSMenu*)menu;
35 - (void)postInvalWithRect:(const SkIRect*)rectOrNil;
36 - (BOOL)onHandleEvent:(const SkEvent&)event;
37 
38 - (bool)attach:(SkOSWindow::SkBackEndTypes)attachType withMSAASampleCount:(int) sampleCount andGetInfo:(SkOSWindow::AttachmentInfo*) info;
39 - (void)detach;
40 - (void)present;
41 
42 - (void)setVSync:(bool)enable;
43 
44 - (void)freeNativeWind;
45 
46 @end
47 
48 @interface SkNSView()
49     @property (nonatomic, readwrite) SkOSWindow *fWind;
50 @end
51