//----------------------------------------------------------------------------------------------------
//
//	DigitalClockInspector
//
//	Inherits From:		ClockInspector
//
//	Declared In:		DigitalClockInspector.h
//
//	Disclaimer
//
//		You may freely copy, distribute and reuse this software and its
//		associated documentation. I disclaim any warranty of any kind, 
//		expressed or implied, as to its fitness for any particular use.
//
//----------------------------------------------------------------------------------------------------
#import "DigitalClockInspector.h"
#import "DigitalClock.h"


@implementation DigitalClockInspector

//----------------------------------------------------------------------------------------------------
//	Private Methods
//----------------------------------------------------------------------------------------------------
+ (const char*) _nib
{
	return "DigitalClockInspector";
}


- _validateOptions
{
	if ([[options findCellWithTag: 0] state])
		{
		[[options findCellWithTag:1] setEnabled: YES];
		[[options findCellWithTag:4] setEnabled: YES];
		[[options findCellWithTag:5] setEnabled: YES];
		if ([[options findCellWithTag: 5] state])
			{
			[[options findCellWithTag:2] setEnabled: NO];
			[[options findCellWithTag:3] setEnabled: NO];
			}
		else
			{
			[[options findCellWithTag:2] setEnabled: YES];
			if ([[options findCellWithTag: 2] state])
				[[options findCellWithTag:3] setEnabled: YES];
			else
				[[options findCellWithTag:3] setEnabled: NO];
			}
		}
	else
		{
		[[options findCellWithTag:1] setEnabled: NO];
		[[options findCellWithTag:2] setEnabled: NO];
		[[options findCellWithTag:3] setEnabled: NO];
		[[options findCellWithTag:4] setEnabled: NO];
		[[options findCellWithTag:5] setEnabled: NO];
		}

	return self;
}
	

//----------------------------------------------------------------------------------------------------
//	Reverting Attributes
//----------------------------------------------------------------------------------------------------
- revertOptions
{
	[[options findCellWithTag:0] setState:[object isDisplayEnabled]];
	[[options findCellWithTag:1] setState:[object wantsSeconds]];
	[[options findCellWithTag: 2] setState:[object wantsDate]];
	[[options findCellWithTag: 3] setState:[object wantsYear]];
	[[options findCellWithTag: 4] setState:[object wantsMilitaryTime]];
	[[options findCellWithTag: 5] setState:[object style]];
	[[options findCellWithTag: 6] setState:[object isDraggable]];
	[[options findCellWithTag: 7] setState:[object willAcceptDrop]];
	[[options findCellWithTag: 8] setState:[object _timerMode]];
	[[options findCellWithTag: 9] setState:[object activateOnAwake]];
	[self _validateOptions];
	return self;
}


- revertDisplay
{
	[colorOrImage selectCellWithTag: [object _backgroundIsColor]];
	[backgroundImage image: [object backgroundImage]];
	[backgroundColor setColor: [object backgroundColor]];
	[timecolor setColor: [object timeColor]];
	[datecolor setColor: [object dateColor]];
	return self;
}
	

//----------------------------------------------------------------------------------------------------
//	Setting Attributes
//----------------------------------------------------------------------------------------------------
- setClockOptions: sender
{
	[object setDisplayEnabled: [[options findCellWithTag:0] state]];
	[object wantsSeconds: [[options findCellWithTag:1] state]];
	[object wantsDate: [[options findCellWithTag:2] state]];
	[object wantsYear: [[options findCellWithTag:3] state]];
	[object wantsMilitaryTime: [[options findCellWithTag:4] state]];
	[object style: [[options findCellWithTag:5] state]];
	[object isDraggable: [[options findCellWithTag:6] state]];
	[object willAcceptDrop: [[options findCellWithTag:7] state]];
	[object _timerMode: [[options findCellWithTag:8] state]];
	[object activateOnAwake: [[options findCellWithTag:9] state]];
	[self _validateOptions];
	return [self ok:nil];
}


- setTimeColor: sender
{
	[object timeColor: [sender color]];
	return [self ok:nil];
}
	

- setDateColor: sender
{
	[object dateColor: [sender color]];
	return [self ok:nil];
}
	
	
@end