jens@1: // jens@1: // GGBLayer.h jens@1: // GGB-iPhone jens@1: // jens@1: // Created by Jens Alfke on 3/7/08. jens@1: // Copyright 2008 __MyCompanyName__. All rights reserved. jens@1: // jens@1: jens@8: jens@8: #if TARGET_OS_IPHONE jens@1: #import jens@1: #else jens@1: #import jens@1: #endif jens@1: jens@1: jens@11: extern NSString* const GGBLayerStyleChangedNotification; jens@11: jens@11: jens@1: @interface GGBLayer : CALayer jens@7: { jens@7: CABasicAnimation *_curAnimation; jens@11: NSMutableDictionary *_styleDict; jens@1: jens@8: #if ! TARGET_OS_IPHONE jens@7: } jens@7: #else jens@1: // For some reason, the CALayer class on iPhone OS doesn't have these! jens@1: CGFloat _cornerRadius, _borderWidth; jens@1: CGColorRef _borderColor, _realBGColor; jens@1: unsigned int _autoresizingMask; jens@1: } jens@7: jens@1: @property CGFloat cornerRadius, borderWidth; jens@1: @property CGColorRef borderColor; jens@1: #endif jens@1: jens@4: - (void) redisplayAll; jens@4: jens@7: - (void) animateAndBlock: (NSString*)keyPath from: (id)from to: (id)to duration: (NSTimeInterval)duration; jens@7: jens@11: /** Change a property in this layer's 'style' dictionary (if it has one), jens@11: and update every other layer that shares the same style dictionary. */ jens@11: - (void) setValue: (id)value ofStyleProperty: (NSString*)prop; jens@11: jens@1: @end jens@9: jens@9: jens@9: /** Moves a layer from one superlayer to another, without changing its position onscreen. */ jens@9: void ChangeSuperlayer( CALayer *layer, CALayer *newSuperlayer, int index ); jens@9: jens@9: /** Removes a layer from its superlayer without any fade-out animation. */ jens@9: void RemoveImmediately( CALayer *layer ); jens@9: jens@9: /** Disables animations until EndDisableAnimations is called. */ jens@9: void BeginDisableAnimations(void); jens@9: void EndDisableAnimations(void); jens@10: jens@10: CGColorRef GetEffectiveBackground( CALayer *layer ); jens@10: