Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
joericioppo committed Jan 11, 2011
1 parent 2d99a78 commit 8da7735
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MyStyledView.m
Expand Up @@ -68,7 +68,7 @@ - (void)drawRect:(NSRect)dirtyRect {
NSImage *backgroundImageToDraw = isKeyWindow ? self.backgroundImage : self.inactiveBackgroundImage ? : self.backgroundImage;
if (backgroundImageToDraw) {
if (self.contentStretch.origin.x != NSNotFound) {
[backgroundImageToDraw drawInRect:rect contentStretch:self.contentStretch];
[backgroundImageToDraw drawInRect:rect withContentStretch:self.contentStretch];
} else {
NSRect imageRect = NSMakeRect(0.0, 0.0, backgroundImageToDraw.size.width, backgroundImageToDraw.size.height);
[backgroundImageToDraw drawInRect:rect fromRect:imageRect operation:NSCompositeSourceOver fraction:1.0];
Expand Down
1 change: 1 addition & 0 deletions MyWindowController.m
Expand Up @@ -45,6 +45,7 @@ - (void)awakeFromNib {
self.toolBar.gradient = [NSGradient gradientWithStartingColor:[NSColor colorWithCalibratedHue:0.625 saturation:0.0 brightness:0.7 alpha:1.0]
endingColor:[NSColor colorWithCalibratedHue:0.625 saturation:0.0 brightness:0.6 alpha:1.0]];
self.toolBar.topEdgeColor = [NSColor colorWithCalibratedWhite:0.8 alpha:1.0];
self.toolBar.bottomEdgeColor = [NSColor colorWithCalibratedWhite:0.65 alpha:1.0];
}

@end
4 changes: 2 additions & 2 deletions NSImage+Additions.h
Expand Up @@ -11,7 +11,7 @@

@interface NSImage (Additions)

- (void)drawInRect:(NSRect)rect contentStretch:(NSRect)contentStretch;
- (void)drawInRect:(NSRect)rect leftCap:(CGFloat)leftCap topCap:(CGFloat)topCap;
- (void)drawInRect:(NSRect)rect withContentStretch:(NSRect)contentStretch;
- (void)drawInRect:(NSRect)rect withLeftCap:(CGFloat)leftCap topCap:(CGFloat)topCap;

@end
9 changes: 5 additions & 4 deletions NSImage+Additions.m
Expand Up @@ -11,13 +11,14 @@

@implementation NSImage (Additions)

- (void)drawInRect:(NSRect)rect contentStretch:(NSRect)contentStretch {
- (void)drawInRect:(NSRect)rect withContentStretch:(NSRect)contentStretch {

NSSize imageSize = self.size;

if (imageSize.width > rect.size.width || imageSize.height > rect.size.height) {
NSRect imageRect = NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height);
[self drawInRect:rect fromRect:imageRect operation:NSCompositeSourceOver fraction:1.0];
return;
}

CGFloat middleFillHeight = rect.size.height - imageSize.height;
Expand Down Expand Up @@ -67,10 +68,10 @@ - (void)drawInRect:(NSRect)rect contentStretch:(NSRect)contentStretch {
[self drawInRect:stretchedRectToDraw fromRect:rectToStretch operation:NSCompositeSourceOver fraction:1.0];
}

- (void)drawInRect:(NSRect)rect leftCap:(CGFloat)leftCap topCap:(CGFloat)topCap {
- (void)drawInRect:(NSRect)rect withLeftCap:(CGFloat)leftCap topCap:(CGFloat)topCap {

NSRect contentStretchRect = NSMakeRect(leftCap, rect.size.height - topCap, 0.0, 0.0);
[self drawInRect:rect contentStretch:contentStretchRect];
NSRect contentStretch = NSMakeRect(leftCap, rect.size.height - topCap, 0.0, 0.0);
[self drawInRect:rect withContentStretch:contentStretch];
}

@end
2 changes: 1 addition & 1 deletion NSShadow+Additions.m
Expand Up @@ -18,7 +18,7 @@ - (id)initWithColor:(NSColor *)color offset:(NSSize)offset blurRadius:(CGFloat)b

self = [self init];

if (self) {
if (self != nil) {
self.shadowColor = color;
self.shadowOffset = offset;
self.shadowBlurRadius = blur;
Expand Down

0 comments on commit 8da7735

Please sign in to comment.