From 3480aab9126048c3ae96ed6d2864ce8c13943d5b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 16 Jan 2011 01:30:03 -0500 Subject: [PATCH] Clean up BSSplitView --- Source/BSSplitView.h | 6 +----- Source/BSSplitView.m | 9 +++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Source/BSSplitView.h b/Source/BSSplitView.h index 5d0fe8f..e2ab6e8 100644 --- a/Source/BSSplitView.h +++ b/Source/BSSplitView.h @@ -16,10 +16,6 @@ #import - +// A split view that performs custom drawing to get a gradient on the divider. @interface BSSplitView : NSSplitView -{ - -} - @end diff --git a/Source/BSSplitView.m b/Source/BSSplitView.m index d3963a2..7549787 100644 --- a/Source/BSSplitView.m +++ b/Source/BSSplitView.m @@ -26,22 +26,23 @@ */ - (void)drawDividerInRect:(NSRect)rect { - // draw the gradient + // Draw the gradient. NSColor* startColor = [NSColor colorWithDeviceRed:0.875 green:0.875 blue:0.875 alpha:1.0]; NSColor* endColor = [NSColor colorWithDeviceRed:0.812 green:0.812 blue:0.812 alpha:1.0]; NSGradient* gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor]; [gradient drawInRect:rect angle:([self isVertical] ? 0.0 : 90.0)]; [gradient release]; - // draw the stroke + // Stroke the divider. [[NSColor colorWithDeviceRed:0.667 green:0.667 blue:0.667 alpha:1.0] setStroke]; [NSBezierPath setDefaultLineWidth:0.5]; [NSBezierPath strokeRect:rect]; - // draw the dimple + // Draw the dimple image. NSImage* dimple = [NSImage imageNamed:@"dimple.png"]; NSSize dmpSize = [dimple size]; - NSPoint origin = NSMakePoint((rect.size.width / 2) + rect.origin.x - (dmpSize.width / 2), (rect.size.height / 2) + rect.origin.y + (dmpSize.height / 2)); + NSPoint origin = NSMakePoint(NSMidX(rect) - (dmpSize.width / 2), + NSMidY(rect) + (dmpSize.height / 2)); [dimple compositeToPoint:origin operation:NSCompositeSourceOver]; } -- 2.43.5