3 * Copyright (c) 2007 - 2008, 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
29 NSColor
*startColor
= [NSColor colorWithDeviceRed
:0.875 green
:0.875 blue
:0.875 alpha
:1.0];
30 NSColor
*endColor
= [NSColor colorWithDeviceRed
:0.812 green
:0.812 blue
:0.812 alpha
:1.0];
33 NSGradient
*gradient
= [[NSGradient alloc
] initWithStartingColor
:startColor endingColor
:endColor
];
34 [gradient drawInRect
:rect angle
:([self isVertical
] ?
0.0 : 90.0)];
37 NSColor
*stroke
= [NSColor colorWithDeviceRed
:0.667 green
:0.667 blue
:0.667 alpha
:1.0];
39 [NSBezierPath setDefaultLineWidth
:0.5];
40 [NSBezierPath strokeRect
:rect
];
43 NSImage
*dimple
= [NSImage imageNamed
:@
"dimple.png"];
44 NSSize imgSize
= [dimple size
];
45 NSRect dimpleRect
= NSMakeRect((rect.size.width
/ 2) - (imgSize.width
/ 2) + rect.origin.x
, (rect.size.height
/ 2) - (imgSize.height
/ 2) + rect.origin.y
, imgSize.width
, imgSize.height
);
46 [dimple drawInRect
:dimpleRect fromRect
:NSZeroRect operation
:NSCompositeSourceOver fraction
:1.0];
50 * Returns the size of the divider to draw
52 - (CGFloat
)dividerThickness
;