mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-05 12:15:32 +00:00
Added support for NSMatrix of radio buttons.
Reviewed by me.
This commit is contained in:
1 parent
c3d698bcac
commit
4ff6590e74
4 files changed
+56
-4
No files matched your search
+51
-2
@@ -52,8 +52,8 @@
|
||||
|
||||
if (self)
|
||||
{
|
||||
_radioGroup = aRadioGroup || [CPRadioGroup new];
|
||||
|
||||
[self setRadioGroup:aRadioGroup || [CPRadioGroup new]];
|
||||
|
||||
[self setHighlightsBy:CPContentsCellMask];
|
||||
[self setShowsStateBy:CPContentsCellMask];
|
||||
|
||||
@@ -102,6 +102,29 @@
|
||||
|
||||
@end
|
||||
|
||||
var CPRadioRadioGroupKey = @"CPRadioRadioGroupKey";
|
||||
|
||||
@implementation CPRadio (CPCoding)
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
|
||||
if (self)
|
||||
_radioGroup = [aCoder decodeObjectForKey:CPRadioRadioGroupKey];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeObject:_radioGroup forKey:CPRadioRadioGroupKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPRadioGroup : CPObject
|
||||
{
|
||||
CPSet _radios;
|
||||
@@ -157,3 +180,29 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPRadioGroupRadiosKey = @"CPRadioGroupRadiosKey",
|
||||
CPRadioGroupSelectedRadioKey = @"CPRadioGroupSelectedRadioKey";
|
||||
|
||||
@implementation CPRadioGroup (CPCoding)
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_radios = [aCoder decodeObjectForKey:CPRadioGroupRadiosKey];
|
||||
_selectedRadio = [aCoder decodeObjectForKey:CPRadioGroupSelectedRadioKey];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:_radios forKey:CPRadioGroupRadiosKey];
|
||||
[aCoder encodeObject:_selectedRadio forKey:CPRadioGroupSelectedRadioKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -32,6 +32,7 @@
|
||||
@import "NSFont.j"
|
||||
@import "NSIBObjectData.j"
|
||||
@import "NSImageView.j"
|
||||
@import "NSMatrix.j"
|
||||
@import "NSMenu.j"
|
||||
@import "NSMenuItem.j"
|
||||
@import "NSNibConnector.j"
|
||||
|
||||
@@ -185,6 +185,8 @@ _CPButtonBezelStyleHeights[CPHUDBezelStyle] = 20;
|
||||
|
||||
// NSContents for NSButton is actually the title
|
||||
_title = [aCoder decodeObjectForKey:@"NSContents"];
|
||||
// ... and _objectValue is _state
|
||||
_objectValue = [self state];
|
||||
|
||||
_alternateImage = [aCoder decodeObjectForKey:@"NSAlternateImage"];
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
{
|
||||
var flags = [aCoder decodeIntForKey:@"NSCellFlags"],
|
||||
flags2 = [aCoder decodeIntForKey:@"NSCellFlags2"];
|
||||
|
||||
|
||||
_state = (flags & 0x80000000) ? CPOnState : CPOffState;
|
||||
_isHighlighted = (flags & 0x40000000) ? YES : NO;
|
||||
_isEnabled = (flags & 0x20000000) ? NO : YES;
|
||||
@@ -66,7 +66,7 @@
|
||||
_wraps = (flags & 0x00100000) ? NO : YES;
|
||||
_alignment = (flags2 & 0x1c000000) >> 26;
|
||||
_controlSize = (flags2 & 0xE0000) >> 17;
|
||||
|
||||
|
||||
_objectValue = [aCoder decodeObjectForKey:@"NSContents"];
|
||||
_font = [aCoder decodeObjectForKey:@"NSSupport"];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user