blob: 76d660daa0e1a155492c9b10e48ec7c12733945e [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"
18#include "SkiOSDeviceManager.h"
19class SkOSWindow;
20class SkEvent;
21struct FPSState;
yangsu@google.com59870452011-08-02 13:20:22 +000022@class SkUIView;
23
24@protocol SkUIViewOptionsDelegate <NSObject>
25@optional
26// Called when the view needs to handle adding an SkOSMenu
27- (void) view:(SkUIView*)view didAddMenu:(const SkOSMenu*)menu;
28- (void) view:(SkUIView*)view didUpdateMenu:(const SkOSMenu*)menu;
29@end
30
31@interface SkUIView : UIView {
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000032 BOOL fRedrawRequestPending;
yangsu@google.com59870452011-08-02 13:20:22 +000033
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000034 struct {
35 EAGLContext* fContext;
36 GLuint fRenderbuffer;
37 GLuint fStencilbuffer;
38 GLuint fFramebuffer;
39 GLint fWidth;
40 GLint fHeight;
41 } fGL;
yangsu@google.com2ba30c02011-07-19 15:17:44 +000042
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000043 NSString* fTitle;
44 UINavigationItem* fTitleItem;
yangsu@google.com2ba30c02011-07-19 15:17:44 +000045 CALayer* fRasterLayer;
46 CAEAGLLayer* fGLLayer;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000047
yangsu@google.com59870452011-08-02 13:20:22 +000048 FPSState* fFPSState;
49 SkOSWindow* fWind;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000050 SkiOSDeviceManager* fDevManager;
yangsu@google.com59870452011-08-02 13:20:22 +000051
52 id<SkUIViewOptionsDelegate> fOptionsDelegate;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000053}
54
yangsu@google.com59870452011-08-02 13:20:22 +000055@property (nonatomic, readonly) SkOSWindow *fWind;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000056@property (nonatomic, retain) UINavigationItem* fTitleItem;
57@property (nonatomic, copy) NSString* fTitle;
yangsu@google.com2ba30c02011-07-19 15:17:44 +000058@property (nonatomic, retain) CALayer* fRasterLayer;
59@property (nonatomic, retain) CAEAGLLayer* fGLLayer;
yangsu@google.com59870452011-08-02 13:20:22 +000060@property (nonatomic, assign) id<SkUIViewOptionsDelegate> fOptionsDelegate;
yangsu@google.com2ba30c02011-07-19 15:17:44 +000061
62- (void)forceRedraw;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000063
64- (void)setSkTitle:(const char*)title;
yangsu@google.com59870452011-08-02 13:20:22 +000065- (void)onAddMenu:(const SkOSMenu*)menu;
66- (void)onUpdateMenu:(const SkOSMenu*)menu;
yangsu@google.comc5aeccd2011-07-17 14:42:08 +000067- (void)postInvalWithRect:(const SkIRect*)rectOrNil;
68- (BOOL)onHandleEvent:(const SkEvent&)event;
yangsu@google.com59870452011-08-02 13:20:22 +000069@end