This repository has been archived by the owner on Jun 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc3117b
commit baeaea8
Showing
40 changed files
with
2,877 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// iArrayController.h | ||
// iTunes Table Header | ||
// | ||
// Created by Jon Brown on 11/1/13. | ||
// Copyright (c) 2013 Jon Brown Designs. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface iArrayController : NSArrayController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// iArrayController.m | ||
// iTunes Table Header | ||
// | ||
// Created by Jon Brown on 11/1/13. | ||
// Copyright (c) 2013 Jon Brown Designs. All rights reserved. | ||
// | ||
|
||
#import "iArrayController.h" | ||
|
||
@implementation iArrayController | ||
|
||
-(void)awakeFromNib | ||
{ | ||
//Sorting at startup | ||
NSSortDescriptor* SortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"artist" | ||
ascending:YES selector:@selector(compare:)] autorelease]; | ||
[self setSortDescriptors:[NSArray arrayWithObject:SortDescriptor]]; | ||
|
||
//need to initialize the array | ||
[super awakeFromNib]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// iHeaderStyle.h | ||
// iTunes Table Header | ||
// | ||
// Created by Jon Brown on 11/1/13. | ||
// Copyright (c) 2013 Jon Brown Designs. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface iHeaderStyle : NSTableHeaderCell { | ||
NSMutableDictionary *attrs; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// iHeaderStyle.m | ||
// iTunes Table Header | ||
// | ||
// Created by Jon Brown on 11/1/13. | ||
// Copyright (c) 2013 Jon Brown Designs. All rights reserved. | ||
// | ||
|
||
#import "iHeaderStyle.h" | ||
|
||
@implementation iHeaderStyle | ||
|
||
- (id)initTextCell:(NSString *)text | ||
{ | ||
if (self = [super initTextCell:text]) { | ||
|
||
if (text == nil || [text isEqualToString:@""]) { | ||
[self setTitle:@"Title"]; | ||
} | ||
|
||
attrs = [[NSMutableDictionary dictionaryWithDictionary: | ||
[[self attributedStringValue] | ||
attributesAtIndex:0 | ||
effectiveRange:NULL]] | ||
mutableCopy]; | ||
return self; | ||
} | ||
return nil; | ||
} | ||
|
||
- (void)drawWithFrame:(CGRect)cellFrame | ||
highlighted:(BOOL)isHighlighted | ||
inView:(NSView *)view | ||
{ | ||
|
||
CGRect fillRect, borderRect; | ||
CGRectDivide(cellFrame, &borderRect, &fillRect, 1.0, CGRectMaxYEdge); | ||
|
||
NSGradient *gradient = [[NSGradient alloc] | ||
initWithStartingColor:[NSColor whiteColor] | ||
endingColor:[NSColor colorWithDeviceWhite:0.9 alpha:1.0]]; | ||
[gradient drawInRect:fillRect angle:90.0]; | ||
[gradient release]; | ||
|
||
|
||
if (isHighlighted) { | ||
[[NSColor colorWithDeviceWhite:0.0 alpha:0.1] set]; | ||
NSRectFillUsingOperation(fillRect, NSCompositeSourceOver); | ||
} | ||
|
||
[[NSColor colorWithDeviceWhite:0.8 alpha:1.0] set]; | ||
NSRectFill(borderRect); | ||
|
||
|
||
[self drawInteriorWithFrame:CGRectInset(fillRect, 0.0, 1.0) inView:view]; | ||
|
||
|
||
// Draw the column divider. | ||
[[NSColor lightGrayColor] set]; | ||
NSRect _dividerRect = NSMakeRect(cellFrame.origin.x + cellFrame.size.width -1, 0, 1,cellFrame.size.height); | ||
NSRectFill(_dividerRect); | ||
|
||
|
||
} | ||
|
||
|
||
- (void)drawWithFrame:(CGRect)cellFrame inView:(NSView *)view | ||
{ | ||
[self drawWithFrame:cellFrame highlighted:NO inView:view]; | ||
} | ||
|
||
- (void)highlight:(BOOL)isHighlighted | ||
withFrame:(NSRect)cellFrame | ||
inView:(NSView *)view | ||
{ | ||
[self drawWithFrame:cellFrame highlighted:isHighlighted inView:view]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// iTableStyle.h | ||
// iTunes Table Header | ||
// | ||
// Created by Jon Brown on 11/1/13. | ||
// Copyright (c) 2013 Jon Brown Designs. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface iTableStyle : NSTableView | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// | ||
// iTableStyle.m | ||
// iTunes Table Header | ||
// | ||
// Created by Jon Brown on 11/1/13. | ||
// Copyright (c) 2013 Jon Brown Designs. All rights reserved. | ||
// | ||
|
||
#import "iTableStyle.h" | ||
|
||
@implementation iTableStyle | ||
|
||
- (void)highlightSelectionInClipRect:(NSRect)theClipRect | ||
{ | ||
|
||
// this method is asking us to draw the hightlights for | ||
// all of the selected rows that are visible inside theClipRect | ||
|
||
// 1. get the range of row indexes that are currently visible | ||
// 2. get a list of selected rows | ||
// 3. iterate over the visible rows and if their index is selected | ||
// 4. draw our custom highlight in the rect of that row. | ||
|
||
NSRange aVisibleRowIndexes = [self rowsInRect:theClipRect]; | ||
NSIndexSet* aSelectedRowIndexes = [self selectedRowIndexes]; | ||
long aRow = aVisibleRowIndexes.location; | ||
long anEndRow = aRow + aVisibleRowIndexes.length; | ||
NSGradient* gradient; | ||
NSColor* pathColor; | ||
|
||
// if the view is focused, use highlight color, otherwise use the out-of-focus highlight color | ||
if (self == [[self window] firstResponder] && [[self window] isMainWindow] && [[self window] isKeyWindow]) | ||
{ | ||
|
||
gradient = [[[NSGradient alloc] initWithColorsAndLocations: | ||
[NSColor colorWithDeviceRed:(float)128/255 green:(float)157/255 blue:(float)194/255 alpha:1.0], 0.0, | ||
[NSColor colorWithDeviceRed:(float)128/255 green:(float)157/255 blue:(float)194/255 alpha:1.0], 1.0, nil] retain]; | ||
|
||
pathColor = [[NSColor colorWithDeviceRed:(float)128/255 green:(float)157/255 blue:(float)194/255 alpha:1.0] retain]; | ||
|
||
} | ||
else | ||
{ | ||
|
||
gradient = [[[NSGradient alloc] initWithColorsAndLocations: | ||
[NSColor colorWithDeviceRed:(float)186/255 green:(float)192/255 blue:(float)203/255 alpha:1.0], 0.0, | ||
[NSColor colorWithDeviceRed:(float)186/255 green:(float)192/255 blue:(float)203/255 alpha:1.0], 1.0, nil] retain]; //160 80 | ||
|
||
pathColor = [[NSColor colorWithDeviceRed:(float)186/255 green:(float)192/255 blue:(float)203/255 alpha:1.0] retain]; | ||
|
||
} | ||
|
||
// draw highlight for the visible, selected rows | ||
|
||
for (aRow; aRow < anEndRow; aRow++) { | ||
|
||
if([aSelectedRowIndexes containsIndex:aRow]) | ||
{ | ||
NSRect aRowRect = NSInsetRect([self rectOfRow:aRow], 0, 0); //first is horizontal, second is vertical | ||
NSBezierPath * path = [NSBezierPath bezierPathWithRect:aRowRect]; //6.0 | ||
|
||
[gradient drawInBezierPath:path angle:90]; | ||
|
||
} | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
- (id)_highlightColorForCell:(NSCell *)cell | ||
{ | ||
// we need to override this to return nil | ||
// or we'll see the default selection rectangle when the app is running | ||
// in any OS before leopard | ||
|
||
// you can also return a color if you simply want to change the table's default selection color | ||
return nil; | ||
} | ||
|
||
|
||
@end |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.