//
//  PreferencesController.m
//  Clock-Game
//
//  Created by Ashley on 06/11/2006.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//

#import "PreferencesController.h"


@implementation PreferencesController

- (id)initWithController:(id)controller
{
	NSLog(@"PreferencesController --- init");
	[NSBundle loadNibNamed:@"Preferences" owner:self];
	[super initWithWindow:preferencesPanel];
	
	_controller = controller;

    return self;
}

- (IBAction) dismiss:(id)sender
{
	NSLog(@"PreferencesController -- dismiss:(id)sender");
	[[self window] close];

}

- (IBAction) popUpHasChanged:(id)sender
{
	NSLog(@"PreferencesController -- popUpHasChanged:(id)sender");
	int index = [sender indexOfSelectedItem];
	printf("Index = %d\n", index);
	if (index>=0) {
		[[[self controller] game] setLevel:(index+ 1 )];
	}
}

- (id) controller
{
	return _controller;
}

@end
