Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSOutlineView + Pattern as Background #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Recessed Source List.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
4C12485716593CEB000B1860 /* SourceListBackground.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4C12485616593CEB000B1860 /* SourceListBackground.tiff */; };
9DFE281813D9B5C200BAED67 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DFE281713D9B5C200BAED67 /* Cocoa.framework */; };
9DFE282213D9B5C200BAED67 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9DFE282013D9B5C200BAED67 /* InfoPlist.strings */; };
9DFE282413D9B5C200BAED67 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DFE282313D9B5C200BAED67 /* main.m */; };
Expand All @@ -20,6 +21,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4C12485616593CEB000B1860 /* SourceListBackground.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = SourceListBackground.tiff; sourceTree = "<group>"; };
9DFE281313D9B5C200BAED67 /* Recessed Source List.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Recessed Source List.app"; sourceTree = BUILT_PRODUCTS_DIR; };
9DFE281713D9B5C200BAED67 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
9DFE281A13D9B5C200BAED67 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -97,6 +99,7 @@
9DFE282913D9B5C200BAED67 /* Recessed_Source_ListAppDelegate.h */,
9DFE282A13D9B5C200BAED67 /* Recessed_Source_ListAppDelegate.m */,
9DFE282C13D9B5C200BAED67 /* MainMenu.xib */,
4C12485616593CEB000B1860 /* SourceListBackground.tiff */,
9DFE281E13D9B5C200BAED67 /* Supporting Files */,
);
name = "Demo App";
Expand Down Expand Up @@ -182,6 +185,7 @@
9DFE282213D9B5C200BAED67 /* InfoPlist.strings in Resources */,
9DFE282813D9B5C200BAED67 /* Credits.rtf in Resources */,
9DFE282E13D9B5C200BAED67 /* MainMenu.xib in Resources */,
4C12485716593CEB000B1860 /* SourceListBackground.tiff in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
55 changes: 55 additions & 0 deletions Recessed Source List/Controls/JLNRecessedOutlineView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// JLNRecessedOutlineView.h
// JLNRecessedOutlineView
//
// Created by Manuel "StuFF mc" Carrasco Molina on 11/18/12.
// Copyright 2012 Joshua Nozzi & Manuel Carrasco Molina. All rights reserved.
//
// This software is supplied to you by Joshua Nozzi in consideration
// of your agreement to the following terms, and your use, installation,
// modification or redistribution of this software constitutes
// acceptance of these terms. If you do not agree with these terms,
// please do not use, install, modify or redistribute this software.
//
// In consideration of your agreement to abide by the following terms,
// and subject to these terms, Joshua Nozzi grants you a personal,
// non-exclusive license, to use, reproduce, modify and redistribute
// the software, with or without modifications, in source and/or binary
// forms; provided that if you redistribute the software in its entirety
// and without modifications, you must retain this notice and the
// following text and disclaimers in all such redistributions of the
// software, and that in all cases attribution of Joshua Nozzi as the
// original author of the source code shall be included in all such
// resulting software products or distributions. Neither the name,
// trademarks, service marks or logos of Joshua Nozzi may be used to
// endorse or promote products derived from the software without specific
// prior written permission from Joshua Nozzi. Except as expressly stated
// in this notice, no other rights or licenses, express or implied, are
// granted by Joshua Nozzi herein, including but not limited to any patent
// rights that may be infringed by your derivative works or by other works
// in which the software may be incorporated.
//
// THIS SOFTWARE IS PROVIDED BY JOSHUA NOZZI ON AN "AS IS" BASIS. JOSHUA
// NOZZI MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT
// LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE SOFTWARE OR ITS USE
// AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
//
// IN NO EVENT SHALL JOSHUA NOZZI BE LIABLE FOR ANY SPECIAL, INDIRECT,
// INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE
// USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE SOFTWARE,
// HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
// NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF JOSHUA NOZZI HAS
// BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//


#import <AppKit/AppKit.h>


@interface JLNRecessedOutlineView : NSOutlineView


@end
85 changes: 85 additions & 0 deletions Recessed Source List/Controls/JLNRecessedOutlineView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//
// JLNRecessedOutlineView.h
// JLNRecessedOutlineView
//
// Created by Manuel "StuFF mc" Carrasco Molina on 11/18/12.
// Copyright 2012 Joshua Nozzi & Manuel Carrasco Molina. All rights reserved.
//
// This software is supplied to you by Joshua Nozzi in consideration
// of your agreement to the following terms, and your use, installation,
// modification or redistribution of this software constitutes
// acceptance of these terms. If you do not agree with these terms,
// please do not use, install, modify or redistribute this software.
//
// In consideration of your agreement to abide by the following terms,
// and subject to these terms, Joshua Nozzi grants you a personal,
// non-exclusive license, to use, reproduce, modify and redistribute
// the software, with or without modifications, in source and/or binary
// forms; provided that if you redistribute the software in its entirety
// and without modifications, you must retain this notice and the
// following text and disclaimers in all such redistributions of the
// software, and that in all cases attribution of Joshua Nozzi as the
// original author of the source code shall be included in all such
// resulting software products or distributions. Neither the name,
// trademarks, service marks or logos of Joshua Nozzi may be used to
// endorse or promote products derived from the software without specific
// prior written permission from Joshua Nozzi. Except as expressly stated
// in this notice, no other rights or licenses, express or implied, are
// granted by Joshua Nozzi herein, including but not limited to any patent
// rights that may be infringed by your derivative works or by other works
// in which the software may be incorporated.
//
// THIS SOFTWARE IS PROVIDED BY JOSHUA NOZZI ON AN "AS IS" BASIS. JOSHUA
// NOZZI MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT
// LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE SOFTWARE OR ITS USE
// AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
//
// IN NO EVENT SHALL JOSHUA NOZZI BE LIABLE FOR ANY SPECIAL, INDIRECT,
// INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE
// USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE SOFTWARE,
// HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
// NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF JOSHUA NOZZI HAS
// BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//


#import "JLNRecessedOutlineView.h"


@implementation JLNRecessedOutlineView


- (void)drawBackgroundInClipRect:(NSRect)clipRect
{

// Super first
[super drawBackgroundInClipRect:clipRect];

// Figure out right edge of row, leaving enough room for a 4px gradient
NSRect rightEdge = clipRect;
rightEdge.size.width = 4.0;
rightEdge.origin.x = NSMaxX([self bounds]) - 4.0;

// Does the clip rect intersect enough of the right edge?
if (NSIntersectsRect(clipRect, rightEdge))
{

// Create the gradient (89, 91, 93, 95)
NSGradient * gradient = [[[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.89 alpha:1.0]
endingColor:[NSColor colorWithCalibratedWhite:0.95 alpha:1.0]] autorelease];

// Set clip and draw the gradient
[NSGraphicsContext saveGraphicsState];
[[NSBezierPath bezierPathWithRect:clipRect] setClip];
[gradient drawInRect:rightEdge angle:180];
[NSGraphicsContext restoreGraphicsState];

}

}


@end
4 changes: 3 additions & 1 deletion Recessed Source List/Recessed_Source_ListAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification

// Kick the table view
[tableView reloadData];


NSColor *patternColor = [NSColor colorWithPatternImage:[NSImage imageNamed:@"SourceListBackground.tiff"]];
tableView.backgroundColor = patternColor;
}


Expand Down
Binary file added Recessed Source List/SourceListBackground.tiff
Binary file not shown.
Loading