Added the Add Bookmark toolbar item to the default toolbar. Refs #8772
[adiumx.git] / Source / ESGlassSplitView.m
blob86fef89629ffcc4c0296b24d8aba9d463945c507
1 //
2 //  ESGlassSplitView.m
3 //  Adium
4 //
5 //  Created by Evan Schoenberg on 6/30/06.
6 //
8 #import "ESGlassSplitView.h"
9 #import <Adium/KNShelfSplitView.h>
10 #import <AIUtilities/AIImageAdditions.h>
12 @implementation ESGlassSplitView
13 - (void)_initGlassSplitView
15         background = [[NSImage imageNamed:@"sourceListBackground" forClass:[KNShelfSplitView class]] retain];
16         backgroundSize = [background size];
17         
18         [self setNeedsDisplay:YES];
21 - (id)initWithCoder:(NSCoder *)inCoder
23         if ((self = [super initWithCoder:inCoder])) {
24                 [self _initGlassSplitView];
25         }
26         
27         return self;
30 - (id)initWithFrame:(NSRect)frame
32         if ((self = [super initWithFrame:frame])) {
33                 [self _initGlassSplitView];
34         }
35         
36         return self;
39 - (void)dealloc
41         [background release];
42         
43         [super dealloc];
46 -(void)drawDividerInRect:(NSRect)aRect
47 {       
48         //Draw the background, tiling across
49     NSRect sourceRect = NSMakeRect(0, 0, backgroundSize.width, backgroundSize.height);
50     NSRect destRect = NSMakeRect(aRect.origin.x, aRect.origin.y, sourceRect.size.width, aRect.size.width);
51         
52     while ((NSMinX(destRect) < NSMaxX(aRect)) && NSWidth(destRect) > 0) {
53         //Crop
54         if (NSMaxX(destRect) > NSMaxX(aRect)) {
55             sourceRect.size.width = NSWidth(destRect);
56         }
57                 
58         [background drawInRect:destRect
59                                           fromRect:sourceRect
60                                          operation:NSCompositeSourceOver
61                                           fraction:1.0];
62         destRect.origin.x += NSWidth(destRect);
63     }
64         
65         //Draw the borders
66         [[NSColor windowFrameColor] set];
67         NSRectFill(NSMakeRect(aRect.origin.x, aRect.origin.y, aRect.size.width, 1.0));
68         NSRectFill(NSMakeRect(aRect.origin.x, aRect.origin.y + aRect.size.height - 1, aRect.size.width, 1.0));
69         
70         //Draw the thumb
71         //[[NSColor blackColor] set];
72         NSBezierPath *ovalPath = [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(aRect.origin.x + (aRect.size.width / 2.0) - 2,
73                                                                                                                                                            aRect.origin.y + (aRect.size.height / 2.0) - 2,
74                                                                                                                                                            4,
75                                                                                                                                                            4
76                                                                                                                                                            )];
77         [[[NSColor lightGrayColor] colorWithAlphaComponent:0.5] set];
78         [ovalPath fill];
80         [ovalPath setLineWidth:0];
81         [[NSColor windowFrameColor] set];
82         [ovalPath stroke];
85 @end