//
//	MiscTriStateInspector.m -- inspector class for the three state button
//		Written by Don Yacktman (c) 1993 by Don Yacktman.
//				Version 1.0.  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//		This is a free object!  Contact the author for the latest version.
//		Don Yacktman, 4279 N. Ivy Lane, Provo, UT, 84604
//		e-mail:  Don_Yacktman@byu.edu
//
//	This object is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	

#import "MiscTriStateInspector.h"
#import <appkit/appkit.h>
#import "MiscThreeStateButton.subproj/MiscThreeStateButtonCell.h"
#import "MiscThreeStateButton.subproj/MiscThreeStateButton.h"

@implementation MiscTriStateInspector

- init
{
    char buf[MAXPATHLEN + 1];
    id bundle;
    
    [super init];
    bundle = [NXBundle bundleForClass:[MiscThreeStateButton class]];
    [bundle getPath:buf forResource:"TriStateInspector" ofType:"nib"];
    [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
    return self;
}

- (BOOL)wantsButtons { return YES; }

- revert:sender
{
	// Put string in text object
	[thirdTitle setStringValue:[object thirdTitle]];
	[thirdIcon setStringValue:[object thirdIcon]];
	[cyclic setIntValue:[[object cell] isCyclic]];
	return [super revert:sender];
}

- ok:sender
{
	[object setThirdTitle:[thirdTitle stringValue]];
	[object setThirdIcon:[thirdIcon stringValue]];
	[object setType:([cyclic intValue] ?
			MISC_CYCLIC_THREE_STATE : MISC_PLAIN_THREE_STATE)];
	return [super ok:sender];
}

@end
