File: GBCenteredTextCell.m

package info (click to toggle)
sameboy 1.0.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,632 kB
  • sloc: ansic: 29,954; objc: 22,249; asm: 1,424; pascal: 1,373; makefile: 1,064; xml: 111
file content (29 lines) | stat: -rw-r--r-- 1,221 bytes parent folder | download | duplicates (2)
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
#import "GBCenteredTextCell.h"

@implementation GBCenteredTextCell
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
    double height = round([self.attributedStringValue size].height);
    cellFrame.origin.y += (cellFrame.size.height - height) / 2;
    cellFrame.size.height = height;
    [super drawInteriorWithFrame:cellFrame inView:controlView];
}


- (void)selectWithFrame:(NSRect)rect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)delegate start:(NSInteger)selStart length:(NSInteger)selLength
{
    double height = round([self.attributedStringValue size].height);
    rect.origin.y += (rect.size.height - height) / 2;
    rect.size.height = height;
    [super selectWithFrame:rect inView:controlView editor:textObj delegate:delegate start:selStart length:selLength];
}

- (void)editWithFrame:(NSRect)rect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)delegate event:(NSEvent *)event
{
    double height = round([self.attributedStringValue size].height);
    rect.origin.y += (rect.size.height - height) / 2;
    rect.size.height = height;
    [super editWithFrame:rect inView:controlView editor:textObj delegate:delegate event:event];

}
@end