1.1 --- a/Source/GGBLayer.m Wed May 28 12:47:10 2008 -0700
1.2 +++ b/Source/GGBLayer.m Thu May 29 15:04:06 2008 -0700
1.3 @@ -116,6 +116,7 @@
1.4
1.5 - (CGFloat) cornerRadius {return _cornerRadius;}
1.6 - (CGFloat) borderWidth {return _borderWidth;}
1.7 +- (CGColorRef) backgroundColor {return _realBGColor;}
1.8 - (CGColorRef) borderColor {return _borderColor;}
1.9
1.10 - (void) setCornerRadius: (CGFloat)r
1.11 @@ -236,3 +237,54 @@
1.12
1.13
1.14 @end
1.15 +
1.16 +
1.17 +
1.18 +#pragma mark -
1.19 +#pragma mark UTILITIES:
1.20 +
1.21 +
1.22 +void BeginDisableAnimations(void)
1.23 +{
1.24 + [CATransaction begin];
1.25 + [CATransaction setValue:(id)kCFBooleanTrue
1.26 + forKey:kCATransactionDisableActions];
1.27 +}
1.28 +
1.29 +void EndDisableAnimations(void)
1.30 +{
1.31 + [CATransaction commit];
1.32 +}
1.33 +
1.34 +
1.35 +void ChangeSuperlayer( CALayer *layer, CALayer *newSuperlayer, int index )
1.36 +{
1.37 + // Disable actions, else the layer will move to the wrong place and then back!
1.38 + [CATransaction flush];
1.39 + BeginDisableAnimations();
1.40 +
1.41 + CGPoint pos = layer.position;
1.42 + if( layer.superlayer )
1.43 + pos = [newSuperlayer convertPoint: pos fromLayer: layer.superlayer];
1.44 + [layer retain];
1.45 + [layer removeFromSuperlayer];
1.46 + layer.position = pos;
1.47 + if( index >= 0 )
1.48 + [newSuperlayer insertSublayer: layer atIndex: index];
1.49 + else
1.50 + [newSuperlayer addSublayer: layer];
1.51 + [layer release];
1.52 +
1.53 + EndDisableAnimations();
1.54 +}
1.55 +
1.56 +
1.57 +void RemoveImmediately( CALayer *layer )
1.58 +{
1.59 + [CATransaction flush];
1.60 + BeginDisableAnimations();
1.61 + [layer removeFromSuperlayer];
1.62 + EndDisableAnimations();
1.63 +}
1.64 +
1.65 +