This is ImportPanel.m in view mode; [Download] [Up]
/*
* (a) (C) 1990 by Adobe Systems Incorporated. All rights reserved.
*
* (b) If this Sample Code is distributed as part of the Display PostScript
* System Software Development Kit from Adobe Systems Incorporated,
* then this copy is designated as Development Software and its use is
* subject to the terms of the License Agreement attached to such Kit.
*
* (c) If this Sample Code is distributed independently, then the following
* terms apply:
*
* (d) This file may be freely copied and redistributed as long as:
* 1) Parts (a), (d), (e) and (f) continue to be included in the file,
* 2) If the file has been modified in any way, a notice of such
* modification is conspicuously indicated.
*
* (e) PostScript, Display PostScript, and Adobe are registered trademarks of
* Adobe Systems Incorporated.
*
* (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
* CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
* AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
* ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
* OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
* WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
* WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
* DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
* OF THIRD PARTY RIGHTS.
*/
/*
* ImportPanel.m
*
* Necessary because of the difficulty of obtaining a copy
* of the OpenPanel. This subclass of panel uses the OpenPanel
* panel and switches the panel from an OpenPanel to an ImportPanel.
* The panel is switched back when needed. Not recommended but
* seemingly the only way.
*
*/
#import "ImportPanel.h"
#import <appkit/Button.h>
#import <appkit/Matrix.h>
#import <appkit/TextField.h>
#import <appkit/View.h>
#import <appkit/nextstd.h>
#import <objc/hashtable.h>
#import <objc/List.h>
#import <objc/Object.h>
#import <strings.h>
@implementation ImportPanel
/*
* Assign the accessory id to the ImportPanel instance variable.
* Find the matrix of buttons in the accessory view and the open
* title text. These ids will be used at later times.
*/
- setImportAccessory:anObject
{
int i, j;
id subviewlist, subview;
/* Search for the button matrix in the accessory view. */
accessoryId = anObject;
subviewlist = [[[accessoryId subviews] objectAt:0] subviews];
j = [subviewlist count];
for (i = 0; i < j; i++)
{
subview = [subviewlist objectAt:i];
if ([subview isKindOf:[Matrix class]])
{
buttonsId = subview;
if (switchId)
break;
}
else if ([subview isKindOf:[Button class]])
{
switchId = subview;
if (buttonsId)
break;
}
}
/*
* Search for the title textfield in the panel. (Not a recommended
* approach but one of the only ways to get at the title.)
*/
subviewlist = [contentView subviews];
j = [subviewlist count];
for (i = 0; i < j; i++)
{
subview = [subviewlist objectAt:i];
if ([subview isKindOf:[TextField class]])
{
if (strcmp("Open", [subview stringValue]) == 0)
{
titleId = subview;
break;
}
}
}
return self;
}
- setOpen
{
if (strcmp("Open", [titleId stringValue]) != 0)
{
[titleId setStringValue:"Open"];
[titleId display];
[self setAccessoryView:NULL];
if (idirectory)
NX_FREE(idirectory);
idirectory = NXCopyStringBuffer(directory);
[self allowMultipleFiles:YES];
}
return self;
}
- setImport
{
if (strcmp("Import", [titleId stringValue]) != 0)
{
[titleId setStringValue:"Import"];
[titleId display];
[self setAccessoryView:accessoryId];
if (idirectory)
[self setDirectory:idirectory];
[self allowMultipleFiles:NO];
}
return self;
}
- setFormat:(int) aFormat
{
[buttonsId selectCellWithTag:aFormat];
return self;
}
- (int) format
{
return [buttonsId selectedTag];
}
- (BOOL) dragToSize
{
return [switchId state];
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.