Source/GGBLayer.h
author Jens Alfke <jens@mooseyard.com>
Thu Jul 31 20:01:26 2008 -0700 (2008-07-31)
changeset 24 db8640a38faf
parent 16 28392c9a969f
permissions -rw-r--r--
* Put the spots in the right place in 13x13 and 19x19 boards.
* Fixed some front/back layering issues in Grid.
     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 /** Send a message to all sublayers in my tree */
    47 - (void) makeSublayersPerformSelector: (SEL)selector withObject: (id)object;
    48 
    49 @property (readonly) CATransform3D aggregateTransform;
    50 
    51 /** Call this to notify all sublayers that their aggregate transform has changed. */
    52 - (void) changedTransform;
    53 
    54 /** Called to notify that a superlayer's transform has changed. */
    55 - (void) aggregateTransformChanged;
    56 
    57 @end
    58 
    59 
    60 /** Moves a layer from one superlayer to another, without changing its position onscreen. */
    61 void ChangeSuperlayer( CALayer *layer, CALayer *newSuperlayer, int index );
    62 
    63 /** Removes a layer from its superlayer without any fade-out animation. */
    64 void RemoveImmediately( CALayer *layer );
    65 
    66 /** Disables animations until EndDisableAnimations is called. */
    67 void BeginDisableAnimations(void);
    68 void EndDisableAnimations(void);
    69 
    70 CGColorRef GetEffectiveBackground( CALayer *layer );
    71 
    72 NSString* StringFromTransform3D( CATransform3D xform );