blob: 49f7e16082eac0e47d0defc08da5e129ff828dff [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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 */
yangsu@google.comc5aeccd2011-07-17 14:42:08 +00008#import <OpenGLES/EAGL.h>
9#import <OpenGLES/ES1/gl.h>
10#import <OpenGLES/ES1/glext.h>
11#import <OpenGLES/ES2/gl.h>
12#import <OpenGLES/ES2/glext.h>
yangsu@google.com2ba30c02011-07-19 15:17:44 +000013#import <QuartzCore/QuartzCore.h>
14#import <UIKit/UIKit.h>
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000015#include "SkMatrix.h"
16#include "FlingState.h"
17#include "SampleApp.h"
yangsu@google.comf3493f02011-08-08 15:12:05 +000018
19class SkiOSDeviceManager;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000020class SkOSWindow;
21class SkEvent;
22struct FPSState;
yangsu@google.com59870452011-08-02 13:20:22 +000023@class SkUIView;
24
25@protocol SkUIViewOptionsDelegate <NSObject>
26@optional
27// Called when the view needs to handle adding an SkOSMenu
28- (void) view:(SkUIView*)view didAddMenu:(const SkOSMenu*)menu;
29- (void) view:(SkUIView*)view didUpdateMenu:(const SkOSMenu*)menu;
30@end
31
32@interface SkUIView : UIView {
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000033 BOOL fRedrawRequestPending;
yangsu@google.comf3493f02011-08-08 15:12:05 +000034
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000035 struct {
36 EAGLContext* fContext;
37 GLuint fRenderbuffer;
38 GLuint fStencilbuffer;
39 GLuint fFramebuffer;
40 GLint fWidth;
41 GLint fHeight;
42 } fGL;
yangsu@google.com2ba30c02011-07-19 15:17:44 +000043
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000044 NSString* fTitle;
45 UINavigationItem* fTitleItem;
yangsu@google.com2ba30c02011-07-19 15:17:44 +000046 CALayer* fRasterLayer;
47 CAEAGLLayer* fGLLayer;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000048
yangsu@google.com59870452011-08-02 13:20:22 +000049 FPSState* fFPSState;
50 SkOSWindow* fWind;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000051 SkiOSDeviceManager* fDevManager;
yangsu@google.com59870452011-08-02 13:20:22 +000052
53 id<SkUIViewOptionsDelegate> fOptionsDelegate;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000054}
55
yangsu@google.com59870452011-08-02 13:20:22 +000056@property (nonatomic, readonly) SkOSWindow *fWind;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000057@property (nonatomic, retain) UINavigationItem* fTitleItem;
58@property (nonatomic, copy) NSString* fTitle;
yangsu@google.com2ba30c02011-07-19 15:17:44 +000059@property (nonatomic, retain) CALayer* fRasterLayer;
60@property (nonatomic, retain) CAEAGLLayer* fGLLayer;
yangsu@google.com59870452011-08-02 13:20:22 +000061@property (nonatomic, assign) id<SkUIViewOptionsDelegate> fOptionsDelegate;
yangsu@google.com2ba30c02011-07-19 15:17:44 +000062
63- (void)forceRedraw;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000064
65- (void)setSkTitle:(const char*)title;
yangsu@google.com59870452011-08-02 13:20:22 +000066- (void)onAddMenu:(const SkOSMenu*)menu;
67- (void)onUpdateMenu:(const SkOSMenu*)menu;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000068- (void)postInvalWithRect:(const SkIRect*)rectOrNil;
69- (BOOL)onHandleEvent:(const SkEvent&)event;
yangsu@google.com59870452011-08-02 13:20:22 +000070@end