mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-08 03:37:14 +00:00
Correctly convert NSButtons set as checkboxs and radiogroups to CPCheckBoxes and CPRadios.
Closes #365.
This commit is contained in:
@@ -46,12 +46,11 @@ _CPButtonBezelStyleHeights[CPHUDBezelStyle] = 20;
|
||||
{
|
||||
var cell = [aCoder decodeObjectForKey:@"NSCell"];
|
||||
|
||||
_controlSize = CPRegularControlSize;
|
||||
|
||||
_title = [cell title];
|
||||
|
||||
if (![self NS_isCheckBox] && ![self NS_isRadio])
|
||||
{
|
||||
_controlSize = CPRegularControlSize;
|
||||
_title = [cell title];
|
||||
|
||||
[self setBordered:[cell isBordered]];
|
||||
|
||||
_bezelStyle = [cell bezelStyle];
|
||||
@@ -101,7 +100,18 @@ _CPButtonBezelStyleHeights[CPHUDBezelStyle] = 20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (![self isKindOfClass:CPCheckBox] && ![self isKindOfClass:CPRadio])
|
||||
{
|
||||
if ([self NS_isCheckBox])
|
||||
return [[CPCheckBox alloc] NS_initWithCoder:aCoder];
|
||||
else
|
||||
return [[CPRadio alloc] NS_initWithCoder:aCoder];
|
||||
}
|
||||
|
||||
[self setBordered:YES];
|
||||
self._title = [cell title];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -119,6 +129,32 @@ _CPButtonBezelStyleHeights[CPHUDBezelStyle] = 20;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPRadio (NS)
|
||||
|
||||
- (BOOL)NS_isRadio
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
if (self = [super NS_initWithCoder:aCoder])
|
||||
_radioGroup = [CPRadioGroup new];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPCheckBox (NS)
|
||||
|
||||
- (BOOL)NS_isCheckBox
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSButton : CPButton
|
||||
{
|
||||
BOOL _isCheckBox @accessors(readonly, getter=NS_isCheckBox);
|
||||
|
||||
Reference in New Issue
Block a user