ftp.nice.ch/pub/next/text/etext/eText5-0.93.Source.NIHS.tar.gz#/eText5/MailTo.subproj/MailToUI.m

This is MailToUI.m in view mode; [Download] [Up]

///////////////////////////////////////////////////////////////////////////////
//	FILENAME:	MailToUI.m 
//	SUMMARY:	Interface for a UI for setting address and subject
//	SUPERCLASS:	Object
//	INTERFACE:	MailToUI.nib
//	PROTOCOLS:	<Inspectable>
//	AUTHOR:		Rohit Khare and Tom Zavisca
//	COPYRIGHT:	(c) 1994 California Institure of Technology, eText Project
///////////////////////////////////////////////////////////////////////////////
//	IMPLEMENTATION COMMENTS
//		Just maintains two lousy fields.
///////////////////////////////////////////////////////////////////////////////
//	HISTORY
//	07/20/94:	Revamped to leverage eTImageUI in an "inspection chain"
//	07/04/94:	Minimal Creation.
///////////////////////////////////////////////////////////////////////////////

#import "MailTo.h"

@implementation MailToUI

+ new
{
	static MailToUI *ui = nil;
	
	if (!ui) {
		ui = [[MailToUI alloc] init];
	}
	return ui;
}
- init
{
	char        buf[MAXPATHLEN];
	NXBundle   *bundle;

	[super init];
	bundle = [NXBundle bundleForClass:[MailToUI class]];
	if ( [bundle getPath:buf forResource:"MailToUI" ofType:"nib"] ) {
		[NXApp loadNibFile:buf owner:self withNames:NO];
	} else {
		NXLogError("NIB not found: MailToUI");
	}
	mailToView = [mailToPanel contentView];
	return self;
}
- free {return self;}
///////////////////////////////////
#define PROP "MailTo Properties"
- (const NXAtom *) types
{
	static NXAtom *types = NULL;
	
	if (!types) {
		int i;
		const NXAtom *superTypes = [super types];
		
		for(i=0;superTypes[i];i++);
		i++; // make room for terminating NULL
		i++; // make room for our type
		types = malloc(i * sizeof(NXAtom));
		types[0] = NXUniqueString(PROP);
		for(i=0;superTypes[i];i++) types[i+1] = superTypes[i];
		types[i+1] = NULL;
	}
	return types;
}
- (const char *) inspectorTitle
{
	return NXUniqueString("MailTo");
}
- resignInspector: (View *) oldInspector ofType: (const char *) type
{
	if (oldInspector == mailToView) {
		[self changeAddress:addressField];
		[self changeSubject:subjectField];
	} else 
		[super resignInspector:oldInspector ofType:type];
	return self;
}
- activateInspector: (View *) newInspector ofType: (const char *) type
{
	if (newInspector != mailToView)
		[super activateInspector:newInspector ofType:type];
	return self;
}
- inspectorForType:(const char *) type
{
	if(!strcmp(type,NXUniqueString(PROP)))
		return mailToView;
//	else NXLogError("Massive Inspector Failure: Asked MailTo for: %s", type);
//	return mailToView;
	return [super inspectorForType:type];
}
////////////////////
- setAnnotation:sender
{
	[super setAnnotation:sender];	// this is an awkward naming of the "chain" 
	theMailTo = sender;
	[addressField setStringValue:[theMailTo address]];
	[subjectField setStringValue:[theMailTo subject]];
	return self;
}
- changeAddress:sender
	{[theMailTo setAddress:NXUniqueString([sender stringValue])]; return self;}
- changeSubject:sender
	{[theMailTo setSubject:NXUniqueString([sender stringValue])]; return self;}
@end;

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.