mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-06 09:02:50 +00:00
Call to NS_initWithCoder MUST be first, later code relies on a properly constructed object.
This commit is contained in:
1 parent
e9607dc764
commit
698f2fe77f
1 file changed
+18
-13
+18
-13
@@ -165,26 +165,31 @@ _CPButtonBezelStyleHeights[CPHUDBezelStyle] = 20;
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
// We need to do a bit of magic to determine if this is a checkbox or radio button.
|
||||
var cell = [aCoder decodeObjectForKey:@"NSCell"],
|
||||
alternateImage = [cell alternateImage];
|
||||
var self = [self NS_initWithCoder:aCoder];
|
||||
|
||||
if ([alternateImage isKindOfClass:[NSButtonImageSource class]])
|
||||
if (self)
|
||||
{
|
||||
if ([alternateImage imageName] === @"NSSwitch")
|
||||
_isCheckBox = YES;
|
||||
// We need to do a bit of magic to determine if this is a checkbox or radio button.
|
||||
var cell = [aCoder decodeObjectForKey:@"NSCell"],
|
||||
alternateImage = [cell alternateImage];
|
||||
|
||||
else if ([alternateImage imageName] === @"NSRadioButton")
|
||||
if ([alternateImage isKindOfClass:[NSButtonImageSource class]])
|
||||
{
|
||||
_isRadio = YES;
|
||||
self._radioGroup = [CPRadioGroup new];
|
||||
if ([alternateImage imageName] === @"NSSwitch")
|
||||
_isCheckBox = YES;
|
||||
|
||||
else if ([alternateImage imageName] === @"NSRadioButton")
|
||||
{
|
||||
_isRadio = YES;
|
||||
self._radioGroup = [CPRadioGroup new];
|
||||
}
|
||||
}
|
||||
|
||||
[self setKeyEquivalent:[cell keyEquivalent]];
|
||||
_keyEquivalentModifierMask = [cell keyEquivalentModifierMask];
|
||||
}
|
||||
|
||||
[self setKeyEquivalent:[cell keyEquivalent]];
|
||||
_keyEquivalentModifierMask = [cell keyEquivalentModifierMask];
|
||||
|
||||
return [self NS_initWithCoder:aCoder];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (Class)classForKeyedArchiver
|
||||
|
||||
Reference in new issue
Block a user