-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathPaddedTextFieldCell.m
More file actions
56 lines (48 loc) · 1.14 KB
/
PaddedTextFieldCell.m
File metadata and controls
56 lines (48 loc) · 1.14 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// PaddedTextFieldCell.m
// StatusItem
//
// Created by Joshua Garnham on 17/04/2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "PaddedTextFieldCell.h"
@implementation PaddedTextFieldCell
@dynamic leftMargin;
- (void)drawInteriorWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView
{
if (leftMargin == 0)
leftMargin = 15;
cellFrame.origin.x += leftMargin;
cellFrame.size.width -= leftMargin;
[super drawInteriorWithFrame:cellFrame
inView:controlView];
}
- (void)selectWithFrame:(NSRect)aRect
inView:(NSView *)controlView
editor:(NSText *)textObj
delegate:(id)anObject
start:(NSInteger)selStart
length:(NSInteger)selLength
{
aRect.origin.x += leftMargin;
aRect.size.width -= leftMargin;
[super selectWithFrame:aRect
inView:controlView
editor:textObj
delegate:anObject
start:selStart
length:selLength];
}
- (NSRect)_focusRingFrameForFrame:(NSRect)frame
cellFrame:(NSRect)cellFrame
{
return [[self controlView] bounds];
}
- (int)leftMargin {
return leftMargin;
}
- (void)setLeftMargin:(int)newMargin {
leftMargin = newMargin;
}
@end