
#import "KenoCard.h"
#import "Keno.h"
#import "KenoCardView.h"

@implementation KenoCard

- awakeFromNib
{
	[ticketOwnerText setStringValue:""];
    [numGamesText setStringValue:"1"];
	
	[Dealer() selectCellWithTag:3 forPopUpButton:pricePerGameButton];
	[self changeTicketPrice:self];
	
	return self;
}

- changeTicketPrice:sender
{
	int newPrice;
	char buf[4];
	
	newPrice = [[[[pricePerGameButton target] itemList] selectedCell] tag] * [numGamesText intValue];
	
	sprintf(buf, "$%d", newPrice);
	[totalPriceText setStringValue:buf];
	
	return self;
}

- clearTicket:sender
{
    [numGamesText setStringValue:"1"];
	[Dealer() selectCellWithTag:3 forPopUpButton:pricePerGameButton];
	[self changeTicketPrice:self];
	[cardView clearCells];
	
	return self;
}

- setOwner:aPlayer
{
	owner = aPlayer;
	[ticketOwnerText setStringValue:[owner playerName]];
	
	return self;
}

- submitTicket:sender
{
    return self;
}

- orderFront:sender
{
	return [window orderFront:self];
}

@end
