| epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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 | */ |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 8 | #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.com | 2ba30c0 | 2011-07-19 15:17:44 +0000 | [diff] [blame] | 13 | #import <QuartzCore/QuartzCore.h> |
| 14 | #import <UIKit/UIKit.h> |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 15 | #include "SkMatrix.h" |
| 16 | #include "FlingState.h" |
| 17 | #include "SampleApp.h" |
| 18 | #include "SkiOSDeviceManager.h" |
| 19 | class SkOSWindow; |
| 20 | class SkEvent; |
| 21 | struct FPSState; |
| yangsu@google.com | 5987045 | 2011-08-02 13:20:22 +0000 | [diff] [blame] | 22 | @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.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 32 | BOOL fRedrawRequestPending; |
| yangsu@google.com | 5987045 | 2011-08-02 13:20:22 +0000 | [diff] [blame] | 33 | |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 34 | struct { |
| 35 | EAGLContext* fContext; |
| 36 | GLuint fRenderbuffer; |
| 37 | GLuint fStencilbuffer; |
| 38 | GLuint fFramebuffer; |
| 39 | GLint fWidth; |
| 40 | GLint fHeight; |
| 41 | } fGL; |
| yangsu@google.com | 2ba30c0 | 2011-07-19 15:17:44 +0000 | [diff] [blame] | 42 | |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 43 | NSString* fTitle; |
| 44 | UINavigationItem* fTitleItem; |
| yangsu@google.com | 2ba30c0 | 2011-07-19 15:17:44 +0000 | [diff] [blame] | 45 | CALayer* fRasterLayer; |
| 46 | CAEAGLLayer* fGLLayer; |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 47 | |
| yangsu@google.com | 5987045 | 2011-08-02 13:20:22 +0000 | [diff] [blame] | 48 | FPSState* fFPSState; |
| 49 | SkOSWindow* fWind; |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 50 | SkiOSDeviceManager* fDevManager; |
| yangsu@google.com | 5987045 | 2011-08-02 13:20:22 +0000 | [diff] [blame] | 51 | |
| 52 | id<SkUIViewOptionsDelegate> fOptionsDelegate; |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 53 | } |
| 54 | |
| yangsu@google.com | 5987045 | 2011-08-02 13:20:22 +0000 | [diff] [blame] | 55 | @property (nonatomic, readonly) SkOSWindow *fWind; |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 56 | @property (nonatomic, retain) UINavigationItem* fTitleItem; |
| 57 | @property (nonatomic, copy) NSString* fTitle; |
| yangsu@google.com | 2ba30c0 | 2011-07-19 15:17:44 +0000 | [diff] [blame] | 58 | @property (nonatomic, retain) CALayer* fRasterLayer; |
| 59 | @property (nonatomic, retain) CAEAGLLayer* fGLLayer; |
| yangsu@google.com | 5987045 | 2011-08-02 13:20:22 +0000 | [diff] [blame] | 60 | @property (nonatomic, assign) id<SkUIViewOptionsDelegate> fOptionsDelegate; |
| yangsu@google.com | 2ba30c0 | 2011-07-19 15:17:44 +0000 | [diff] [blame] | 61 | |
| 62 | - (void)forceRedraw; |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 63 | |
| 64 | - (void)setSkTitle:(const char*)title; |
| yangsu@google.com | 5987045 | 2011-08-02 13:20:22 +0000 | [diff] [blame] | 65 | - (void)onAddMenu:(const SkOSMenu*)menu; |
| 66 | - (void)onUpdateMenu:(const SkOSMenu*)menu; |
| yangsu@google.com | c5aeccd | 2011-07-17 14:42:08 +0000 | [diff] [blame] | 67 | - (void)postInvalWithRect:(const SkIRect*)rectOrNil; |
| 68 | - (BOOL)onHandleEvent:(const SkEvent&)event; |
| yangsu@google.com | 5987045 | 2011-08-02 13:20:22 +0000 | [diff] [blame] | 69 | @end |