Added a debug log to investigate #8685, as it worksforme. Refs #8685
[adiumx.git] / Source / ESSourceListBackgroundView.m
blobcd5d9786ef9a68b924cb3dbece47ee911c1ddbe2
1 //
2 //  ESSourceListBackgroundView.m
3 //  Adium
4 //
5 //  Created by Evan Schoenberg on 6/26/06.
6 //
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];
18         
19         [self setNeedsDisplay:YES];
22 - (id)initWithCoder:(NSCoder *)inCoder
24         if ((self = [super initWithCoder:inCoder])) {
25                 [self _initSourceListBackgroundView];
26         }
27         
28         return self;
31 - (id)initWithFrame:(NSRect)frame
33         if ((self = [super initWithFrame:frame])) {
34                 [self _initSourceListBackgroundView];
35         }
36         
37         return self;
40 - (void)dealloc
42         [background release];
43         
44         [super dealloc];
47 - (void)drawRect:(NSRect)rect
49         [super drawRect:rect];
50         
51         NSRect  frame = [self frame];
52         
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);
56         
57     while ((destRect.origin.x < NSWidth(frame)) && destRect.size.width > 0) {
58         //Crop
59         if (NSMaxX(destRect) > NSWidth(frame)) {
60             sourceRect.size.width = NSWidth(destRect);
61         }
62                 
63         [background drawInRect:destRect
64                                           fromRect:sourceRect
65                                          operation:NSCompositeSourceOver
66                                           fraction:1.0];
67         destRect.origin.x += NSWidth(destRect);
68     }
69         
70         //Draw a border line at the top
71         NSRect lineRect = NSMakeRect(0, frame.size.height-1, NSWidth(frame), 1);
72         [[NSColor windowFrameColor] set];
73         NSRectFill(lineRect);
76 @end