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