mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
28 lines
562 B
Objective-C
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
|