// Copyright 1995 Paul Cardon.
// Use is governed by the MiscKit license

#import "PanelView.h"

/*
 * It seemed logical to put the controlling code for the panel inside a
 * view subclass since a view is most often subclassed anyway.
 */

@implementation PanelView

- initFrame:(const NXRect *) aRect memory:(BOOL) flag
{
	self = [super initFrame:aRect];
	remember = flag;
	return self;
}

- rememberToggle
/* Toggle status of check box on the panel */
{
	if (remember == YES) remember = NO;
	if (remember == NO) remember = YES;
	return self;
}

- buttonPress:sender
/* 
 * Determine whether the user pressed the Yes or No button and
 * terminate the modal loop.
 */
{
	switch ([sender tag]) {
		case 1 :
			choice = NO;
			break;
		case 2 :
		default:
			choice = YES;
			break;
	}
	[NXApp stopModal];
	return self;
}

/*
 * The following two methods are used by the main program to find out 
 * from the view what choice the user made.
 */

- (BOOL) remember
{
	return remember;
}

- (BOOL) choice
{
	return choice;
}

@end