Happy new year! Bump copyright.
[macgdbp.git] / Source / BSSplitView.m
1 /*
2 * MacGDBp
3 * Copyright (c) 2007 - 2009, Blue Static <http://www.bluestatic.org>
4 *
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
10 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
15 */
16
17 #import "BSSplitView.h"
18
19
20 @implementation BSSplitView
21
22 /**
23 * Override the drawing method for the divider so we can make it prettier
24 *
25 * @todo draw the dimple
26 */
27 - (void)drawDividerInRect:(NSRect)rect
28 {
29 // draw the gradient
30 NSColor *startColor = [NSColor colorWithDeviceRed:0.875 green:0.875 blue:0.875 alpha:1.0];
31 NSColor *endColor = [NSColor colorWithDeviceRed:0.812 green:0.812 blue:0.812 alpha:1.0];
32 NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor];
33 [gradient drawInRect:rect angle:([self isVertical] ? 0.0 : 90.0)];
34 [gradient release];
35
36 // draw the stroke
37 [[NSColor colorWithDeviceRed:0.667 green:0.667 blue:0.667 alpha:1.0] setStroke];
38 [NSBezierPath setDefaultLineWidth:0.5];
39 [NSBezierPath strokeRect:rect];
40
41 // draw the dimple
42 NSImage *dimple = [NSImage imageNamed:@"dimple.png"];
43 NSSize dmpSize = [dimple size];
44 NSPoint origin = NSMakePoint((rect.size.width / 2) + rect.origin.x - (dmpSize.width / 2), (rect.size.height / 2) + rect.origin.y + (dmpSize.height / 2));
45 [dimple compositeToPoint:origin operation:NSCompositeSourceOver];
46 }
47
48 /**
49 * Returns the size of the divider to draw
50 */
51 - (CGFloat)dividerThickness;
52 {
53 return 6.0;
54 }
55
56 @end