Readded NSCell setType: patch with originally missing bit for NSButtonCell.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20072 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
FredKiefer 2004-09-16 13:44:00 +00:00
parent 6e7e41aebc
commit 827a624bc2
4 changed files with 45 additions and 8 deletions

View file

@ -1,3 +1,12 @@
2004-09-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCell.m (-setStringValue:, -setFont:, -setImage:): Use
method call to change cell type. (Readded this change)
* Source/NSButtonCell.m (-setType:): Overwrite super method with
empty implementation. Patch by Quentin Mathe <qmathe@club-internet.fr>.
* Source/NSView.m (-initWithCoder:): Added the first bit of
keyed flags decoding.
2004-09-16 Matt Rice <ratmice@yahoo.com> 2004-09-16 Matt Rice <ratmice@yahoo.com>
* Source/NSTextFieldCell.m (+initialize): Bump class version. * Source/NSTextFieldCell.m (+initialize): Bump class version.
(-initWithCoder:): When decoding the previous version of NSTextFieldCell (-initWithCoder:): When decoding the previous version of NSTextFieldCell

View file

@ -129,6 +129,23 @@
[super dealloc]; [super dealloc];
} }
- (void) setType: (NSCellType)aType
{
/* We do nothing here (we match the Mac OS X behavior) because with
* NSButtonCell GNUstep implementation the cell type is binded to the image
* position. Such behavior has been choosen because it permits to have
* -setFont: -setTitle -setImage: methods which are symetrical by not altering
* the cell type, morevover a cell type is more characterized by the potential
* visibility of the image (which is under the control of the method
* -setImagePosition:) than by the value of the image ivar itself (related to
* -setImage: method).
* On Mac OS X, the NSButtonCell cell type is NSTextCellType by default or
* NSImageCellType if the initialization has been done with -initImageCell:,
* it should be noted that the cell type never changes later.
*/
}
/* /*
* Setting the Titles * Setting the Titles
*/ */

View file

@ -344,7 +344,10 @@ static NSColor *shadowCol;
@"Attempt to use nil as string value"); @"Attempt to use nil as string value");
} }
_cell.type = NSTextCellType; if (_cell.type != NSTextCellType)
{
[self setType: NSTextCellType];
}
_cell.contents_is_attributed_string = NO; _cell.contents_is_attributed_string = NO;
if (_formatter == nil) if (_formatter == nil)
@ -739,13 +742,13 @@ static NSColor *shadowCol;
- (void) setFont: (NSFont*)fontObject - (void) setFont: (NSFont*)fontObject
{ {
// This does not have any influence on attributed strings
ASSIGN (_font, fontObject);
if (_cell.type != NSTextCellType) if (_cell.type != NSTextCellType)
{ {
_cell.type = NSTextCellType; [self setType: NSTextCellType];
} }
// This does not have any influence on attributed strings
ASSIGN (_font, fontObject);
} }
- (void) setSelectable: (BOOL)flag - (void) setSelectable: (BOOL)flag
@ -970,7 +973,10 @@ static NSColor *shadowCol;
NSInvalidArgumentException); NSInvalidArgumentException);
} }
_cell.type = NSImageCellType; if (_cell.type != NSImageCellType)
{
[self setType: NSImageCellType];
}
ASSIGN (_cell_image, anImage); ASSIGN (_cell_image, anImage);
} }
@ -2213,6 +2219,7 @@ static NSColor *shadowCol;
[anImage compositeToPoint: position operation: NSCompositeSourceOver]; [anImage compositeToPoint: position operation: NSCompositeSourceOver];
} }
- (BOOL) _sendsActionOn:(int)eventTypeMask - (BOOL) _sendsActionOn:(int)eventTypeMask
{ {
return (_action_mask & eventTypeMask); return (_action_mask & eventTypeMask);

View file

@ -3785,8 +3785,12 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
} }
if ([aDecoder containsValueForKey: @"NSvFlags"]) if ([aDecoder containsValueForKey: @"NSvFlags"])
{ {
//int vFlags = [aDecoder decodeIntForKey: @"NSvFlags"]; int vFlags = [aDecoder decodeIntForKey: @"NSvFlags"];
// FIXME set the flags
// We are lucky here, Apple use the same constants
// in the lower bits of the flags
[self setAutoresizingMask: vFlags & 0x3F];
[self setHidden: vFlags & (1 << 32)];
} }
} }
else else