Support level indicators as table cells through nib2cib.

This commit is contained in:
Alexander Ljungberg committed 2011-05-30 00:56:28 -04:00
1 parent 71364c9b1a
commit a6ee37e030
3 files changed
+28 -10

No files matched your search

+1 -2
View File
@@ -1544,7 +1544,6 @@ NOT YET IMPLEMENTED
_numberOfHiddenColumns += 1;
_tableColumnRanges[index] = CPMakeRange(x, 0.0);
}
else
{
var width = [_tableColumns[index] width] + _intercellSpacing.width;
@@ -1843,7 +1842,7 @@ NOT YET IMPLEMENTED
leftInset = FLOOR(_intercellSpacing.width / 2.0),
topInset = FLOOR(_intercellSpacing.height / 2.0);
return _CGRectMake(tableColumnRange.location + leftInset, _CGRectGetMinY(rectOfRow) + topInset, tableColumnRange.length - _intercellSpacing.width, _CGRectGetHeight(rectOfRow) - _intercellSpacing.height);
return _CGRectMake(tableColumnRange.location + leftInset, _CGRectGetMinY(rectOfRow) + topInset, tableColumnRange.length - _intercellSpacing.width, _CGRectGetHeight(rectOfRow) - _intercellSpacing.height);
}
/*!
+22 -8
View File
@@ -28,6 +28,7 @@
{
var cell = [aCoder decodeObjectForKey:@"NSCell"];
// Initialise before [super ...] to ensure setObjectValue constrains the values properly.
_minValue = [cell minValue];
_maxValue = [cell maxValue];
@@ -35,19 +36,32 @@
if (self)
{
_levelIndicatorStyle = [cell levelIndicatorStyle];
_warningValue = [cell warningValue];
_criticalValue = [cell criticalValue];
_tickMarkPosition = [cell tickMarkPosition];
_numberOfTickMarks = [cell numberOfTickMarks];
_numberOfMajorTickMarks = [cell numberOfMajorTickMarks];
[self setEditable:[cell isEditable]];
self = [self NS_initWithCell:cell];
}
return self;
}
/*!
Intialise the receiver given a cell. This method is meant for reuse by controls which contain
cells other than CPLevelIndicator itself.
*/
- (id)NS_initWithCell:(NSCell)cell
{
_minValue = [cell minValue];
_maxValue = [cell maxValue];
_levelIndicatorStyle = [cell levelIndicatorStyle];
_warningValue = [cell warningValue];
_criticalValue = [cell criticalValue];
_tickMarkPosition = [cell tickMarkPosition];
_numberOfTickMarks = [cell numberOfTickMarks];
_numberOfMajorTickMarks = [cell numberOfMajorTickMarks];
[self setEditable:[cell isEditable]];
return self;
}
@end
@implementation NSLevelIndicator : CPLevelIndicator
+5
View File
@@ -78,6 +78,11 @@
_dataView = [[CPButton alloc] initWithFrame:CGRectMakeZero()];
_dataView = [_dataView NS_initWithCell:dataViewCell];
}
else if ([dataViewCell isKindOfClass:[NSLevelIndicatorCell class]])
{
_dataView = [[CPLevelIndicator alloc] initWithFrame:CGRectMakeZero()];
_dataView = [_dataView NS_initWithCell:dataViewCell];
}
[_dataView setValue:[dataViewCell alignment] forThemeAttribute:@"alignment"];