This is FileSaverAndRetrieverInspector.m in view mode; [Download] [Up]
// FileSaverAndRetrieverInspector.m // By Charles G. Fleming and Judy D. Halchin, // Educational Computing Services, Allegheny College. // Copyright 1992, 1993 Allegheny College // You may freely copy, distribute and reuse this code. // Allegheny College and the authors disclaim any warranty of any kind, // expressed or implied, as to its fitness for any particular use. // This work was partially supported by a grant from the Pew Charitable Trusts // and by an NSF Teacher Preparation Grant. #import "FileSaverAndRetrieverInspector.h" #import "SaverAndRetriever.h" @implementation FileSaverAndRetrieverInspector - init { NXBundle *bundle; char path[MAXPATHLEN+1]; [super init]; bundle = [NXBundle bundleForClass:[self class]]; [bundle getPath:path forResource:"FileSaverAndRetrieverInspector" ofType:"nib"]; [NXApp loadNibFile:path owner:self withNames:NO fromZone:[self zone]]; return self; } - (BOOL)wantsButtons { return NO; } - revert:sender { char *tempDirectory; tempDirectory = [(FileRetriever *)object directory]; if(strcmp(tempDirectory, "") == 0) { [userHomeCheckBox setState:1]; [directoryTextField setStringValue:""]; [directoryTextField setBackgroundGray:NX_LTGRAY]; [directoryTextField setEnabled:NO]; [homeButton setEnabled:NO]; } else { [userHomeCheckBox setState:0]; [directoryTextField setEnabled:YES]; [directoryTextField setBackgroundGray:NX_WHITE]; [directoryTextField setStringValue:tempDirectory]; [homeButton setEnabled:YES]; } [fileTextField setStringValue:[(FileRetriever *)object filename]]; return [super revert:sender]; } - ok:sender { if(sender == fileTextField) [(FileRetriever *)object setFilename:(char *)[sender stringValue]]; else [(FileRetriever *)object setDirectory:(char *)[sender stringValue]]; return [super ok:sender]; } - home:sender { const char *home = NXHomeDirectory(); [directoryTextField setStringValue:home]; [self ok:directoryTextField]; return self; } // If the switch is checked, have the file saver or retriever use the user's // home directory. - selelectUserHomeDir:sender { if([sender state]) { [(FileRetriever *)object setDirectory:""]; [directoryTextField setStringValue:""]; [directoryTextField setEnabled:NO]; [directoryTextField setBackgroundGray:NX_LTGRAY]; [homeButton setEnabled:NO]; } else { [directoryTextField setEnabled:YES]; [directoryTextField setBackgroundGray:NX_WHITE]; [homeButton setEnabled:YES]; } return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.