#import "SliderTableCell.h"

@implementation SliderTableCell

@synthesize label;
@synthesize slider;

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
	self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier];
	if (self) {
		label = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 2.0, 150.0, 40.0)];
    label.backgroundColor = [UIColor clearColor];
		[[self contentView] addSubview:label];
		self.selectionStyle = UITableViewCellSelectionStyleNone;

		slider = [[UISlider alloc] initWithFrame:CGRectMake(20.0, 25.0, 260.0, 40.0)];
		slider.continuous = NO;
		slider.maximumValue = 100.0;
		slider.minimumValue = 0.0;
		[slider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
		[[self contentView] addSubview:slider];

		self.selectionStyle = UITableViewCellSelectionStyleNone;		
	}
	return self;
}

- (void)sliderChanged:(UISlider*)control {
	[[NSNotificationCenter defaultCenter] postNotificationName:@"sliderChanged" object:control];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
	[super setSelected:selected animated:animated];
}

@end
