This is eTLinkUI.m in view mode; [Download] [Up]
///////////////////////////////////////////////////////////////////////////////
// FILENAME: eTLinkUI.m
// SUMMARY: Implementation of link button inspectors
// SUPERCLASS: Object
// INTERFACE: None
// PROTOCOLS: <Inspectable>
// AUTHOR: Rohit Khare
// COPYRIGHT: (c) 1994 California Institure of Technology, eText Project
///////////////////////////////////////////////////////////////////////////////
// DESCRIPTION
// Does its job running a nib and yelling at eTLink. Also registers its
// view for imageable dragtypes.
///////////////////////////////////////////////////////////////////////////////
// HISTORY
// 07/03/94: Created.
///////////////////////////////////////////////////////////////////////////////
#import "eTLink.h"
@implementation eTLinkUI
- setAnnotation:newLink
{
if (theLink == newLink) return self;
[super setAnnotation:newLink]; // this is an awkward naming of the "chain"
theLink = newLink;
[anchorForm setStringValue:[theLink anchorTitle]];
[anchorForm setTitle:[theLink anchorID]];
[docForm setStringValue:[theLink docTitle]];
[docForm setTitle:[theLink docID]];
return self;
}
///////////////////////////////////
+ new
{
static eTLinkUI *ui = nil;
if (!ui) {
ui = [[eTLinkUI alloc] init];
}
return ui;
}
- init
{
char buf[MAXPATHLEN];
NXBundle *bundle;
[super init];
bundle = [NXBundle bundleForClass:[self class]];
if ( [bundle getPath:buf forResource:"eTLinkUI" ofType:"nib"] ) {
[NXApp loadNibFile:buf owner:self withNames:NO];
} else {
NXLogError("NIB not found: eTLinkUI");
}
linkView = [linkPanel contentView];
return self;
}
- free {return self;}
///////////////////////////////////
#define PROP "Link 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("Link");
}
- resignInspector: (View *) oldInspector ofType: (const char *) type
{
if (oldInspector != linkView)
[super resignInspector:oldInspector ofType:type];
return self;
}
- activateInspector: (View *) newInspector ofType:(const char *) type
{
if (newInspector != linkView)
[super activateInspector:newInspector ofType:type];
return self;
}
- inspectorForType:(const char *) type
{
if(!strcmp(type,NXUniqueString(PROP)))
return linkView;
return [super inspectorForType:type];
}
@end;These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.