/*
 * MyCALayer.j
 *
 * Created by Philippe Laval on 2009/03/24.
 * Copyright 2009 Philippe Laval. All rights reserved.
 */

@import <Foundation/CPObject.j>

@import <AppKit/CPView.j>
@import <AppKit/CALayer.j>
@import <AppKit/CPColor.j>
@import <AppKit/CPGraphicsContext.j>


@implementation MyCALayer : CALayer 
{ 
} 

- (id)init
{ 
	self = [super init]; 
	if (self) { 
	} 
	
	return self; 
} 

- (void)drawInContext:(CGContext)aContext 
{ 
	var bounds = [self bounds];
	
	CGContextSetFillColor(aContext, [CPColor grayColor]); 
	CGContextFillRect(aContext, bounds); 

	if (_backgroundColor) 
	{ 
		CGContextSetFillColor(aContext, _backgroundColor); 
		CGContextFillRect(aContext, CGRectInset(bounds, 10.0, 10.0)); 
	} 
	
	if ([[self delegate] respondsToSelector:@selector(drawLayer:inContext:)]) 
		[[self delegate] drawLayer:self inContext:aContext]; } 
} 


@end 