//
//  RadioBtn.m
//  StuntPuppy
//
//  Created by Victor Johnson on 7/14/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "RadioBtn.h"


@implementation RadioBtn

@synthesize btn_off, btn_on;

-(void) initBtn {	
	btn_off = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,25,25)];
	btn_off.image = [UIImage imageNamed:@"btn_off.png"];
	btn_off.center = CGPointMake(25,25);
	btn_off.hidden = NO;
	btn_off.alpha = 1;
	[self addSubview:btn_off];
	
	btn_on = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,15,14)];
	btn_on.image = [UIImage imageNamed:@"btn_on.png"];
	btn_on.center = CGPointMake(25,25);
	btn_on.hidden = YES;
	btn_on.alpha = 1;
	[self addSubview:btn_on];
	
	
}
-(void) btnOn {
	btn_on.hidden = NO;
	
	//start animation block
	
	[UIView beginAnimations:nil context:nil];
//	[UIView setAnimationDelay:.1];
	[UIView setAnimationDuration:.05];
	
	self.transform = CGAffineTransformMakeScale(1.5, 1.5);
	
	//the selector only works if you set the delegate here
	[UIView setAnimationDidStopSelector:@selector(btnOn2)];
	[UIView setAnimationDelegate:self];
	[UIView commitAnimations];
}

-(void) btnOn2 {
	//start animation block
	
	[UIView beginAnimations:nil context:nil];
//	[UIView setAnimationDelay:.1];
	[UIView setAnimationDuration:.05];
	
	self.transform = CGAffineTransformMakeScale(1, 1);
	
	[UIView commitAnimations];
}

-(void) btnOff {
	btn_on.hidden = YES;
}

-(BOOL) btnTouched {
	if (btn_on.hidden){
		return FALSE;
	}
	else {
		return TRUE;
	}
}

-(void) dealloc {
	[btn_off release];
	[btn_on release];
	[super dealloc];
}

@end
