forked from mikecsh/mbtablegrid
-
Notifications
You must be signed in to change notification settings - Fork 3
/
MBGroupSummaryCell.m
42 lines (31 loc) · 1.12 KB
/
MBGroupSummaryCell.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// MBGroupSummaryCell.m
// MBTableGrid
//
// Created by David Sinclair on 2017-05-24.
//
#import "MBGroupSummaryCell.h"
@implementation MBGroupSummaryCell
- (NSAttributedString *)attributedTitle
{
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = self.alignment;
NSDictionary *attributes = @{NSFontAttributeName : self.font, NSForegroundColorAttributeName : self.textColor,
NSParagraphStyleAttributeName : paragraphStyle};
return [[NSAttributedString alloc] initWithString:self.title attributes:attributes];
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
[self.borderColor set];
// Draw the right border
if (self.isLastColumn) {
NSRect rightLine = NSMakeRect(NSMaxX(cellFrame) - 1, NSMinY(cellFrame), 1.0, NSHeight(cellFrame));
NSRectFill(rightLine);
}
// Draw the bottom border
NSRect bottomLine = NSMakeRect(NSMinX(cellFrame), NSMaxY(cellFrame) - 1.0, NSWidth(cellFrame), 1.0);
NSRectFill(bottomLine);
cellFrame.size.width -= 6;
[self drawInteriorWithFrame:cellFrame inView:controlView];
}
@end