Source/GGBLayer.h
author Jens Alfke <jens@mooseyard.com>
Mon Jul 21 17:32:21 2008 -0700 (2008-07-21)
changeset 21 2eb229411d73
parent 15 73f8c889f053
child 22 4cb50131788f
permissions -rw-r--r--
* Added API to Stack for removing bits.
* GoGame correctly saves/restores number of captured pieces.
* Improved positioning of captured-piece Stacks in GoGame.
* New Go piece icons.
* Added "Warn" function to GGBUtils.
     1 //
     2 //  GGBLayer.h
     3 //  GGB-iPhone
     4 //
     5 //  Created by Jens Alfke on 3/7/08.
     6 //  Copyright 2008 __MyCompanyName__. All rights reserved.
     7 //
     8 
     9 
    10 #if TARGET_OS_IPHONE
    11 #import <QuartzCore/QuartzCore.h>
    12 #else
    13 #import <Quartz/Quartz.h>
    14 #endif
    15 
    16 
    17 extern NSString* const GGBLayerStyleChangedNotification;
    18 
    19 
    20 @interface GGBLayer : CALayer <NSCopying>
    21 {
    22     CABasicAnimation *_curAnimation;
    23     NSMutableDictionary *_styleDict;
    24 
    25 #if ! TARGET_OS_IPHONE
    26 }
    27 #else
    28 // For some reason, the CALayer class on iPhone OS doesn't have these!
    29     CGFloat _cornerRadius, _borderWidth;
    30     CGColorRef _borderColor, _realBGColor;
    31     unsigned int _autoresizingMask;
    32 }
    33 
    34 @property CGFloat cornerRadius, borderWidth;
    35 @property CGColorRef borderColor;
    36 #endif
    37 
    38 - (void) redisplayAll;
    39 
    40 - (void) animateAndBlock: (NSString*)keyPath from: (id)from to: (id)to duration: (NSTimeInterval)duration;
    41 
    42 /** Change a property in this layer's 'style' dictionary (if it has one),
    43     and update every other layer that shares the same style dictionary. */
    44 - (void) setValue: (id)value ofStyleProperty: (NSString*)prop;
    45 
    46 @end
    47 
    48 
    49 /** Moves a layer from one superlayer to another, without changing its position onscreen. */
    50 void ChangeSuperlayer( CALayer *layer, CALayer *newSuperlayer, int index );
    51 
    52 /** Removes a layer from its superlayer without any fade-out animation. */
    53 void RemoveImmediately( CALayer *layer );
    54 
    55 /** Disables animations until EndDisableAnimations is called. */
    56 void BeginDisableAnimations(void);
    57 void EndDisableAnimations(void);
    58 
    59 CGColorRef GetEffectiveBackground( CALayer *layer );