• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright 2011 Google Inc.
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 #import <QuartzCore/QuartzCore.h>
10 #import <Cocoa/Cocoa.h>
11 #import "SkWindow.h"
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     BOOL fRedrawRequestPending;
24 
25     NSString* fTitle;
26     SkOSWindow* fWind;
27 #if SK_SUPPORT_GPU
28     NSOpenGLContext* fGLContext;
29 #endif
30     id<SkNSViewOptionsDelegate> fOptionsDelegate;
31 }
32 
33 @property (nonatomic, readonly) SkOSWindow *fWind;
34 @property (nonatomic, retain) NSString* fTitle;
35 #if SK_SUPPORT_GPU
36 @property (nonatomic, retain) NSOpenGLContext* fGLContext;
37 #endif
38 @property (nonatomic, assign) id<SkNSViewOptionsDelegate> fOptionsDelegate;
39 
40 - (id)initWithDefaults;
41 - (void)setUpWindow;
42 - (void)resizeSkView:(NSSize)newSize;
43 - (void)setSkTitle:(const char*)title;
44 - (void)onAddMenu:(const SkOSMenu*)menu;
45 - (void)onUpdateMenu:(const SkOSMenu*)menu;
46 - (void)postInvalWithRect:(const SkIRect*)rectOrNil;
47 - (BOOL)onHandleEvent:(const SkEvent&)event;
48 
49 - (bool)attach:(SkOSWindow::SkBackEndTypes)attachType withMSAASampleCount:(int) sampleCount andGetInfo:(SkOSWindow::AttachmentInfo*) info;
50 - (void)detach;
51 - (void)present;
52 
53 - (void)setVSync:(bool)enable;
54 
55 - (void)freeNativeWind;
56 
57 @end
58