Minor performance improvements.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4584 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-07-14 14:53:25 +00:00
parent 0128d03d1b
commit 384fa03f48

View file

@ -3,7 +3,7 @@
Abstract cell for target/action paradigm
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Date: 1996
@ -33,24 +33,26 @@
@implementation NSActionCell
//
// Class methods
//
static Class controlClass;
/*
* Class methods
*/
+ (void) initialize
{
if (self == [NSActionCell class])
{
NSDebugLog(@"Initialize NSActionCell class\n");
// Initial version
controlClass = [NSControl class];
[self setVersion: 1];
}
}
//
// Instance methods
//
- init
/*
* Instance methods
*/
- (id) init
{
[super init];
target = nil;
@ -59,7 +61,7 @@
return self;
}
- initImageCell:(NSImage *)anImage
- (id) initImageCell: (NSImage*)anImage
{
[super initImageCell: anImage];
target = nil;
@ -68,7 +70,7 @@
return self;
}
- initTextCell:(NSString *)aString
- (id) initTextCell: (NSString*)aString
{
[super initTextCell: aString];
target = nil;
@ -77,14 +79,14 @@
return self;
}
//
// Configuring an NSActionCell
//
/*
* Configuring an NSActionCell
*/
- (void) setAlignment: (NSTextAlignment)mode
{
[super setAlignment: mode];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -92,7 +94,7 @@
{
[super setBezeled: flag];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -100,7 +102,7 @@
{
[super setBordered: flag];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -108,7 +110,7 @@
{
[super setEnabled: flag];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -118,7 +120,7 @@
{
[super setFloatingPointFormat: autoRange left: leftDigits right: rightDigits];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -126,7 +128,7 @@
{
[super setFont: fontObject];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -134,18 +136,18 @@
{
[super setImage: image];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
//
// Manipulating NSActionCell Values
//
/*
* Manipulating NSActionCell Values
*/
- (void) setStringValue: (NSString*)aString
{
[super setStringValue: aString];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -153,7 +155,7 @@
{
[super setDoubleValue: aDouble];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -161,7 +163,7 @@
{
[super setFloatValue: aFloat];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
@ -169,13 +171,13 @@
{
[super setIntValue: anInt];
if (control_view)
if ([control_view isKindOfClass: [NSControl class]])
if ([control_view isKindOfClass: controlClass])
[(NSControl *)control_view updateCell: self];
}
//
// Target and Action
//
/*
* Target and Action
*/
- (SEL) action
{
return action;
@ -197,9 +199,9 @@
return target;
}
//
// Assigning a Tag
//
/*
* Assigning a Tag
*/
- (void) setTag: (int)anInt
{
tag = anInt;
@ -221,13 +223,13 @@
return c;
}
//
// NSCoding protocol
//
/*
* NSCoding protocol
*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
[aCoder encodeValueOfObjCType: "i" at: &tag];
[aCoder encodeValueOfObjCType: @encode(int) at: &tag];
[aCoder encodeConditionalObject: target];
[aCoder encodeValueOfObjCType: @encode(SEL) at: &action];
}
@ -235,7 +237,7 @@
- (id) initWithCoder: (NSCoder*)aDecoder
{
[super initWithCoder: aDecoder];
[aDecoder decodeValueOfObjCType: "i" at: &tag];
[aDecoder decodeValueOfObjCType: @encode(int) at: &tag];
target = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &action];
return self;