diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-10-12 15:59:07 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-10-12 15:59:07 +0000 |
commit | 9fc4f973499e8d3bf327f699cd0e18d7e640a54d (patch) | |
tree | 9d190c8667790440b4743c6ac1331f9a9db112fb /Source/SPFavoriteTextFieldCell.m | |
parent | 29c40c62b9afa5eb3c61b8904b5213750bed558a (diff) | |
download | sequelpro-9fc4f973499e8d3bf327f699cd0e18d7e640a54d.tar.gz sequelpro-9fc4f973499e8d3bf327f699cd0e18d7e640a54d.tar.bz2 sequelpro-9fc4f973499e8d3bf327f699cd0e18d7e640a54d.zip |
• first steps to improve the general tooltip behaviour of 'ImageAndTextCell' class
• simplified the tooltip of Preference's Favorite List
Diffstat (limited to 'Source/SPFavoriteTextFieldCell.m')
-rw-r--r-- | Source/SPFavoriteTextFieldCell.m | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Source/SPFavoriteTextFieldCell.m b/Source/SPFavoriteTextFieldCell.m index af65d28e..1c1c6f86 100644 --- a/Source/SPFavoriteTextFieldCell.m +++ b/Source/SPFavoriteTextFieldCell.m @@ -129,14 +129,14 @@ // Total height of both strings with a 2 pixel separation space float totalHeight = [mainString size].height + [subString size].height + 1.0; - cellFrame.origin.y += (cellFrame.size.height - totalHeight) / 2.0; + cellFrame.origin.y += (cellFrame.size.height - totalHeight) / 2.0; cellFrame.origin.x += 10.0; // Indent main string from image // Position the sub text's frame rect subFrame.origin.y = [mainString size].height + cellFrame.origin.y + 1.0; subFrame.origin.x = cellFrame.origin.x; - cellFrame.size.height = totalHeight; + cellFrame.size.height = totalHeight; int i; float maxWidth = cellFrame.size.width; @@ -166,10 +166,20 @@ [subString drawInRect:subFrame]; } -// Suppress built-in tooltips -- (NSRect)expansionFrameWithFrame:(NSRect)cellFrame inView:(NSView *)view +- (NSSize)cellSize { - return NSMakeRect(0,0,0,0); + NSSize cellSize = [super cellSize]; + NSAttributedString *mainString = [[self attributedStringForFavoriteName] autorelease]; + NSAttributedString *subString = [[self constructSubStringAttributedString] autorelease]; + + // 15 := indention 10 from image to string plus 5 px padding + float theWidth = MAX([mainString size].width, [subString size].width) + (([self image] != nil) ? [[self image] size].width : 0) + 15; + + float totalHeight = [mainString size].height + [subString size].height + 1.0; + + cellSize.width = theWidth; + cellSize.height = totalHeight + 13.0; + return cellSize; } // ------------------------------------------------------------------------------- |