3 * Copyright (c) 2007 - 2009, Blue Static <http://www.bluestatic.org>
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.
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.
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
17 #import "BSSplitView.h"
20 @implementation BSSplitView
23 * Override the drawing method for the divider so we can make it prettier
25 * @todo draw the dimple
27 - (void)drawDividerInRect
:(NSRect
)rect
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)];
37 [[NSColor colorWithDeviceRed
:0.667 green
:0.667 blue
:0.667 alpha
:1.0] setStroke
];
38 [NSBezierPath setDefaultLineWidth
:0.5];
39 [NSBezierPath strokeRect
:rect
];
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
];
49 * Returns the size of the divider to draw
51 - (CGFloat
)dividerThickness
;