1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00
transmission/macosx/ImageBackgroundView.m

28 lines
562 B
Objective-C

#import "ImageBackgroundView.h"
@implementation ImageBackgroundView
- (void) setBackgroundImage: (NSImage *) image
{
if (fBackgroundColor)
[fBackgroundColor release];
fBackgroundColor = [[NSColor colorWithPatternImage: image] retain];
}
- (void) dealloc
{
[fBackgroundColor release];
[super dealloc];
}
- (void) drawRect: (NSRect) rect
{
if (fBackgroundColor)
{
[fBackgroundColor set];
[[NSGraphicsContext currentContext] setPatternPhase: [self frame].origin];
NSRectFill([self bounds]);
}
}
@end