This is ButtonCell.m in view mode; [Download] [Up]
/* Implementation of ButtonCell class
*
* Copyright (C) 1993 The Board of Trustees of
* The Leland Stanford Junior University. All Rights Reserved.
*
* Authors: Scott Francis, Paul Kunz, Imran Qureshi, and Libing Wang (SLAC)
* Fred Harris (Hawaii)
* Mike Kienenberger (Alaska)
*
* This file is part of an Objective-C class library for window system
*
* ButtonCell.m,v 1.60 1995/12/13 22:32:54 fedor Exp
*/
#include "ButtonCell.h"
#include "NXBundle.h"
#include <objc/hashtable.h>
#include <stdlib.h>
#include <string.h>
extern char *ButtonCellInstanceName( void );
@implementation ButtonCell:ActionCell
/* initialization */
- init
{
[super init];
instancename = ButtonCellInstanceName();
[self _init];
return self;
}
- initTextCell:(const char *)aString
{
return [super initTextCell: aString];
}
- initIconCell:(const char *)iconName
{
return [super initIconCell: iconName];
}
- copyFromZone:(NSZone *)zone
{
ButtonCell *newCell;
newCell = [super copyFromZone:zone];
[newCell setIcon:icon];
return newCell;
}
- setIcon:(const char *)iconName
{
[super setIcon: iconName];
return self;
}
- (const char *)icon
{
return [super stringValue];
}
- (const char *)title
{
return [super stringValue];
}
- setTitle:(const char *)aString
{
return [self setStringValue:aString];
}
- setTitleNoCopy:(const char *)aString
{
return [self notImplemented:_cmd];
}
- (const char *)altTitle
{
[self notImplemented:_cmd];
return 0;
}
- setAltTitle:(const char *)aString
{
return [self notImplemented:_cmd];
}
- setKeyEquivalent:(unsigned short)charCode
{
bcFlags2.keyEquivalent = charCode;
return self;
}
- setState:(int)value
{
/* give widget chance to detect change of state by calling it first */
[self _setState:value];
[super setState:value];
return self;
}
- (const char *)altIcon
{
[self notImplemented:_cmd];
return 0;
}
- setAltIcon:(const char *)iconName
{
return [self notImplemented:_cmd];
}
- image
{
return [self notImplemented:_cmd];
}
- setImage:image
{
return [self notImplemented:_cmd];
}
- altImage
{
return [self notImplemented:_cmd];
}
- setAltImage:image
{
return [self notImplemented:_cmd];
}
- (int)iconPosition
{
[self notImplemented:_cmd];
return 0;
}
- setIconPosition:(int)aPosition
{
return [self notImplemented:_cmd];
}
- sound
{
return [self notImplemented:_cmd];
}
- setSound:aSound
{
return [self notImplemented:_cmd];
}
- (int)highlightsBy
{
[self notImplemented:_cmd];
return 0;
}
- setHighlightsBy:(int)aType
{
return [self notImplemented:_cmd];
}
- (int)showsStateBy
{
[self notImplemented:_cmd];
return 0;
}
- setShowsStateBy:(int)aType
{
return [self notImplemented:_cmd];
}
- setType:(int)aType
{
return [self notImplemented:_cmd];
}
- (BOOL)isOpaque
{
[self notImplemented:_cmd];
return 0;
}
- setStringValue:(const char *)aString
{
[super setStringValue:aString];
[self _setStringValue:aString];
return self;
}
- (const char *)stringValue
{
return [super stringValue];
}
- setStringValueNoCopy:(const char *)aString
{
return [self notImplemented:_cmd];
}
- (int)intValue
{
return [super intValue];
}
- setIntValue:(int)anInt
{
return [super setIntValue: anInt];
}
- (float)floatValue
{
return [super floatValue];
}
- setFloatValue:(float)aFloat
{
return [super setFloatValue: aFloat];
}
- (double)doubleValue
{
return [super doubleValue];
}
- setDoubleValue:(double)aDouble
{
return [super setDoubleValue: aDouble];
}
- setFont:fontObj
{
return [super setFont: fontObj];
}
- (BOOL)isBordered
{
return [super isBordered];
}
- setBordered:(BOOL)flag
{
return [super setBordered: flag];
}
- (BOOL)isTransparent
{
[self notImplemented:_cmd];
return 0;
}
- setTransparent:(BOOL)flag
{
return [self notImplemented:_cmd];
}
- setPeriodicDelay:(float)delay andInterval:(float)interval
{
return [self notImplemented:_cmd];
}
- getPeriodicDelay:(float *)delay andInterval:(float *)interval
{
return [self notImplemented:_cmd];
}
- (unsigned short)keyEquivalent
{
[self notImplemented:_cmd];
return 0;
}
- setKeyEquivalentFont:fontObj
{
return [self notImplemented:_cmd];
}
- setKeyEquivalentFont:(const char *)fontName size:(float)fontSize
{
return [self notImplemented:_cmd];
}
- (int)getParameter:(int)aParameter
{
[self notImplemented:_cmd];
return 0;
}
- setParameter:(int)aParameter to:(int)value
{
return [self notImplemented:_cmd];
}
- getDrawRect:(NXRect *)theRect
{
return [self notImplemented:_cmd];
}
- getTitleRect:(NXRect *)theRect
{
return [self notImplemented:_cmd];
}
- getIconRect:(NXRect *)theRect
{
return [self notImplemented:_cmd];
}
- calcCellSize:(NXSize *)theSize inRect:(const NXRect *)aRect
{
return [self notImplemented:_cmd];
}
- drawSelf:(const NXRect *)cellFrame inView:controlView
{
/* FIXME: Implement */
return self;
}
- drawInside:(const NXRect *)aRect inView:controlView
{
/* FIXME: Implement */
return self;
}
- highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag
{
/* FIXME: Implement */
return self;
}
- (BOOL)trackMouse:(NXEvent *)theEvent inRect:(const NXRect *)cellFrame ofView:controlView
{
[self notImplemented:_cmd];
return 0;
}
- performClick:sender
{
[self sendAction];
return self;
}
/* Archiving methods */
- read:(TypedStream*)typedStream
/* If this is the buttoncell of a popuplist, then
the flag read from the stream indicates whether
the popuplist exists or not.
*/
{
int flag;
NXBundle *bundle;
char buffer[MAXPATHLEN+1];
int localState;
[super read:typedStream];
objc_read_type(typedStream, "i", &popup);
if (popup) {
objc_read_object(typedStream, &target);
}
objc_read_type(typedStream, "i", &flag);
if ( flag ) {
#ifdef DEBUG
fprintf(stderr, "before BC\n");
#endif
objc_read_type(typedStream, "*", &icon);
#ifdef DEBUG
fprintf(stderr, "after BC\n");
#endif
bundle = [NXBundle bundleForClass:[self class]];
if ( [bundle getPath:buffer forResource:icon ofType:"xbm"]) {
iconFile = NXCopyStringBuffer(buffer);
}
}
objc_read_type(typedStream, "i", &flag);
if ( flag ) {
objc_read_type(typedStream, "*", &altIcon);
bundle = [NXBundle bundleForClass:[self class]];
if ( [bundle getPath:buffer forResource:altIcon ofType:"xbm"]) {
altIconFile = NXCopyStringBuffer(buffer);
}
}
objc_read_type(typedStream, "i", &flag);
if ( flag ) {
objc_read_type(typedStream, "i", &localState);
}
// very questionable
[super setState:localState];
return self;
}
- write:(NXTypedStream *)stream
{
/* FIXME: Implement */
return self;
}
- awake
{
[super awake];
widgetType = 0;
/* should be moved to _init maybe? */
if(icon) {
if (!strcmp(icon, "NXradio")) widgetType = NXRADIO;
else if (!strcmp(icon, "NXswitch")) widgetType = NXSWITCH;
}
[self _init];
if (!popup) {
[self _setPopUp];
}
return self;
}
- _setMode:(int)aMode
{
radioBehavior = aMode;
return self;
}
- (int)_radioType
{
return radioBehavior;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.