This is MiscTriStateInspector.m in view mode; [Download] [Up]
//
// MiscTriStateInspector.m -- inspector class for the three state button
// Written by Don Yacktman Copyright (c) 1993 by Don Yacktman.
// Version 1.1. All rights reserved.
//
// This notice may not be removed from this source code.
//
// This is a free object! Contact the author for the latest version.
// Don Yacktman, 4279 N. Ivy Lane, Provo, UT, 84604
// e-mail: Don_Yacktman@byu.edu
//
// This object is included in the MiscKit by permission from the author
// and its use is governed by the MiscKit license, found in the file
// "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
// for a list of all applicable permissions and restrictions.
//
#import "MiscTriStateInspector.h"
#import <appkit/appkit.h>
#import "MiscThreeStateButton.subproj/MiscThreeStateButtonCell.h"
#import "MiscThreeStateButton.subproj/MiscThreeStateButton.h"
@implementation MiscTriStateInspector
- init
{
char buf[MAXPATHLEN + 1];
id bundle;
[super init];
bundle = [NXBundle bundleForClass:[MiscThreeStateButton class]];
[bundle getPath:buf forResource:"TriStateInspector" ofType:"nib"];
[NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
return self;
}
- (BOOL)wantsButtons { return YES; }
- revert:sender
{
// Put string in text object
[thirdTitle setStringValue:[object thirdTitle]];
[thirdIcon setStringValue:[object thirdIcon]];
// If we are dealing with a button send message to its cell
if ([object isKindOf:[MiscThreeStateButton class]])
[cyclic setIntValue:[[object cell] isCyclic]];
// otherwise send direct
else [cyclic setIntValue:[object isCyclic]];
return [super revert:sender];
}
- ok:sender
{
[object setThirdTitle:[thirdTitle stringValue]];
[object setThirdIcon:[thirdIcon stringValue]];
[object setType:([cyclic intValue] ?
MISC_CYCLIC_THREE_STATE : MISC_PLAIN_THREE_STATE)];
return [super ok:sender];
}
@end
@implementation MiscThreeStateButton(IBSupport)
- (const char *)getInspectorClassName
{ // alt-click to bring up the button class inspector instead...
NXEvent *ev = [NXApp currentEvent];
if (ev->flags & NX_ALTERNATEMASK) return [super getInspectorClassName];
else return "MiscTriStateInspector";
}
@end
@implementation MiscThreeStateButtonCell(IBSupport)
- (const char *)getInspectorClassName
{ // alt-click to bring up the button class inspector instead...
NXEvent *ev = [NXApp currentEvent];
if (ev->flags & NX_ALTERNATEMASK)
return [[MiscThreeStateButton class] getInspectorClassName];
else return "MiscTriStateInspector";
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.