aboutsummaryrefslogtreecommitdiffstats
path: root/ImageAndTextCell.m
diff options
context:
space:
mode:
authormltownsend <mltownsend@gmail.com>2008-11-10 19:56:30 +0000
committermltownsend <mltownsend@gmail.com>2008-11-10 19:56:30 +0000
commitc8146f9c28da66f02d47537e505a70725fb0c2b4 (patch)
treef967e1cadc654ea262f5fa7402572fdc2482d60d /ImageAndTextCell.m
parent87173093000bc5c36962451cc3e58c9aaac5ab50 (diff)
downloadsequelpro-c8146f9c28da66f02d47537e505a70725fb0c2b4.tar.gz
sequelpro-c8146f9c28da66f02d47537e505a70725fb0c2b4.tar.bz2
sequelpro-c8146f9c28da66f02d47537e505a70725fb0c2b4.zip
New XCode project
Diffstat (limited to 'ImageAndTextCell.m')
-rwxr-xr-xImageAndTextCell.m92
1 files changed, 46 insertions, 46 deletions
diff --git a/ImageAndTextCell.m b/ImageAndTextCell.m
index 96c0ff9d..a8165f85 100755
--- a/ImageAndTextCell.m
+++ b/ImageAndTextCell.m
@@ -10,45 +10,45 @@
@implementation ImageAndTextCell
- (void)dealloc {
- [image release];
- image = nil;
- [super dealloc];
+ [image release];
+ image = nil;
+ [super dealloc];
}
- copyWithZone:(NSZone *)zone
{
- ImageAndTextCell *cell = (ImageAndTextCell *)[super copyWithZone:zone];
- cell->image = [image retain];
- return cell;
+ ImageAndTextCell *cell = (ImageAndTextCell *)[super copyWithZone:zone];
+ cell->image = [image retain];
+ return cell;
}
- (void)setImage:(NSImage *)anImage
{
- if (anImage != image)
+ if (anImage != image)
{
- [image release];
- image = [anImage retain];
- }
+ [image release];
+ image = [anImage retain];
+ }
}
- (NSImage *)image
{
- return image;
+ return image;
}
- (NSRect)imageFrameForCellFrame:(NSRect)cellFrame
{
- if (image != nil)
+ if (image != nil)
{
- NSRect imageFrame;
- imageFrame.size = [image size];
- imageFrame.origin = cellFrame.origin;
- imageFrame.origin.x += ((1 - MIN(1,INDENT_AMOUNT)) * 3) + (INDENT_AMOUNT * _indentationLevel);
- imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
- return imageFrame;
- }
- else
- return NSZeroRect;
+ NSRect imageFrame;
+ imageFrame.size = [image size];
+ imageFrame.origin = cellFrame.origin;
+ imageFrame.origin.x += ((1 - MIN(1,INDENT_AMOUNT)) * 3) + (INDENT_AMOUNT * _indentationLevel);
+ imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
+ return imageFrame;
+ }
+ else
+ return NSZeroRect;
}
- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent
@@ -63,7 +63,7 @@
NSDivideRect (aRect, &imageFrame, &aRect, 3 + [image size].width, NSMinXEdge);
}
- [super editWithFrame:aRect inView: controlView editor:textObj delegate:anObject event:theEvent];
+ [super editWithFrame:aRect inView: controlView editor:textObj delegate:anObject event:theEvent];
}
- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength
@@ -78,7 +78,7 @@
NSDivideRect (aRect, &imageFrame, &aRect, 3 + [image size].width, NSMinXEdge);
}
- [super selectWithFrame:aRect inView: controlView editor:textObj delegate:anObject start:selStart length:selLength];
+ [super selectWithFrame:aRect inView: controlView editor:textObj delegate:anObject start:selStart length:selLength];
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
@@ -89,36 +89,36 @@
NSDivideRect(cellFrame, &indentationFrame, &cellFrame, (INDENT_AMOUNT * _indentationLevel), NSMinXEdge);
}
- if (image != nil)
+ if (image != nil)
{
- NSSize imageSize;
- NSRect imageFrame;
+ NSSize imageSize;
+ NSRect imageFrame;
- imageSize = [image size];
- NSDivideRect(cellFrame, &imageFrame, &cellFrame, 3 + imageSize.width, NSMinXEdge);
- if ([self drawsBackground])
+ imageSize = [image size];
+ NSDivideRect(cellFrame, &imageFrame, &cellFrame, 3 + imageSize.width, NSMinXEdge);
+ if ([self drawsBackground])
{
- [[self backgroundColor] set];
- NSRectFill(imageFrame);
- }
- imageFrame.origin.x += 3;
- imageFrame.size = imageSize;
-
- if ([controlView isFlipped])
- imageFrame.origin.y += ceil((cellFrame.size.height + imageFrame.size.height) / 2);
- else
- imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
-
- [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
- }
- [super drawWithFrame:cellFrame inView:controlView];
+ [[self backgroundColor] set];
+ NSRectFill(imageFrame);
+ }
+ imageFrame.origin.x += 3;
+ imageFrame.size = imageSize;
+
+ if ([controlView isFlipped])
+ imageFrame.origin.y += ceil((cellFrame.size.height + imageFrame.size.height) / 2);
+ else
+ imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
+
+ [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
+ }
+ [super drawWithFrame:cellFrame inView:controlView];
}
- (NSSize)cellSize
{
- NSSize cellSize = [super cellSize];
- cellSize.width += (image ? [image size].width : 0) + ((1 - MIN(1,INDENT_AMOUNT)) * 3) + (INDENT_AMOUNT * _indentationLevel);
- return cellSize;
+ NSSize cellSize = [super cellSize];
+ cellSize.width += (image ? [image size].width : 0) + ((1 - MIN(1,INDENT_AMOUNT)) * 3) + (INDENT_AMOUNT * _indentationLevel);
+ return cellSize;
}
- (void)setIndentationLevel:(int)level