Small improvements for keyed decoding.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20242 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2004-10-21 21:01:36 +00:00
parent 208c87b881
commit 6ff377994a
3 changed files with 45 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2004-10-21 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSResponder.m (-initWithCoder:): Set missing default
value for menu to nil.
* Source/NSButtonCell.m (-initWithCoder:): Hack around Apple NIB
bug and decode some of the flags.
2004-10-17 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSCell.m: Added code to [NSCell initWithCoder:] which

View file

@ -1300,7 +1300,14 @@
}
if ([aDecoder containsValueForKey: @"NSAlternateImage"])
{
[self setAlternateImage: [aDecoder decodeObjectForKey: @"NSAlternateImage"]];
id image;
image = [aDecoder decodeObjectForKey: @"NSAlternateImage"];
// This test works around an Apple bug, where a font gets encoded here.
if ([image isKindOfClass: [NSImage class]])
{
[self setAlternateImage: image];
}
}
if ([aDecoder containsValueForKey: @"NSAlternateContents"])
{
@ -1308,8 +1315,37 @@
}
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
{
int highlights = 0;
int show_state = NSNoCellMask;
bFlags = [aDecoder decodeIntForKey: @"NSButtonFlags"];
// FIXME
if ((bFlags & 0x800000) == 0x800000)
{
[self setBezelStyle: NSRegularSquareBezelStyle];
}
if ((bFlags & 0x6000000) == 0x6000000)
{
highlights |= NSChangeBackgroundCellMask;
}
if ((bFlags & 0x8000000) == 0x8000000)
{
highlights |= NSContentsCellMask;
}
if ((bFlags & 0x30000000) == 0x30000000)
{
show_state |= NSChangeBackgroundCellMask;
}
if ((bFlags & 0x40000000) == 0x40000000)
{
show_state |= NSContentsCellMask;
}
if ((bFlags & 0x80000000) == 0x80000000)
{
highlights |= NSPushInCellMask;
}
[self setHighlightsBy: highlights];
[self setShowsStateBy: show_state];
[self setImagePosition: NSImageLeft];
}
if ([aDecoder containsValueForKey: @"NSButtonFlags2"])

View file

@ -362,7 +362,7 @@
- (id) initWithCoder: (NSCoder*)aDecoder
{
id obj;
id obj = nil;
if([aDecoder allowsKeyedCoding])
{