mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-10 02:40:59 +00:00
Merge pull request #1537 from mrcarlberg/cptableview_selection_radius
Added a themed attribute for round rect selection of rows. [+1]
This commit is contained in:
commit
52199776d5
1 file changed
+21
-3
+21
-3
@@ -257,8 +257,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null]]
|
||||
forKeys:["alternating-row-colors", "grid-color", "highlighted-grid-color", "selection-color", "sourcelist-selection-color", "sort-image", "sort-image-reversed"]];
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null]]
|
||||
forKeys:["alternating-row-colors", "grid-color", "highlighted-grid-color", "selection-color", "sourcelist-selection-color", "sort-image", "sort-image-reversed", "selection-radius"]];
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
@@ -3773,7 +3773,25 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
CGContextStrokePath(context);
|
||||
}
|
||||
else
|
||||
CGContextAddRect(context, rowRect);
|
||||
{
|
||||
var radius = [self currentValueForThemeAttribute:@"selection-radius"];
|
||||
|
||||
if (radius > 0)
|
||||
{
|
||||
var minX = CGRectGetMinX(rowRect),
|
||||
maxX = CGRectGetMaxX(rowRect),
|
||||
minY = CGRectGetMinY(rowRect),
|
||||
maxY = CGRectGetMaxY(rowRect);
|
||||
|
||||
CGContextMoveToPoint(context, minX + radius, minY);
|
||||
CGContextAddArcToPoint(context, maxX, minY, maxX, minY + radius, radius);
|
||||
CGContextAddArcToPoint(context, maxX, maxY, maxX - radius, maxY, radius);
|
||||
CGContextAddArcToPoint(context, minX, maxY, minX, maxY - radius, radius);
|
||||
CGContextAddArcToPoint(context, minX, minY, minX + radius, minY, radius);
|
||||
}
|
||||
else
|
||||
CGContextAddRect(context, rowRect);
|
||||
}
|
||||
}
|
||||
|
||||
CGContextClosePath(context);
|
||||
|
||||
Reference in new issue
Block a user