2001-12-17 16:51:51 +00:00
|
|
|
/** <title>NSBrowserCell</title>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2001-12-17 16:51:51 +00:00
|
|
|
<abstract>Cell class for the NSBrowser</abstract>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-09-04 16:09:17 +00:00
|
|
|
Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
|
|
|
Date: 1996
|
1999-12-13 02:36:40 +00:00
|
|
|
Author: Nicola Pero <n.pero@mi.flashnet.it>
|
|
|
|
Date: December 1999
|
1999-02-19 20:19:58 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
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.
|
1999-02-19 20:19:58 +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.
|
1999-02-19 20:19:58 +00:00
|
|
|
*/
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2010-05-24 10:48:14 +00:00
|
|
|
#import "config.h"
|
1998-11-25 17:16:48 +00:00
|
|
|
|
2010-05-24 10:48:14 +00:00
|
|
|
#import <Foundation/NSUserDefaults.h>
|
2002-04-11 23:17:42 +00:00
|
|
|
|
2010-05-24 10:48:14 +00:00
|
|
|
#import "AppKit/NSBrowserCell.h"
|
|
|
|
#import "AppKit/NSColor.h"
|
|
|
|
#import "AppKit/NSFont.h"
|
|
|
|
#import "AppKit/NSImage.h"
|
|
|
|
#import "AppKit/NSGraphics.h"
|
|
|
|
#import "AppKit/NSEvent.h"
|
|
|
|
#import "AppKit/NSWindow.h"
|
|
|
|
#import "GSGuiPrivate.h"
|
2015-06-26 05:27:12 +00:00
|
|
|
#import "GNUstepGUI/GSTheme.h"
|
1998-11-25 17:16:48 +00:00
|
|
|
|
1999-09-04 16:09:17 +00:00
|
|
|
/*
|
|
|
|
* Class variables
|
|
|
|
*/
|
1999-12-13 02:36:40 +00:00
|
|
|
static Class _colorClass;
|
1997-10-31 01:24:08 +00:00
|
|
|
|
1999-12-13 19:47:03 +00:00
|
|
|
// GNUstep user default to have NSBrowserCell in bold if non leaf
|
1999-12-13 02:36:40 +00:00
|
|
|
static BOOL _gsFontifyCells = NO;
|
|
|
|
static NSFont *_nonLeafFont;
|
|
|
|
static NSFont *_leafFont;
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
|
2005-11-25 11:40:48 +00:00
|
|
|
/**<p> TODO Description</p>
|
2005-11-08 13:56:21 +00:00
|
|
|
*/
|
1996-05-30 20:03:15 +00:00
|
|
|
@implementation NSBrowserCell
|
|
|
|
|
1999-09-04 16:09:17 +00:00
|
|
|
/*
|
|
|
|
* Class methods
|
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
+ (void) initialize
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1999-02-19 20:19:58 +00:00
|
|
|
if (self == [NSBrowserCell class])
|
|
|
|
{
|
|
|
|
[self setVersion: 1];
|
2000-01-07 18:28:34 +00:00
|
|
|
|
1999-09-04 16:09:17 +00:00
|
|
|
/*
|
|
|
|
* Cache classes to avoid overheads of poor compiler implementation.
|
|
|
|
*/
|
1999-12-13 02:36:40 +00:00
|
|
|
_colorClass = [NSColor class];
|
2000-01-07 18:28:34 +00:00
|
|
|
|
1999-10-26 19:54:21 +00:00
|
|
|
// A GNUstep experimental feature
|
|
|
|
if ([[NSUserDefaults standardUserDefaults]
|
|
|
|
boolForKey: @"GSBrowserCellFontify"])
|
1999-11-30 22:15:25 +00:00
|
|
|
{
|
1999-12-13 02:36:40 +00:00
|
|
|
_gsFontifyCells = YES;
|
|
|
|
_nonLeafFont = RETAIN ([NSFont boldSystemFontOfSize: 0]);
|
|
|
|
_leafFont = RETAIN ([NSFont systemFontOfSize: 0]);
|
1999-10-26 19:54:21 +00:00
|
|
|
}
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
2005-11-18 15:34:00 +00:00
|
|
|
/**<p>Returns the default branch image. Currently, it's an arrow. </p>
|
2005-11-08 13:56:21 +00:00
|
|
|
*<p>See Also: +highlightedBranchImage </p>
|
1999-09-04 16:09:17 +00:00
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
+ (NSImage*) branchImage
|
|
|
|
{
|
2015-06-26 05:27:12 +00:00
|
|
|
return [[GSTheme theme] branchImage];
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
2005-11-18 15:34:00 +00:00
|
|
|
/**<p>Returns the default hightlited branch image</p>
|
2005-11-08 13:56:21 +00:00
|
|
|
*<p>See Also: +branchImage</p>
|
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
+ (NSImage*) highlightedBranchImage
|
|
|
|
{
|
2015-06-26 05:27:12 +00:00
|
|
|
return [[GSTheme theme] highlightedBranchImage];
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1999-09-04 16:09:17 +00:00
|
|
|
/*
|
|
|
|
* Instance methods
|
|
|
|
*/
|
1999-12-14 19:06:13 +00:00
|
|
|
- (id) initTextCell: (NSString *)aString
|
1999-02-19 20:19:58 +00:00
|
|
|
{
|
2011-03-14 22:59:20 +00:00
|
|
|
self = [super initTextCell: aString];
|
|
|
|
if (nil == self)
|
|
|
|
return self;
|
|
|
|
|
2000-01-07 18:28:34 +00:00
|
|
|
//_alternateImage = nil;
|
|
|
|
//_browsercell_is_leaf = NO;
|
|
|
|
//_browsercell_is_loaded = NO;
|
2009-12-17 01:49:20 +00:00
|
|
|
[self setLineBreakMode: NSLineBreakByTruncatingTail];
|
2000-01-07 18:28:34 +00:00
|
|
|
|
1999-12-14 19:06:13 +00:00
|
|
|
if (_gsFontifyCells)
|
2000-12-07 00:20:17 +00:00
|
|
|
[self setFont: _nonLeafFont];
|
1999-12-14 19:06:13 +00:00
|
|
|
|
|
|
|
return self;
|
1997-10-31 01:24:08 +00:00
|
|
|
}
|
|
|
|
|
1999-12-14 19:06:13 +00:00
|
|
|
- (id) initImageCell: (NSImage *)anImage
|
1997-10-31 01:24:08 +00:00
|
|
|
{
|
2011-03-14 22:59:20 +00:00
|
|
|
self = [super initImageCell: anImage];
|
|
|
|
if (nil == self)
|
|
|
|
return self;
|
|
|
|
|
2000-01-07 18:28:34 +00:00
|
|
|
//_alternateImage = nil;
|
|
|
|
//_browsercell_is_leaf = NO;
|
|
|
|
//_browsercell_is_loaded = NO;
|
2009-12-17 01:49:20 +00:00
|
|
|
[self setLineBreakMode: NSLineBreakByTruncatingTail];
|
1999-02-19 20:19:58 +00:00
|
|
|
|
2000-01-07 18:28:34 +00:00
|
|
|
if (_gsFontifyCells)
|
2000-12-07 00:20:17 +00:00
|
|
|
[self setFont: _nonLeafFont];
|
2000-01-07 18:28:34 +00:00
|
|
|
|
1999-02-19 20:19:58 +00:00
|
|
|
return self;
|
1997-10-31 01:24:08 +00:00
|
|
|
}
|
|
|
|
|
1999-12-14 19:06:13 +00:00
|
|
|
|
1999-02-19 20:19:58 +00:00
|
|
|
- (void) dealloc
|
1997-10-31 01:24:08 +00:00
|
|
|
{
|
2000-12-12 16:38:04 +00:00
|
|
|
TEST_RELEASE (_alternateImage);
|
1999-02-19 20:19:58 +00:00
|
|
|
|
|
|
|
[super dealloc];
|
1997-10-31 01:24:08 +00:00
|
|
|
}
|
|
|
|
|
1999-02-19 20:19:58 +00:00
|
|
|
- (id) copyWithZone: (NSZone*)zone
|
1997-10-31 01:24:08 +00:00
|
|
|
{
|
1999-03-02 08:58:30 +00:00
|
|
|
NSBrowserCell *c = [super copyWithZone: zone];
|
|
|
|
|
2010-04-10 20:33:30 +00:00
|
|
|
_alternateImage = TEST_RETAIN (_alternateImage);
|
2000-12-07 00:20:17 +00:00
|
|
|
//c->_browsercell_is_leaf = _browsercell_is_leaf;
|
|
|
|
//c->_browsercell_is_loaded = _browsercell_is_loaded;
|
1999-02-19 20:19:58 +00:00
|
|
|
|
|
|
|
return c;
|
1997-10-31 01:24:08 +00:00
|
|
|
}
|
|
|
|
|
2005-11-18 15:34:00 +00:00
|
|
|
/**<p>Returns the alternate image in the NSBrowserCell
|
2005-11-25 11:40:48 +00:00
|
|
|
(used when the cell is highlighted) </p>
|
|
|
|
<p>See Also: -setAlternateImage:</p>
|
1999-09-04 16:09:17 +00:00
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (NSImage*) alternateImage
|
|
|
|
{
|
|
|
|
return _alternateImage;
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2005-11-18 15:34:00 +00:00
|
|
|
/**<p>Sets the altenate image (used when the cell is highlighted) to anImage
|
2005-11-08 13:56:21 +00:00
|
|
|
*</p><p>See Also: -alternateImage</p>
|
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (void) setAlternateImage: (NSImage *)anImage
|
|
|
|
{
|
|
|
|
ASSIGN(_alternateImage, anImage);
|
1997-10-31 01:24:08 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2011-12-18 22:16:20 +00:00
|
|
|
- (NSImage*) image
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* NSCell implementation requires our type to be an image cell which
|
|
|
|
* is not desirable for NSBrowserCell. See also comment in setType:
|
|
|
|
*/
|
|
|
|
return _cell_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setImage: (NSImage*)anImage
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* NSCell implementation changes our type to an image cell which
|
|
|
|
* is not desirable for NSBrowserCell. See also comment in setType:
|
|
|
|
*/
|
|
|
|
ASSIGN (_cell_image, anImage);
|
|
|
|
}
|
|
|
|
|
2001-05-13 20:59:21 +00:00
|
|
|
- (NSColor *)highlightColorInView: (NSView *)controlView
|
|
|
|
{
|
|
|
|
return [_colorClass selectedControlColor];
|
|
|
|
}
|
|
|
|
|
2005-11-18 15:34:00 +00:00
|
|
|
/**<p>Returns whether the browserCell is a leaf. A leaf cell has usually no
|
2005-11-08 13:56:21 +00:00
|
|
|
* image. This method is used by NSBrowser in several methods, for example
|
|
|
|
* to know if a column should be added; when the user selects a browser cell
|
|
|
|
* (a branch or a leaf)</p>
|
2005-11-18 15:34:00 +00:00
|
|
|
* <p>See Also: -setLeaf: </p>
|
1999-09-04 16:09:17 +00:00
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (BOOL) isLeaf
|
|
|
|
{
|
1999-12-13 16:13:00 +00:00
|
|
|
return _browsercell_is_leaf;
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
2005-11-18 15:34:00 +00:00
|
|
|
/**<p>Sets whether the cell is a leaf. This method is usally used in the
|
|
|
|
* NSBrowser's delegate methods</p>
|
2005-11-08 13:56:21 +00:00
|
|
|
*<p>See Also: -isLeaf</p>
|
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (void) setLeaf: (BOOL)flag
|
|
|
|
{
|
1999-12-13 16:13:00 +00:00
|
|
|
if (_browsercell_is_leaf == flag)
|
1999-10-26 19:54:21 +00:00
|
|
|
return;
|
|
|
|
|
1999-12-13 16:13:00 +00:00
|
|
|
_browsercell_is_leaf = flag;
|
1999-10-26 19:54:21 +00:00
|
|
|
|
1999-12-13 02:36:40 +00:00
|
|
|
if (_gsFontifyCells)
|
1999-10-26 19:54:21 +00:00
|
|
|
{
|
1999-12-13 16:13:00 +00:00
|
|
|
if (_browsercell_is_leaf)
|
1999-10-26 19:54:21 +00:00
|
|
|
{
|
2000-12-07 00:20:17 +00:00
|
|
|
[self setFont: _leafFont];
|
1999-10-26 19:54:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-12-07 00:20:17 +00:00
|
|
|
[self setFont: _nonLeafFont];
|
1999-10-26 19:54:21 +00:00
|
|
|
}
|
|
|
|
}
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2005-11-25 11:40:48 +00:00
|
|
|
/**<p>Returns whether the NSBrowseCell state is set and is ready for
|
|
|
|
display</p> <p>See Also: -setLoaded:</p>
|
1999-09-04 16:09:17 +00:00
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (BOOL) isLoaded
|
|
|
|
{
|
1999-12-13 16:13:00 +00:00
|
|
|
return _browsercell_is_loaded;
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
2005-11-25 11:40:48 +00:00
|
|
|
|
|
|
|
/**<p>Sets whether the NSBrowseCell state is set and is ready for display</p>
|
|
|
|
* <p>See Also: -isLoaded </p>
|
2005-11-08 13:56:21 +00:00
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (void) setLoaded: (BOOL)flag
|
|
|
|
{
|
1999-12-13 16:13:00 +00:00
|
|
|
_browsercell_is_loaded = flag;
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2005-11-08 13:56:21 +00:00
|
|
|
/**
|
|
|
|
*<p>Unhighlights the cell and sets the cell's state to NO</p>
|
|
|
|
*<p>See Also: -set</p>
|
1999-09-04 16:09:17 +00:00
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (void) reset
|
1997-10-31 01:24:08 +00:00
|
|
|
{
|
1999-12-13 02:36:40 +00:00
|
|
|
_cell.is_highlighted = NO;
|
1999-12-13 16:13:00 +00:00
|
|
|
_cell.state = NO;
|
1997-10-31 01:24:08 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
2005-11-18 15:34:00 +00:00
|
|
|
/**<p>Highlights the cell and sets the cell's state to YES</p>
|
2005-11-08 13:56:21 +00:00
|
|
|
*<p>See Also: -reset</p>
|
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (void) set
|
1997-10-31 01:24:08 +00:00
|
|
|
{
|
1999-12-13 02:36:40 +00:00
|
|
|
_cell.is_highlighted = YES;
|
1999-12-13 16:13:00 +00:00
|
|
|
_cell.state = YES;
|
1997-10-31 01:24:08 +00:00
|
|
|
}
|
|
|
|
|
2005-01-17 00:07:50 +00:00
|
|
|
- (void) setType: (NSCellType)aType
|
|
|
|
{
|
|
|
|
/* We do nothing here (we match the Mac OS X behavior) because with
|
|
|
|
* NSBrowserCell GNUstep implementation the cell may contain an image
|
|
|
|
* and text at the same time.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2013-09-27 13:10:23 +00:00
|
|
|
- (NSRect) titleRectForBounds: (NSRect)theRect
|
|
|
|
{
|
|
|
|
NSRect titleRect = [super titleRectForBounds: theRect];
|
|
|
|
NSImage *branch_image = nil;
|
|
|
|
NSImage *cell_image = [self image];
|
|
|
|
|
|
|
|
if (_cell.is_highlighted || _cell.state)
|
|
|
|
{
|
|
|
|
if (!_browsercell_is_leaf)
|
|
|
|
{
|
|
|
|
branch_image = [object_getClass(self) highlightedBranchImage];
|
|
|
|
}
|
|
|
|
if (nil != [self alternateImage])
|
|
|
|
{
|
|
|
|
cell_image = [self alternateImage];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!_browsercell_is_leaf)
|
|
|
|
{
|
|
|
|
branch_image = [object_getClass(self) branchImage];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (branch_image)
|
|
|
|
{
|
|
|
|
NSRect imgRect;
|
|
|
|
|
|
|
|
imgRect.size = [branch_image size];
|
|
|
|
titleRect.size.width -= imgRect.size.width + 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cell_image)
|
|
|
|
{
|
|
|
|
NSRect imgRect;
|
|
|
|
|
|
|
|
imgRect.size = [cell_image size];
|
|
|
|
titleRect.origin.x += imgRect.size.width + 4;
|
|
|
|
titleRect.size.width -= imgRect.size.width + 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Skip 2 points from the left border
|
|
|
|
titleRect.origin.x += 2;
|
|
|
|
titleRect.size.width -= 2;
|
|
|
|
|
|
|
|
return titleRect;
|
|
|
|
}
|
|
|
|
|
1999-09-04 16:09:17 +00:00
|
|
|
/*
|
|
|
|
* Displaying
|
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
|
1997-10-31 01:24:08 +00:00
|
|
|
{
|
2015-06-26 05:27:12 +00:00
|
|
|
[[GSTheme theme] drawBrowserInteriorWithFrame: cellFrame
|
|
|
|
withCell: self
|
|
|
|
inView: controlView
|
|
|
|
withImage: [self image]
|
|
|
|
alternateImage: [self alternateImage]
|
|
|
|
isHighlighted: [self isHighlighted]
|
|
|
|
state: [self state]
|
|
|
|
isLeaf: [self isLeaf]];
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
1999-09-04 16:09:17 +00:00
|
|
|
/*
|
|
|
|
* NSCoding protocol
|
|
|
|
*/
|
1999-02-19 20:19:58 +00:00
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
|
|
|
{
|
|
|
|
[super encodeWithCoder: aCoder];
|
2006-10-15 08:34:47 +00:00
|
|
|
if ([aCoder allowsKeyedCoding])
|
2006-08-19 14:34:52 +00:00
|
|
|
{
|
|
|
|
// simply encodes prescence...
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BOOL tmp;
|
|
|
|
tmp = _browsercell_is_leaf;
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
|
|
|
tmp = _browsercell_is_loaded;
|
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
|
|
|
[aCoder encodeObject: _alternateImage];
|
|
|
|
}
|
1999-02-19 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
|
|
|
{
|
2011-03-14 22:59:20 +00:00
|
|
|
self = [super initWithCoder: aDecoder];
|
|
|
|
if (nil == self)
|
|
|
|
return self;
|
1999-02-19 20:19:58 +00:00
|
|
|
|
2004-01-30 19:49:00 +00:00
|
|
|
if ([aDecoder allowsKeyedCoding])
|
|
|
|
{
|
2006-08-19 14:34:52 +00:00
|
|
|
// Nothing to decode...
|
2004-01-30 19:49:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BOOL tmp;
|
1999-02-19 20:19:58 +00:00
|
|
|
|
2004-01-30 19:49:00 +00:00
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
|
|
|
[self setLeaf: tmp];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
|
|
|
[self setLoaded: tmp];
|
|
|
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_alternateImage];
|
|
|
|
}
|
|
|
|
|
1999-02-19 20:19:58 +00:00
|
|
|
return self;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|