home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscThreeStateButton.m -- three state button class
- // Written by Don Yacktman (c) 1993 by Don Yacktman.
- // Version 1.0. 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 "MiscThreeStateButton.h"
- #import "MiscThreeStateButtonCell.h"
- #import <apps/InterfaceBuilder.h>
-
- static id threeStateCellClass = nil;
-
- @implementation MiscThreeStateButton
-
- + initialize
- { // need to set up to use our new cell subclass
- if (self == [MiscThreeStateButton class]) {
- threeStateCellClass = [MiscThreeStateButtonCell class];
- }
- return [super initialize];
- }
-
- + setCellClass:classId
- {
- threeStateCellClass = classId;
- return self;
- }
-
- - initFrame:(const NXRect *)frameRect
- {
- id oldCell;
- [super initFrame:frameRect];
- oldCell = [self setCell:[[threeStateCellClass alloc] init]];
- [oldCell free];
- doSuper = NO;
- return self;
- }
-
- // These all just forward to the cell for it to deal with...
- - (const char *)thirdTitle { return [cell thirdTitle]; }
- - setThirdTitle:(const char *)aString { return [cell setThirdTitle:aString]; }
- - (const char *)thirdIcon { return [cell thirdIcon]; }
- - setThirdIcon:(const char *)iconName { return [cell setThirdIcon:iconName]; }
- - thirdImage { return [cell thirdImage]; }
- - setThirdImage:image { return [cell setThirdImage:image]; }
- - setType:(int)aType { return [cell setType:aType]; }
- - (int)state { return [cell intValue]; }
- - setState:(int)value { return [cell setIntValue:value]; }
- - performAltClick:sender { return [cell performAltClick:sender]; }
-
- - (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
-