Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbrown21 committed Dec 2, 2013
1 parent dc3117b commit baeaea8
Show file tree
Hide file tree
Showing 40 changed files with 2,877 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
13 changes: 13 additions & 0 deletions Classes/iArrayController.h
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
24 changes: 24 additions & 0 deletions Classes/iArrayController.m
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
15 changes: 15 additions & 0 deletions Classes/iHeaderStyle.h
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
79 changes: 79 additions & 0 deletions Classes/iHeaderStyle.m
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
13 changes: 13 additions & 0 deletions Classes/iTableStyle.h
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
83 changes: 83 additions & 0 deletions Classes/iTableStyle.m
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
9 changes: 9 additions & 0 deletions GraphFiles/bootstrap.min.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions GraphFiles/bootstrap.min.js

Large diffs are not rendered by default.

0 comments on commit baeaea8

Please sign in to comment.