2001-12-17 16:51:51 +00:00
|
|
|
/** <title>NSActionCell</title>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2001-12-17 16:51:51 +00:00
|
|
|
<abstract>Abstract cell for target/action paradigm</abstract>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-07-14 14:53:25 +00:00
|
|
|
Copyright (C) 1996-1999 Free Software Foundation, Inc.
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
|
|
|
Date: 1996
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 21:16:17 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
1996-05-30 20:03:15 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2007-10-29 21:16:17 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2007-10-29 21:16:17 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
1996-10-18 17:14:13 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
2007-10-29 21:16:17 +00:00
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
1996-05-30 20:03:15 +00:00
|
|
|
*/
|
|
|
|
|
2010-03-04 10:12:13 +00:00
|
|
|
#import "config.h"
|
2009-11-08 19:26:49 +00:00
|
|
|
#import <Foundation/NSCoder.h>
|
2010-03-04 10:12:13 +00:00
|
|
|
|
2009-11-08 19:26:49 +00:00
|
|
|
#import "AppKit/NSActionCell.h"
|
|
|
|
#import "AppKit/NSControl.h"
|
2021-01-10 21:40:29 +00:00
|
|
|
#import "GSGuiPrivate.h"
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
@implementation NSActionCell
|
|
|
|
|
1999-07-14 14:53:25 +00:00
|
|
|
static Class controlClass;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class methods
|
|
|
|
*/
|
|
|
|
+ (void) initialize
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
|
|
|
if (self == [NSActionCell class])
|
|
|
|
{
|
1999-07-14 14:53:25 +00:00
|
|
|
controlClass = [NSControl class];
|
|
|
|
[self setVersion: 1];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-07-14 14:53:25 +00:00
|
|
|
/*
|
|
|
|
* Instance methods
|
|
|
|
*/
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-07-14 14:53:25 +00:00
|
|
|
/*
|
|
|
|
* Configuring an NSActionCell
|
|
|
|
*/
|
2004-01-02 04:19:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the alignment of text within the receiver.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setAlignment: (NSTextAlignment)mode
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
2000-12-07 00:20:17 +00:00
|
|
|
[super setAlignment: mode];
|
1999-12-13 02:33:14 +00:00
|
|
|
if (_control_view)
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* If <code>YES</code> then the receiver is drawn with a bezeled border.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setBezeled: (BOOL)flag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-12-13 02:33:14 +00:00
|
|
|
_cell.is_bezeled = flag;
|
|
|
|
if (_cell.is_bezeled)
|
|
|
|
_cell.is_bordered = NO;
|
|
|
|
if (_control_view)
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* If <code>YES</code> then receiver is drawn with a border.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setBordered: (BOOL)flag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-12-13 02:33:14 +00:00
|
|
|
_cell.is_bordered = flag;
|
|
|
|
if (_cell.is_bordered)
|
|
|
|
_cell.is_bezeled = NO;
|
|
|
|
if (_control_view)
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* If <code>YES</code> then the receiver is capable of accepting input.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setEnabled: (BOOL)flag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
2000-01-07 18:27:06 +00:00
|
|
|
_cell.is_disabled = !flag;
|
1999-12-13 02:33:14 +00:00
|
|
|
if (_control_view)
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setFloatingPointFormat: (BOOL)autoRange
|
2013-01-30 09:48:54 +00:00
|
|
|
left: (NSUInteger)leftDigits
|
|
|
|
right: (NSUInteger)rightDigits
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
2000-12-08 01:20:03 +00:00
|
|
|
[super setFloatingPointFormat: autoRange
|
|
|
|
left: leftDigits
|
|
|
|
right: rightDigits];
|
1999-12-13 02:33:14 +00:00
|
|
|
if (_control_view)
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Sets the font to be used in the receiver.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setFont: (NSFont*)fontObject
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-07-14 14:53:25 +00:00
|
|
|
[super setFont: fontObject];
|
1999-12-13 02:33:14 +00:00
|
|
|
if (_control_view)
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
2000-12-08 01:20:03 +00:00
|
|
|
// TODO: This should also set the font of the text object, when selected
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Sets the image to be displayed in the receiver.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setImage: (NSImage*)image
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-07-14 14:53:25 +00:00
|
|
|
[super setImage: image];
|
1999-12-13 02:33:14 +00:00
|
|
|
if (_control_view)
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-07-14 14:53:25 +00:00
|
|
|
/*
|
|
|
|
* Manipulating NSActionCell Values
|
|
|
|
*/
|
2000-12-08 01:20:03 +00:00
|
|
|
|
2007-09-04 13:07:04 +00:00
|
|
|
/**
|
|
|
|
* Retrieve the value of the receiver
|
|
|
|
*/
|
2009-11-08 19:26:49 +00:00
|
|
|
- (id) objectValue
|
2007-09-04 13:07:04 +00:00
|
|
|
{
|
2007-09-06 21:30:13 +00:00
|
|
|
if (_cell.in_editing && _control_view)
|
2007-09-04 13:07:04 +00:00
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view validateEditing];
|
|
|
|
return [super objectValue];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the value of the receiver as an NSAttributedString.
|
|
|
|
*/
|
2009-11-08 19:26:49 +00:00
|
|
|
- (NSAttributedString*) attributedStringValue
|
2007-09-04 13:07:04 +00:00
|
|
|
{
|
2007-09-06 21:30:13 +00:00
|
|
|
if (_cell.in_editing && _control_view)
|
2007-09-04 13:07:04 +00:00
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view validateEditing];
|
|
|
|
return [super attributedStringValue];
|
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Retrieve the value of the receiver as an NSString.
|
|
|
|
*/
|
2009-11-08 19:26:49 +00:00
|
|
|
- (NSString *) stringValue
|
2000-12-08 01:20:03 +00:00
|
|
|
{
|
2007-09-06 21:30:13 +00:00
|
|
|
if (_cell.in_editing && _control_view)
|
2000-12-08 01:20:03 +00:00
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view validateEditing];
|
|
|
|
return [super stringValue];
|
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Retrieve the value of the receiver as a double.
|
|
|
|
*/
|
2009-11-08 19:26:49 +00:00
|
|
|
- (double) doubleValue
|
2000-12-08 01:20:03 +00:00
|
|
|
{
|
2007-09-06 21:30:13 +00:00
|
|
|
if (_cell.in_editing && _control_view)
|
2000-12-08 01:20:03 +00:00
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view validateEditing];
|
|
|
|
return [super doubleValue];
|
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Retrieve the value of the receiver as a float.
|
|
|
|
*/
|
2009-11-08 19:26:49 +00:00
|
|
|
- (float) floatValue
|
2000-12-08 01:20:03 +00:00
|
|
|
{
|
2007-09-06 21:30:13 +00:00
|
|
|
if (_cell.in_editing && _control_view)
|
2000-12-08 01:20:03 +00:00
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view validateEditing];
|
|
|
|
return [super floatValue];
|
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Retrieve the value of the receiver as an int.
|
|
|
|
*/
|
2009-11-08 19:26:49 +00:00
|
|
|
- (int) intValue
|
2000-12-08 01:20:03 +00:00
|
|
|
{
|
2007-09-13 19:13:46 +00:00
|
|
|
if (_cell.in_editing && _control_view)
|
2000-12-08 01:20:03 +00:00
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view validateEditing];
|
|
|
|
return [super intValue];
|
|
|
|
}
|
|
|
|
|
2010-03-04 10:12:13 +00:00
|
|
|
/**
|
|
|
|
* Retrieve the value of the receiver as an NSInteger.
|
|
|
|
*/
|
|
|
|
- (NSInteger) integerValue
|
|
|
|
{
|
|
|
|
if (_cell.in_editing && _control_view)
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
[(NSControl *)_control_view validateEditing];
|
|
|
|
return [super integerValue];
|
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Set the value of the receiver from anObject.
|
|
|
|
*/
|
2004-01-08 00:28:39 +00:00
|
|
|
- (void) setObjectValue: (id)anObject
|
2003-06-12 03:16:19 +00:00
|
|
|
{
|
|
|
|
[super setObjectValue: anObject];
|
|
|
|
if (_control_view)
|
2009-11-14 22:15:31 +00:00
|
|
|
{
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
{
|
|
|
|
if (_cell.in_editing)
|
|
|
|
{
|
|
|
|
[self _updateFieldEditor:
|
|
|
|
[(NSControl *)_control_view currentEditor]];
|
|
|
|
}
|
2009-11-16 11:40:14 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
|
|
|
}
|
2009-11-14 22:15:31 +00:00
|
|
|
}
|
|
|
|
}
|
2003-06-12 03:16:19 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Set the value of the receiver from aString.
|
|
|
|
*/
|
2004-03-06 17:52:55 +00:00
|
|
|
// This method is currently needed, as NSCells implementation
|
2009-11-16 11:40:14 +00:00
|
|
|
// sometimes does not call setObjectValue:
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setStringValue: (NSString*)aString
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-07-14 14:53:25 +00:00
|
|
|
[super setStringValue: aString];
|
2015-09-19 16:45:36 +00:00
|
|
|
if (_control_view)
|
|
|
|
{
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
{
|
|
|
|
if (_cell.in_editing)
|
|
|
|
{
|
|
|
|
[self _updateFieldEditor:
|
|
|
|
[(NSControl *)_control_view currentEditor]];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setAttributedStringValue: (NSAttributedString*)attribStr
|
|
|
|
{
|
|
|
|
[super setAttributedStringValue: attribStr];
|
1999-12-13 02:33:14 +00:00
|
|
|
if (_control_view)
|
2009-11-14 22:15:31 +00:00
|
|
|
{
|
|
|
|
if ([_control_view isKindOfClass: controlClass])
|
|
|
|
{
|
|
|
|
if (_cell.in_editing)
|
|
|
|
{
|
|
|
|
[self _updateFieldEditor:
|
|
|
|
[(NSControl *)_control_view currentEditor]];
|
|
|
|
}
|
2009-11-16 11:40:14 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
[(NSControl *)_control_view updateCell: self];
|
|
|
|
}
|
2009-11-14 22:15:31 +00:00
|
|
|
}
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-07-14 14:53:25 +00:00
|
|
|
/*
|
|
|
|
* Target and Action
|
|
|
|
*/
|
2004-01-02 04:19:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the action from the receiver.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (SEL) action
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-12-13 02:33:14 +00:00
|
|
|
return _action;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Set the action in the receiver as the selector aSelector.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setAction: (SEL)aSelector
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-12-13 02:33:14 +00:00
|
|
|
_action = aSelector;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Set the target in the receiver as anObject. NSActionCell does not retain its target!
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (void) setTarget: (id)anObject
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-12-13 02:33:14 +00:00
|
|
|
_target = anObject;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Return the target of the receiver.
|
|
|
|
*/
|
1999-07-14 14:53:25 +00:00
|
|
|
- (id) target
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-12-13 02:33:14 +00:00
|
|
|
return _target;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Assigning a Tag.
|
1999-07-14 14:53:25 +00:00
|
|
|
*/
|
2010-03-23 21:26:24 +00:00
|
|
|
- (void) setTag: (NSInteger)anInt
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-12-13 02:33:14 +00:00
|
|
|
_tag = anInt;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Return the tag.
|
|
|
|
*/
|
2010-03-23 21:26:24 +00:00
|
|
|
- (NSInteger) tag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-12-13 02:33:14 +00:00
|
|
|
return _tag;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2004-01-02 04:19:32 +00:00
|
|
|
/**
|
|
|
|
* Returns the control view of the receiver.
|
|
|
|
*/
|
2009-11-08 19:26:49 +00:00
|
|
|
-(NSView *) controlView
|
1999-12-13 16:10:51 +00:00
|
|
|
{
|
|
|
|
return _control_view;
|
|
|
|
}
|
|
|
|
|
2007-07-23 16:29:29 +00:00
|
|
|
/**
|
|
|
|
* Set the control view of the receiver.
|
|
|
|
*/
|
|
|
|
- (void) setControlView: (NSView*)view
|
|
|
|
{
|
|
|
|
_control_view = view;
|
|
|
|
}
|
1999-12-13 16:10:51 +00:00
|
|
|
|
|
|
|
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
|
|
|
|
{
|
|
|
|
if (_control_view != controlView)
|
|
|
|
_control_view = controlView;
|
|
|
|
|
|
|
|
[super drawWithFrame: cellFrame
|
|
|
|
inView: controlView];
|
|
|
|
}
|
|
|
|
|
1999-07-14 14:53:25 +00:00
|
|
|
/*
|
|
|
|
* NSCoding protocol
|
|
|
|
*/
|
1999-03-02 08:58:30 +00:00
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
[super encodeWithCoder: aCoder];
|
2006-10-15 08:34:47 +00:00
|
|
|
if ([aCoder allowsKeyedCoding])
|
2006-08-06 04:32:16 +00:00
|
|
|
{
|
2013-01-27 20:28:35 +00:00
|
|
|
[aCoder encodeInteger: [self tag] forKey: @"NSTag"];
|
2009-11-08 19:26:49 +00:00
|
|
|
if ([self target] != nil)
|
2008-12-21 03:11:08 +00:00
|
|
|
{
|
|
|
|
[aCoder encodeObject: [self target] forKey: @"NSTarget"];
|
|
|
|
}
|
2009-11-08 19:26:49 +00:00
|
|
|
if ([self action] != NULL)
|
2008-12-21 03:11:08 +00:00
|
|
|
{
|
|
|
|
[aCoder encodeObject: NSStringFromSelector([self action]) forKey: @"NSAction"];
|
|
|
|
}
|
2006-08-11 05:53:28 +00:00
|
|
|
[aCoder encodeObject: _control_view forKey: @"NSControlView"];
|
2006-08-06 04:32:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-10 21:40:29 +00:00
|
|
|
encode_NSInteger(aCoder, &_tag);
|
2006-08-06 04:32:16 +00:00
|
|
|
[aCoder encodeConditionalObject: _target];
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
|
|
|
// This is only encoded for backward compatibility and won't be decoded.
|
|
|
|
[aCoder encodeConditionalObject: nil];
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1999-03-02 08:58:30 +00:00
|
|
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
2004-01-08 12:03:33 +00:00
|
|
|
self = [super initWithCoder: aDecoder];
|
2009-11-08 19:26:49 +00:00
|
|
|
if (!self)
|
|
|
|
return nil;
|
2004-02-06 00:16:54 +00:00
|
|
|
|
|
|
|
if ([aDecoder allowsKeyedCoding])
|
|
|
|
{
|
2004-10-10 22:36:02 +00:00
|
|
|
if ([aDecoder containsValueForKey: @"NSTag"])
|
|
|
|
{
|
2013-01-27 20:28:35 +00:00
|
|
|
[self setTag: [aDecoder decodeIntegerForKey: @"NSTag"]];
|
2004-10-10 22:36:02 +00:00
|
|
|
}
|
2006-05-20 22:12:46 +00:00
|
|
|
if ([aDecoder containsValueForKey: @"NSTarget"])
|
|
|
|
{
|
|
|
|
[self setTarget: [aDecoder decodeObjectForKey: @"NSTarget"]];
|
|
|
|
}
|
|
|
|
if ([aDecoder containsValueForKey: @"NSAction"])
|
|
|
|
{
|
|
|
|
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
|
|
|
[self setAction: NSSelectorFromString(action)];
|
|
|
|
}
|
2004-02-06 00:16:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
id dummy;
|
|
|
|
|
2021-01-10 21:40:29 +00:00
|
|
|
decode_NSInteger(aDecoder, &_tag);
|
2004-02-06 00:16:54 +00:00
|
|
|
_target = [aDecoder decodeObject];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
|
|
|
// Don't decode _control_view, as this may no longer be valid.
|
2021-01-08 16:18:36 +00:00
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &dummy];
|
|
|
|
RELEASE(dummy);
|
2004-02-06 00:16:54 +00:00
|
|
|
}
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|