Commits

Joris Kluivers  committed bb552cb Merge

Merged in mz2/cocoa-configurations (pull request #1: Header gradient start and end color made configurable.)

  • Participants
  • Parent commits 8be9e03, 3bd94f9

Comments (0)

Files changed (2)

File Inspector/JKConfigurationHeaderView.h

 
 @interface JKConfigurationHeaderView : NSTableCellView
 
+@property (strong) NSColor *headerGradientStartColor;
+@property (strong) NSColor *headerGradientEndColor;
+
 @end

File Inspector/JKConfigurationHeaderView.m

 
 #import "JKConfigurationHeaderView.h"
 
+
 @implementation JKConfigurationHeaderView
 
 - (void) awakeFromNib
 {
-	[self.textField.cell setBackgroundStyle:NSBackgroundStyleRaised];
+    // the Xcode purple
+    #define JKColor(r, g, b) [NSColor colorWithDeviceRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1.0f]
+    if (!self.headerGradientEndColor)
+        self.headerGradientEndColor = JKColor(189, 192, 212);
+	if (!self.headerGradientStartColor)
+        self.headerGradientStartColor = JKColor(236, 237, 250);
+	
+    [self.textField.cell setBackgroundStyle:NSBackgroundStyleRaised];
 }
 
 - (void)drawRect:(NSRect)dirtyRect
 {
-#define JKColor(r, g, b) [NSColor colorWithDeviceRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1.0f]
-	
-	// purlple like
-	NSColor *startColor = JKColor(236, 237, 250);
-	NSColor *endColor = JKColor(189, 192, 212);
 	
-	NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor];
-	[gradient drawInRect:self.bounds angle:270.0f];
+	NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:_headerGradientStartColor endingColor:_headerGradientEndColor];
+	[gradient drawInRect:dirtyRect angle:270.0f];
 }
 
 @end