aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-11-02 08:29:00 +0000
committerBibiko <bibiko@eva.mpg.de>2009-11-02 08:29:00 +0000
commit8e527f643cd29cde785db48a45a73a316cc84474 (patch)
treee3fdcd7c716e7d2f76501d33d501314da25d59a5 /Source
parent87099cc81ddec5c695f4a62fa3c69de228523c82 (diff)
downloadsequelpro-8e527f643cd29cde785db48a45a73a316cc84474.tar.gz
sequelpro-8e527f643cd29cde785db48a45a73a316cc84474.tar.bz2
sequelpro-8e527f643cd29cde785db48a45a73a316cc84474.zip
• fixed: return correct SPTableTextFieldCell 's cellSize for tooltip expansion frame rect
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