//
//  MixerTest.m
//  iPhly
//
//  Created by Ari Krupnik on 10/4/11.
//  Copyright 2011 lib.aero. All rights reserved.
//

#import "MixerTest.h"
#import "MMSlider.h"

@implementation MixerTest

- (id)init {
    self = [super initWithStyle:UITableViewStyleGrouped];
    if (self) {
        [self setTitle:@"Mixer"];
        dataSource = [[ArrayTableDataSource alloc] init];
        NSMutableArray* sections = [NSMutableArray array];
        
        UITableSection* s = [[[UITableSection alloc]init]autorelease];
        [s setHeaderTitle:@"Vertical Input:"];
        NSMutableArray* cells = [NSMutableArray array];  //autorelease?
        UITableViewCell* c = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
        [c setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
        [[c textLabel] setText:@"Elevator"];
        [cells addObject:c];
        
        UISliderCell* sc=[[[UISliderCell alloc]initWithMin:0 andMax:1]autorelease];
        [sc setValue:0.8];
        [[sc leftLabel]setText:@"rate"];
        [cells addObject:sc];
        
        [s setCells:cells];
        [sections addObject:s];
        
        
        s = [[[UITableSection alloc]init]autorelease];
        [s setHeaderTitle:@"Horizontal Input:"];
        cells = [NSMutableArray array];  //autorelease?
        c = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
        [c setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
        [[c textLabel] setText:@"Aileron"];
        [cells addObject:c];
        
        sc=[[[UISliderCell alloc]initWithMin:0 andMax:1]autorelease];
        [sc setValue:0.3];
        [[sc leftLabel]setText:@"rate"];
        [cells addObject:sc];
        
        [s setCells:cells];
        [sections addObject:s];
        
        [dataSource setSections:sections];
        [[self tableView] setDataSource:dataSource];
    }
    return self;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
}
*/

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
