mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-04 02:00:41 +00:00
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:
parent
0128d03d1b
commit
384fa03f48
1 changed files with 75 additions and 73 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Abstract cell for target/action paradigm
|
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>
|
Author: Scott Christley <scottc@net-community.com>
|
||||||
Date: 1996
|
Date: 1996
|
||||||
|
@ -33,24 +33,26 @@
|
||||||
|
|
||||||
@implementation NSActionCell
|
@implementation NSActionCell
|
||||||
|
|
||||||
//
|
static Class controlClass;
|
||||||
// Class methods
|
|
||||||
//
|
/*
|
||||||
|
* Class methods
|
||||||
|
*/
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [NSActionCell class])
|
if (self == [NSActionCell class])
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Initialize NSActionCell class\n");
|
NSDebugLog(@"Initialize NSActionCell class\n");
|
||||||
|
|
||||||
// Initial version
|
controlClass = [NSControl class];
|
||||||
[self setVersion: 1];
|
[self setVersion: 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Instance methods
|
* Instance methods
|
||||||
//
|
*/
|
||||||
- init
|
- (id) init
|
||||||
{
|
{
|
||||||
[super init];
|
[super init];
|
||||||
target = nil;
|
target = nil;
|
||||||
|
@ -59,7 +61,7 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- initImageCell:(NSImage *)anImage
|
- (id) initImageCell: (NSImage*)anImage
|
||||||
{
|
{
|
||||||
[super initImageCell: anImage];
|
[super initImageCell: anImage];
|
||||||
target = nil;
|
target = nil;
|
||||||
|
@ -68,7 +70,7 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- initTextCell:(NSString *)aString
|
- (id) initTextCell: (NSString*)aString
|
||||||
{
|
{
|
||||||
[super initTextCell: aString];
|
[super initTextCell: aString];
|
||||||
target = nil;
|
target = nil;
|
||||||
|
@ -77,14 +79,14 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Configuring an NSActionCell
|
* Configuring an NSActionCell
|
||||||
//
|
*/
|
||||||
- (void) setAlignment: (NSTextAlignment)mode
|
- (void) setAlignment: (NSTextAlignment)mode
|
||||||
{
|
{
|
||||||
[super setAlignment: mode];
|
[super setAlignment: mode];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +94,7 @@
|
||||||
{
|
{
|
||||||
[super setBezeled: flag];
|
[super setBezeled: flag];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@
|
||||||
{
|
{
|
||||||
[super setBordered: flag];
|
[super setBordered: flag];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +110,7 @@
|
||||||
{
|
{
|
||||||
[super setEnabled: flag];
|
[super setEnabled: flag];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +120,7 @@
|
||||||
{
|
{
|
||||||
[super setFloatingPointFormat: autoRange left: leftDigits right: rightDigits];
|
[super setFloatingPointFormat: autoRange left: leftDigits right: rightDigits];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +128,7 @@
|
||||||
{
|
{
|
||||||
[super setFont: fontObject];
|
[super setFont: fontObject];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,18 +136,18 @@
|
||||||
{
|
{
|
||||||
[super setImage: image];
|
[super setImage: image];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Manipulating NSActionCell Values
|
* Manipulating NSActionCell Values
|
||||||
//
|
*/
|
||||||
- (void) setStringValue: (NSString*)aString
|
- (void) setStringValue: (NSString*)aString
|
||||||
{
|
{
|
||||||
[super setStringValue: aString];
|
[super setStringValue: aString];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +155,7 @@
|
||||||
{
|
{
|
||||||
[super setDoubleValue: aDouble];
|
[super setDoubleValue: aDouble];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +163,7 @@
|
||||||
{
|
{
|
||||||
[super setFloatValue: aFloat];
|
[super setFloatValue: aFloat];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,13 +171,13 @@
|
||||||
{
|
{
|
||||||
[super setIntValue: anInt];
|
[super setIntValue: anInt];
|
||||||
if (control_view)
|
if (control_view)
|
||||||
if ([control_view isKindOfClass: [NSControl class]])
|
if ([control_view isKindOfClass: controlClass])
|
||||||
[(NSControl *)control_view updateCell: self];
|
[(NSControl *)control_view updateCell: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Target and Action
|
* Target and Action
|
||||||
//
|
*/
|
||||||
- (SEL) action
|
- (SEL) action
|
||||||
{
|
{
|
||||||
return action;
|
return action;
|
||||||
|
@ -197,9 +199,9 @@
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Assigning a Tag
|
* Assigning a Tag
|
||||||
//
|
*/
|
||||||
- (void) setTag: (int)anInt
|
- (void) setTag: (int)anInt
|
||||||
{
|
{
|
||||||
tag = anInt;
|
tag = anInt;
|
||||||
|
@ -221,13 +223,13 @@
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// NSCoding protocol
|
* NSCoding protocol
|
||||||
//
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
[aCoder encodeValueOfObjCType: "i" at: &tag];
|
[aCoder encodeValueOfObjCType: @encode(int) at: &tag];
|
||||||
[aCoder encodeConditionalObject: target];
|
[aCoder encodeConditionalObject: target];
|
||||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &action];
|
[aCoder encodeValueOfObjCType: @encode(SEL) at: &action];
|
||||||
}
|
}
|
||||||
|
@ -235,7 +237,7 @@
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
[super initWithCoder: aDecoder];
|
[super initWithCoder: aDecoder];
|
||||||
[aDecoder decodeValueOfObjCType: "i" at: &tag];
|
[aDecoder decodeValueOfObjCType: @encode(int) at: &tag];
|
||||||
target = [aDecoder decodeObject];
|
target = [aDecoder decodeObject];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &action];
|
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &action];
|
||||||
return self;
|
return self;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue