//*****************************************************************************
//
//	SelectPreference.m.  
//
//		Preferences logic.
//
//			by	Felipe A. Rodriguez		
//
//	This code is supplied "as is" the author makes no warranty as to its 
//	suitability for any purpose.  This code is free and may be distributed 
//	in accordance with the terms of the:
//		
//			GNU GENERAL PUBLIC LICENSE
//			Version 2, June 1991
//			copyright (C) 1989, 1991 Free Software Foundation, Inc.
// 			675 Mass Ave, Cambridge, MA 02139, USA
//
//*****************************************************************************

#import "../SwapView.h"
#import "../Coordinator.h"
#import "../GKdefs.h"
#import "../DLDelegate.h"
#import "SelectPreference.h"
#import "SelectPanelController.h"

#define BUTTONPOSITION 3				// position of this inspectors' button




@implementation SelectPreference 

//*****************************************************************************
//
// 		recieved immediately after class is dynamically loaded 
//
//*****************************************************************************

+ finishLoading:(struct mach_header *)header
{
	[self poseAs:[self superclass]];

	return self;
}
//*****************************************************************************
//
//		sent to us after nib objects are unarchived and init'd 
//
//*****************************************************************************
 
- awakeFromNib
{
	[super awakeFromNib];

    return [super addInspector:"Select" 
					atPosition:BUTTONPOSITION 
					withSelector:@selector(displaySelect:)];
}
//*****************************************************************************
//
//		swap preferences subviews, dynamically load ours if necessary
//
//*****************************************************************************

- displaySelect:sender 
{
	[self loadPreference:"SelectPanelController" 
				 ofClass:[SelectPanelController class] 
				 buttonMatrix:sender];
				 
    return self;
}
//*****************************************************************************
//
// 		as text delegate we recieve this when textfield cell is being edited 
//
//*****************************************************************************

- (BOOL)textWillChange:textObject
{
	[[swapView window] setDocEdited:YES];	// indicate change is not saved

    return NO;
}
//*****************************************************************************
//
// 		text delegate receives when editing of textfield cell is ended 
//
//*****************************************************************************

- textDidEnd:textObject endChar:(unsigned short)whyEnd
{
    if ((whyEnd == 16) || (whyEnd == 17)) 
		[[swapView window] setDocEdited:NO];	// indicate change is saved

    return self;
}

@end

