author | Jens Alfke <jens@mooseyard.com> |
Thu Jul 31 13:23:44 2008 -0700 (2008-07-31) | |
changeset 23 | efe5d4523a23 |
parent 16 | 28392c9a969f |
permissions | -rw-r--r-- |
jens@1 | 1 |
// |
jens@1 | 2 |
// GGBLayer.h |
jens@1 | 3 |
// GGB-iPhone |
jens@1 | 4 |
// |
jens@1 | 5 |
// Created by Jens Alfke on 3/7/08. |
jens@1 | 6 |
// Copyright 2008 __MyCompanyName__. All rights reserved. |
jens@1 | 7 |
// |
jens@1 | 8 |
|
jens@8 | 9 |
|
jens@8 | 10 |
#if TARGET_OS_IPHONE |
jens@1 | 11 |
#import <QuartzCore/QuartzCore.h> |
jens@1 | 12 |
#else |
jens@1 | 13 |
#import <Quartz/Quartz.h> |
jens@1 | 14 |
#endif |
jens@1 | 15 |
|
jens@1 | 16 |
|
jens@11 | 17 |
extern NSString* const GGBLayerStyleChangedNotification; |
jens@11 | 18 |
|
jens@11 | 19 |
|
jens@1 | 20 |
@interface GGBLayer : CALayer <NSCopying> |
jens@7 | 21 |
{ |
jens@7 | 22 |
CABasicAnimation *_curAnimation; |
jens@11 | 23 |
NSMutableDictionary *_styleDict; |
jens@1 | 24 |
|
jens@8 | 25 |
#if ! TARGET_OS_IPHONE |
jens@7 | 26 |
} |
jens@7 | 27 |
#else |
jens@1 | 28 |
// For some reason, the CALayer class on iPhone OS doesn't have these! |
jens@1 | 29 |
CGFloat _cornerRadius, _borderWidth; |
jens@1 | 30 |
CGColorRef _borderColor, _realBGColor; |
jens@1 | 31 |
unsigned int _autoresizingMask; |
jens@1 | 32 |
} |
jens@7 | 33 |
|
jens@1 | 34 |
@property CGFloat cornerRadius, borderWidth; |
jens@1 | 35 |
@property CGColorRef borderColor; |
jens@1 | 36 |
#endif |
jens@1 | 37 |
|
jens@4 | 38 |
- (void) redisplayAll; |
jens@4 | 39 |
|
jens@7 | 40 |
- (void) animateAndBlock: (NSString*)keyPath from: (id)from to: (id)to duration: (NSTimeInterval)duration; |
jens@7 | 41 |
|
jens@11 | 42 |
/** Change a property in this layer's 'style' dictionary (if it has one), |
jens@11 | 43 |
and update every other layer that shares the same style dictionary. */ |
jens@11 | 44 |
- (void) setValue: (id)value ofStyleProperty: (NSString*)prop; |
jens@11 | 45 |
|
jens@22 | 46 |
/** Send a message to all sublayers in my tree */ |
jens@22 | 47 |
- (void) makeSublayersPerformSelector: (SEL)selector withObject: (id)object; |
jens@22 | 48 |
|
jens@22 | 49 |
@property (readonly) CATransform3D aggregateTransform; |
jens@22 | 50 |
|
jens@22 | 51 |
/** Call this to notify all sublayers that their aggregate transform has changed. */ |
jens@22 | 52 |
- (void) changedTransform; |
jens@22 | 53 |
|
jens@22 | 54 |
/** Called to notify that a superlayer's transform has changed. */ |
jens@22 | 55 |
- (void) aggregateTransformChanged; |
jens@22 | 56 |
|
jens@1 | 57 |
@end |
jens@9 | 58 |
|
jens@9 | 59 |
|
jens@9 | 60 |
/** Moves a layer from one superlayer to another, without changing its position onscreen. */ |
jens@9 | 61 |
void ChangeSuperlayer( CALayer *layer, CALayer *newSuperlayer, int index ); |
jens@9 | 62 |
|
jens@9 | 63 |
/** Removes a layer from its superlayer without any fade-out animation. */ |
jens@9 | 64 |
void RemoveImmediately( CALayer *layer ); |
jens@9 | 65 |
|
jens@9 | 66 |
/** Disables animations until EndDisableAnimations is called. */ |
jens@9 | 67 |
void BeginDisableAnimations(void); |
jens@9 | 68 |
void EndDisableAnimations(void); |
jens@10 | 69 |
|
jens@10 | 70 |
CGColorRef GetEffectiveBackground( CALayer *layer ); |
jens@22 | 71 |
|
jens@22 | 72 |
NSString* StringFromTransform3D( CATransform3D xform ); |