/* Implementation for ActionCell
 *
 * 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)
 *	    Mike Kienenberger (Alaska)
 *
 * This file is part of an Objective-C library for a window system
 *
 * ActionCell.m,v 1.37 1995/12/13 22:32:50 fedor Exp
 */
 

#include "ActionCell.h"
#include "Control.h"

@implementation ActionCell:Cell

- controlView
{
    return controlView;
}

- setFont:fontObj
{
  return [self notImplemented:_cmd];
}

- setAlignment:(int)mode
{
  [super setAlignment: mode];
  /* FIXME: Need re-display */
  return self;
}

- setBordered:(BOOL)flag
{
  [super setBordered: flag];
  /* FIXME: Need re-display */
  return self;
}

- setBezeled:(BOOL)flag
{
  [super setBezeled: flag];
  /* FIXME: Need re-display */
  return self;
}

- setEnabled:(BOOL)flag
{
  [super setEnabled: flag];
  /* FIXME: Need re-display */
  return self;
}

- setFloatingPointFormat:(BOOL)autoRange 
                    left:(unsigned int)leftDigits 
                   right:(unsigned int)rightDigits
{
  [super setFloatingPointFormat: autoRange left: 
  	leftDigits right: rightDigits];
  /* FIXME: Need re-display */
  return self;
}

- setIcon:(const char *)iconName
{
  [super setIcon: iconName];  
  /* FIXME: Need re-display */
  return self;
}

- target
{
    return target;
}

- setTarget:anObject
{
    target = anObject;
    return self;
}

- (SEL) action
{
    return action;
}

- setAction:(SEL)aSelector
{
    action = aSelector;
    return self;
}

- (int) tag
{
    return tag;
}

- setTag:(int)anInt
{
    tag = anInt;
    return self;
}

- (const char *)stringValue
{
  return [super stringValue];
}

- (int)intValue
{
  return [super intValue];
}

- (float)floatValue
{
  return [super floatValue];
}

- (double)doubleValue
{
  return [super doubleValue];
}

- setStringValue:(const char *)aString
{
  return [super setStringValue: aString];
}

- setStringValueNoCopy:(char *)aString shouldFree:(BOOL)flag
{
  return [self notImplemented:_cmd];
}

- drawSelf:(const NXRect *)cellFrame inView:controlView
{
  /* FIMXE: Implement */
  return self;
}

- write:(NXTypedStream *)stream
{
    [super write:stream];
    objc_write_type(stream, "i", &tag);
//    objc_write_object(stream, &target);
//    objc_write_type(stream, ":", &action);
    return self;
}

- read:(TypedStream*)typedStream
{
    [super read:typedStream];
    objc_read_type(typedStream, "i", &tag);
//    objc_read_object(typedStream, &target);
//    objc_read_type(typedStream, ":", &action);
    return self;
}

- awake
{
    [super awake];
    
    return self;
}

- copyFromZone:(NSZone *)zone
{
    ActionCell	*newCell;

    newCell = [super copyFromZone:zone];
    [newCell _setFrame:&_frame inView:controlView];
    [newCell setTag:tag];
    [newCell setTarget:target];
    [newCell setAction:action];
    return newCell;
}

- sendAction
{
 /*
  * not a OpenStep method.  
  * Implemented in this library for use by the call-back function 
  */
    if (controlView && [controlView respondsTo:@selector(selectCell:)]) {
	[controlView selectCell:self];
    }
    [controlView sendAction];
    return self;
}

- _sendActionFrom:anObject
{
 /* An undocumented method in Cell of NS.   
    Don't know what anObject is  -Kunz */
 
    if (controlView && [controlView respondsTo:@selector(selectCell:)]) {
	[controlView selectCell:self];
    }
    [controlView sendAction:action to:target];
    return self;
}

@end
