aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/ImageAndTextCell.m2
-rw-r--r--Source/SPTableTextFieldCell.m22
2 files changed, 19 insertions, 5 deletions
diff --git a/Source/ImageAndTextCell.m b/Source/ImageAndTextCell.m
index ad6ec247..ddcf05d7 100644
--- a/Source/ImageAndTextCell.m
+++ b/Source/ImageAndTextCell.m
@@ -110,6 +110,8 @@
else
imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
+ imageFrame.origin.y -= 1;
+
[image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
} else
if (_indentationLevel == 0)
diff --git a/Source/SPTableTextFieldCell.m b/Source/SPTableTextFieldCell.m
index 47160fa4..d08486bb 100644
--- a/Source/SPTableTextFieldCell.m
+++ b/Source/SPTableTextFieldCell.m
@@ -34,24 +34,36 @@
{
// Construct and get the sub text attributed string
NSAttributedString *string = [self attributedStringValue];
-
+
int i;
float maxWidth = cellFrame.size.width;
float stringWidth = [string size].width;
-
+
// Set a right padding
maxWidth -= 5;
-
+
if (maxWidth < stringWidth) {
for (i = 0; i <= [string length]; i++) {
- if (([[string attributedSubstringFromRange:NSMakeRange(0, i)] size].width >= maxWidth) && (i >= 3)) {
+ if (([[string attributedSubstringFromRange:NSMakeRange(0, i)] size].width >= maxWidth) && (i >= 3)) {
string = [[[NSMutableAttributedString alloc] initWithString:[[[string attributedSubstringFromRange:NSMakeRange(0, i - 3)] string] stringByAppendingString:@"..."] attributes:[string attributesAtIndex:0 effectiveRange:NULL]] autorelease];
+ break;
}
}
}
-
+
[self setAttributedStringValue:string];
[super drawInteriorWithFrame:cellFrame inView:controlView];
+
+}
+
+- (NSSize)cellSize
+{
+ NSSize cellSize = [super cellSize];
+
+ cellSize.width = [[self attributedStringValue] size].width + (([self image] != nil) ? [[self image] size].width : 0) + 25;
+ cellSize.height = [[self attributedStringValue] size].height + 14.0;
+
+ return cellSize;
}
@end