2 // ESSourceListBackgroundView.m
5 // Created by Evan Schoenberg on 6/26/06.
8 #import "ESSourceListBackgroundView.h"
9 #import <Adium/KNShelfSplitView.h>
10 #import <AIUtilities/AIImageAdditions.h>
12 @implementation ESSourceListBackgroundView
14 - (void)_initSourceListBackgroundView
16 background = [[NSImage imageNamed:@"sourceListBackground" forClass:[KNShelfSplitView class]] retain];
17 backgroundSize = [background size];
19 [self setNeedsDisplay:YES];
22 - (id)initWithCoder:(NSCoder *)inCoder
24 if ((self = [super initWithCoder:inCoder])) {
25 [self _initSourceListBackgroundView];
31 - (id)initWithFrame:(NSRect)frame
33 if ((self = [super initWithFrame:frame])) {
34 [self _initSourceListBackgroundView];
47 - (void)drawRect:(NSRect)rect
49 [super drawRect:rect];
51 NSRect frame = [self frame];
53 //Draw the background, tiling across
54 NSRect sourceRect = NSMakeRect(0, 0, backgroundSize.width, backgroundSize.height);
55 NSRect destRect = NSMakeRect(0, 0, sourceRect.size.width, frame.size.height);
57 while ((destRect.origin.x < NSWidth(frame)) && destRect.size.width > 0) {
59 if (NSMaxX(destRect) > NSWidth(frame)) {
60 sourceRect.size.width = NSWidth(destRect);
63 [background drawInRect:destRect
65 operation:NSCompositeSourceOver
67 destRect.origin.x += NSWidth(destRect);
70 //Draw a border line at the top
71 NSRect lineRect = NSMakeRect(0, frame.size.height-1, NSWidth(frame), 1);
72 [[NSColor windowFrameColor] set];