Source/GGBLayer.h
author Jens Alfke <jens@mooseyard.com>
Wed Jul 09 17:07:45 2008 -0700 (2008-07-09)
changeset 15 73f8c889f053
parent 11 436cbdf56810
child 16 28392c9a969f
permissions -rw-r--r--
More tweaks, including a "reversed" property for Grids to show the second player's perspective without turning the pieces upside-down.
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@15
    46
- (CATransform3D) aggregateTransform;
jens@15
    47
jens@1
    48
@end
jens@9
    49
jens@9
    50
jens@9
    51
/** Moves a layer from one superlayer to another, without changing its position onscreen. */
jens@9
    52
void ChangeSuperlayer( CALayer *layer, CALayer *newSuperlayer, int index );
jens@9
    53
jens@9
    54
/** Removes a layer from its superlayer without any fade-out animation. */
jens@9
    55
void RemoveImmediately( CALayer *layer );
jens@9
    56
jens@9
    57
/** Disables animations until EndDisableAnimations is called. */
jens@9
    58
void BeginDisableAnimations(void);
jens@9
    59
void EndDisableAnimations(void);
jens@10
    60
jens@10
    61
CGColorRef GetEffectiveBackground( CALayer *layer );
jens@10
    62
jens@15
    63
NSString* StringFromTransform3D( CATransform3D xform );