Merge branch 'master' into hacking

This commit is contained in:
Riccardo Canalicchio 2013-12-29 16:14:13 +01:00
commit 2555181692
21 changed files with 482 additions and 371 deletions

View File

@ -12,6 +12,7 @@ Rik_OBJC_FILES = \
Rik.m\
Rik+Drawings.m\
Rik+Button.m\
Rik+FocusFrame.m\
Rik+WindowDecoration.m\
Rik+Menu.m\
Rik+Slider.m\
@ -29,6 +30,7 @@ Rik_OBJC_FILES = \
RikWindowButtonCell.m\
RikScrollerKnobCell.m\
RikScrollerKnobSlotCell.m\
RikScrollerArrowCell.m\
NSBrowserCell+Rik.m
ADDITIONAL_TOOL_LIBS =

View File

@ -3,10 +3,6 @@
#import <AppKit/NSImage.h>
@interface NSWindow(RikTheme)
@end
@implementation NSWindow(RikTheme)
+ (NSButton *) standardWindowButton: (NSWindowButton)button
@ -23,7 +19,6 @@
[newButton setAlternateImage: [NSImage imageNamed: @"common_CloseH"]];
[newButton setAction: @selector(performClose:)];
break;
case NSWindowMiniaturizeButton:
newButton = [[RikWindowButton alloc] init];
[newButton setBaseColor: [NSColor colorWithCalibratedRed: 0.9 green: 0.7 blue: 0.3 alpha: 1]];

Binary file not shown.

View File

@ -15,19 +15,6 @@
withFrame: (NSRect)rect
inView: (NSView*)view;
{
NSColor* bc = [NSColor colorWithCalibratedRed: 0.9 green: 0.9 blue: 0.9 alpha: 1];
NSGradient * g = [self _buttonGradientWithColor: bc];
[g drawInRect: rect angle: 90];
NSColor* strokeColor = [NSColor colorWithCalibratedRed: 0.7
green: 0.7
blue: 0.7
alpha: 1];
[strokeColor set];
NSFrameRect(rect);
NSBezierPath* linePath = [NSBezierPath bezierPath];
[linePath moveToPoint: NSMakePoint(NSMinX(rect), NSMinY(rect)+0.5)];
[linePath lineToPoint: NSMakePoint(NSMaxX(rect), NSMinY(rect)+0.5)];
[linePath stroke];
}
- (NSRect) browserHeaderDrawingRectForCell: (NSTableHeaderCell*)cell
withFrame: (NSRect)rect
@ -47,29 +34,11 @@
{
[browser loadColumnZero];
}
// Draws titles
if ([browser isTitled])
{
int i;
for (i = [browser firstVisibleColumn];
i <= [browser lastVisibleColumn];
++i)
{
NSRect titleRect = [browser titleFrameOfColumn: i];
if (NSIntersectsRect (titleRect, rect) == YES)
{
[browser drawTitleOfColumn: i
inRect: titleRect];
}
}
}
}
- (CGFloat) browserColumnSeparation
{
return 0;
return 1;
}
- (CGFloat) browserVerticalPadding

View File

@ -14,7 +14,8 @@
{
if (state == GSThemeNormalState)
{
color = [NSColor controlBackgroundColor];
color = [[NSColor controlBackgroundColor] shadowWithLevel: 0.1];
;
}
else if (state == GSThemeHighlightedState
|| state == GSThemeHighlightedFirstResponderState)
@ -28,12 +29,20 @@
}
else
{
color = [NSColor controlBackgroundColor];
color = [[NSColor controlBackgroundColor] shadowWithLevel: 0.1];
}
}
return color;
}
- (NSBezierPath *) _roundBezierPath: (NSRect) frame
withRadius:(CGFloat) radius
{
frame = NSInsetRect(frame, 0.5, 0.5);
NSBezierPath* roundedRectanglePath = [NSBezierPath bezierPathWithRoundedRect: frame
xRadius: radius
yRadius: radius];
return roundedRectanglePath;
}
- (void) _drawRoundBezel: (NSRect)cellFrame
withColor: (NSColor*)backgroundColor
andRadius: (CGFloat) radius
@ -43,16 +52,25 @@
NSGradient* buttonBackgroundGradient = [self _bezelGradientWithColor: backgroundColor];
cellFrame = NSInsetRect(cellFrame, 0.5, 0.5);
NSBezierPath* roundedRectanglePath = [NSBezierPath bezierPathWithRoundedRect: cellFrame
xRadius: radius
yRadius: radius];
NSBezierPath* roundedRectanglePath = [self _roundBezierPath: cellFrame withRadius: radius];
[buttonBackgroundGradient drawInBezierPath: roundedRectanglePath angle: -90];
[strokeColorButton setStroke];
[roundedRectanglePath setLineWidth: 1];
[roundedRectanglePath stroke];
}
- (void) drawPathButton: (NSBezierPath*) path
in: (NSCell*)cell
state: (GSThemeControlState) state
{
NSColor *backgroundColor = [self buttonColorInCell: cell forState: state];
NSColor* strokeColorButton = [Rik controlStrokeColor];
NSGradient* buttonBackgroundGradient = [self _bezelGradientWithColor: backgroundColor];
[buttonBackgroundGradient drawInBezierPath: path angle: -90];
[strokeColorButton setStroke];
[path setLineWidth: 1];
[path stroke];
}
- (void) _drawRoundBezel: (NSRect)cellFrame withColor: (NSColor*)backgroundColor
{
[self _drawRoundBezel: cellFrame withColor: backgroundColor andRadius: 4];
@ -75,27 +93,64 @@
andRadius: circle_radius];
}
- (NSGradient *) _bezelGradientWithColor:(NSColor*) baseColor
{
baseColor = [baseColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
NSColor* baseColorLight = [baseColor highlightWithLevel: 0.8];
NSColor* baseColorLight2 = [baseColor highlightWithLevel: 0.5];
NSColor* baseColorShadow = [baseColor shadowWithLevel: 0.1];
NSGradient* gradient = [[NSGradient alloc] initWithColorsAndLocations:
baseColorLight, 0.0,
baseColor, 0.30,
baseColor, 0.49,
baseColorLight2, 0.50,
nil];
return gradient;
}
- (NSRect) drawButton: (NSRect)border withClip: (NSRect)clip
{
NSColor * c = [NSColor controlBackgroundColor];
[self _drawRoundBezel: border withColor: c];
return border;
}
- (NSBezierPath*) buttonBezierPathWithRect: (NSRect)frame andStyle: (int) style
{
NSBezierPath* bezierPath;
CGFloat r;
CGFloat x;
switch (style)
{
case NSRoundRectBezelStyle:
bezierPath = [self _roundBezierPath: frame
withRadius: 4];
break;
case NSTexturedRoundedBezelStyle:
case NSRoundedBezelStyle:
r = MIN(frame.size.width, frame.size.height) / 2.0;
bezierPath = [self _roundBezierPath: frame
withRadius: r];
break;
case NSTexturedSquareBezelStyle:
frame = NSInsetRect(frame, 0, 1);
case NSSmallSquareBezelStyle:
case NSRegularSquareBezelStyle:
case NSShadowlessSquareBezelStyle:
case NSThickSquareBezelStyle:
case NSThickerSquareBezelStyle:
bezierPath = [NSBezierPath bezierPathWithRect: frame];
break;
case NSCircularBezelStyle:
case NSHelpButtonBezelStyle:
r = MIN(NSWidth(frame), NSHeight(frame)) / 2;
x = frame.origin.x + frame.size.width/2.0 - r;
frame = NSMakeRect( x,
frame.origin.y,
r*2,
r*2);
bezierPath = [self _roundBezierPath: frame
withRadius: r];
break;
case NSDisclosureBezelStyle:
case NSRoundedDisclosureBezelStyle:
case NSRecessedBezelStyle:
r = MIN(frame.size.width, frame.size.height) / 2.0;
bezierPath = [self _roundBezierPath: frame
withRadius: r];
break;
default:
bezierPath = [self _roundBezierPath: frame
withRadius: 4];
}
return RETAIN(bezierPath);
}
- (void) drawButton: (NSRect) frame
in: (NSCell*) cell
@ -187,4 +242,27 @@
[roundedRectanglePath setLineWidth: roundedRectangleStrokeWidth];
[roundedRectanglePath stroke];
}
- (NSRect) drawDarkButton: (NSRect)border withClip: (NSRect)clip
{
NSColor* strokeColorButton = [Rik controlStrokeColor];
NSColor* baseColor = [NSColor colorWithCalibratedRed: 0.75
green: 0.75
blue: 0.75
alpha: 1];
NSColor* baseColorLight = [baseColor highlightWithLevel: 0.6];
NSGradient* buttonBackgroundGradient = [[NSGradient alloc] initWithColorsAndLocations:
baseColorLight, 1.0,
baseColor, 0.0, nil];
CGFloat roundedRectangleStrokeWidth = 1;
NSBezierPath* roundedRectanglePath = [NSBezierPath bezierPathWithRect: border];
[buttonBackgroundGradient drawInBezierPath: roundedRectanglePath angle: -90];
[strokeColorButton setStroke];
[roundedRectanglePath setLineWidth: roundedRectangleStrokeWidth];
// [roundedRectanglePath stroke];
return border;
}
@end

View File

@ -5,7 +5,9 @@ void NSRoundRectFill(NSRect r, float radius);
@interface Rik(RikDrawings)
- (NSGradient *) _bezelGradientWithColor:(NSColor*) baseColor;
- (NSGradient *) _buttonGradientWithColor:(NSColor*) baseColor;
- (NSGradient *) _windowTitlebarGradient;
- (NSRect) drawInnerGrayBezel: (NSRect)border withClip: (NSRect)clip;
- (NSBezierPath*) buttonBezierPathWithRect: (NSRect)frame andStyle: (int) style;
@end

View File

@ -19,6 +19,22 @@ NSRoundRectFill(NSRect r, float radius)
@implementation Rik(RikDrawiungs)
- (NSGradient *) _bezelGradientWithColor:(NSColor*) baseColor
{
baseColor = [baseColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
NSColor* baseColorLight = [baseColor highlightWithLevel: 0.8];
NSColor* baseColorLight2 = [baseColor highlightWithLevel: 0.5];
NSColor* baseColorShadow = [baseColor shadowWithLevel: 0.1];
NSGradient* gradient = [[NSGradient alloc] initWithColorsAndLocations:
baseColorLight, 0.0,
baseColor, 0.30,
baseColor, 0.49,
baseColorLight2, 0.50,
nil];
return gradient;
}
- (NSGradient *) _buttonGradientWithColor:(NSColor*) baseColor
{
baseColor = [baseColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace];

107
Rik+FocusFrame.m Normal file
View File

@ -0,0 +1,107 @@
#import "Rik.h"
@implementation Rik(RikFocusFrame)
- (void) drawFocusFrame: (NSRect) frame view: (NSView*) view
{
//NSLog(@"%@", [view className]);
NSBezierPath * path;
if([view class] == [NSButton class])
{
NSRect r = [view bounds];
NSImage * img = [(NSButton*) view image];
if(img != nil && ![(NSButton*)view isBordered])
{
NSSize s = [img size];
NSCellImagePosition cip = [(NSButton*) view imagePosition];
NSRect imageRect;
switch(cip)
{
case NSImageOnly:
imageRect = r;
break;
case NSImageLeft:
imageRect.origin = r.origin;
imageRect.size.width = s.width;
imageRect.size.height = r.size.height;
break;
case NSImageRight:
imageRect.origin.x = NSMaxX(r) - s.width;
imageRect.origin.y = r.origin.y;
imageRect.size.width = s.width;
imageRect.size.height = r.size.height;
break;
}
path = [NSBezierPath bezierPathWithRoundedRect: NSInsetRect(imageRect,2,1)
xRadius: 3
yRadius: 3];
}
else
{
int bezel_style = [(NSButton*)view bezelStyle];
path = [self buttonBezierPathWithRect: NSInsetRect([view bounds], 1, 1)
andStyle: bezel_style];
}
}
else if([view class] == [NSStepper class])
{
path = [self stepperBezierPathWithFrame: frame];
}
else if([view class] == [NSMatrix class])
{
NSSize size = [(NSMatrix*) view cellSize];
NSCell* selectedCell = [(NSMatrix*) view selectedCell];
NSUInteger row = [(NSMatrix*)view selectedRow];
NSUInteger col = [(NSMatrix*)view selectedColumn];
NSRect r = [(NSMatrix*) view cellFrameAtRow:row column: col];
if([selectedCell class] == [NSButtonCell class])
{
NSImage * img = [selectedCell image];
if(img != nil && ![selectedCell isBordered])
{
NSSize s = [img size];
s.width -= 2;
s.height -= 2;
path = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(r.origin.x+1, r.origin.y+2, s.width, s.height)
xRadius: s.width/2.0
yRadius: s.height/2.0];
}else{
path = [NSBezierPath bezierPathWithRoundedRect: NSInsetRect(r, 1, 1)
xRadius: 3
yRadius: 3];
}
}else{
return;
}
}
else
{
path = [NSBezierPath bezierPathWithRect: frame];
}
NSColor * c = [NSColor selectedControlColor];
[c setStroke];
[path setLineWidth: 2];
[path stroke];
}
- (NSSize) sizeForBorderType: (NSBorderType)aType
{
switch (aType)
{
case NSLineBorder:
return NSMakeSize(4, 4);
case NSGrooveBorder:
case NSBezelBorder:
return NSMakeSize(4, 4);
case NSNoBorder:
default:
return NSZeroSize;
}
}
@end

View File

@ -1,6 +1,7 @@
#include "Rik.h"
#include "RikScrollerKnobCell.h"
#include "RikScrollerKnobSlotCell.h"
#include "RikScrollerArrowCell.h"
@interface Rik(RikScroller)
@ -13,11 +14,11 @@
- (NSButtonCell*) cellForScrollerArrow: (NSScrollerArrow)arrow
horizontal: (BOOL)horizontal
{
NSButtonCell *cell;
RikScrollerArrowCell *cell;
NSString *name;
cell = [NSButtonCell new];
[cell setBezelStyle: NSRegularSquareBezelStyle];
cell = [RikScrollerArrowCell new];
[cell setBezelStyle: NSRoundRectBezelStyle];
if (horizontal)
{
if (arrow == NSScrollerDecrementArrow)
@ -25,18 +26,18 @@
[cell setHighlightsBy:
NSChangeBackgroundCellMask | NSContentsCellMask];
[cell setImage: [NSImage imageNamed: @"common_ArrowLeft"]];
[cell setAlternateImage: [NSImage imageNamed: @"common_ArrowLeftH"]];
[cell setImagePosition: NSImageOnly];
name = GSScrollerLeftArrow;
[cell setArrowType: RikScrollerArrowLeft];
}
else
{
[cell setHighlightsBy:
NSChangeBackgroundCellMask | NSContentsCellMask];
[cell setImage: [NSImage imageNamed: @"common_ArrowRight"]];
[cell setAlternateImage: [NSImage imageNamed: @"common_ArrowRightH"]];
[cell setImagePosition: NSImageOnly];
name = GSScrollerRightArrow;
[cell setArrowType: RikScrollerArrowRight];
}
}
else
@ -46,18 +47,18 @@
[cell setHighlightsBy:
NSChangeBackgroundCellMask | NSContentsCellMask];
[cell setImage: [NSImage imageNamed: @"common_ArrowUp"]];
[cell setAlternateImage: [NSImage imageNamed: @"common_ArrowUpH"]];
[cell setImagePosition: NSImageOnly];
name = GSScrollerUpArrow;
[cell setArrowType: RikScrollerArrowUp];
}
else
{
[cell setHighlightsBy:
NSChangeBackgroundCellMask | NSContentsCellMask];
[cell setImage: [NSImage imageNamed: @"common_ArrowDown"]];
[cell setAlternateImage: [NSImage imageNamed: @"common_ArrowDownH"]];
[cell setImagePosition: NSImageOnly];
name = GSScrollerDownArrow;
[cell setArrowType: RikScrollerArrowDown];
}
}
[self setName: name forElement: cell temporary: YES];
@ -74,10 +75,6 @@
[cell setBezelStyle: NSRoundedBezelStyle];
[cell setImagePosition: NSImageOnly];
NSColor* bc = [NSColor colorWithCalibratedRed: 0.4
green: 0.4
blue: 0.4
alpha: 1];
[cell setTitle: @""];
if (horizontal)
{
@ -127,37 +124,16 @@
// REMEMBER THIS SETTING
- (float) defaultScrollerWidth
{
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
float defaultScrollerWidth;
if ([defs objectForKey: @"GSScrollerDefaultWidth"] != nil)
{
defaultScrollerWidth = [defs floatForKey: @"GSScrollerDefaultWidth"];
}
else
{
defaultScrollerWidth = 12.0;
}
return defaultScrollerWidth;
return 16.0;
}
- (BOOL) scrollViewUseBottomCorner
{
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
if ([defs objectForKey: @"GSScrollViewUseBottomCorner"] != nil)
{
return [defs boolForKey: @"GSScrollViewUseBottomCorner"];
}
return YES;
}
- (BOOL) scrollViewScrollersOverlapBorders
{
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
if ([defs objectForKey: @"GSScrollViewScrollersOverlapBorders"] != nil)
{
return [defs boolForKey: @"GSScrollViewScrollersOverlapBorders"];
}
return NO;
}

View File

@ -11,7 +11,7 @@
roundedLeft: (BOOL)roundedLeft
roundedRight: (BOOL)roundedRight
{
NSColor * c = [NSColor controlBackgroundColor];
NSColor * c = [[NSColor controlBackgroundColor] shadowWithLevel: 0.1];
NSGradient* normalButtongradient = [self _bezelGradientWithColor: c];
NSColor* buttonStroke = [Rik controlStrokeColor];

View File

@ -71,10 +71,10 @@
NSView *controlView = [cell controlView];
NSSliderCell *sliderCell = (NSSliderCell *)cell;
NSRect r = [sliderCell knobRectFlipped: [controlView isFlipped]];
r.size.height += 4;
r.size.width += 4;
r.origin.x -= 2;
r.origin.y -= 2;
r.size.height += 2;
r.size.width += 2;
r.origin.x -= 1;
r.origin.y -= 1;
NSColor *color = [NSColor colorWithCalibratedRed: 0.9
green: 0.9
blue: 0.9

View File

@ -10,7 +10,7 @@
NSRect upRect = frame;
upRect.size.width = 13;
upRect.size.height = 12;
upRect.origin.x = frame.origin.x + frame.size.width/2 - 6.5;
upRect.origin.x = frame.origin.x + frame.size.width/2 - 6;
upRect.origin.y = frame.origin.y + frame.size.height/2-1;
return upRect;
}
@ -21,7 +21,7 @@
NSRect upRect = frame;
upRect.size.width = 13;
upRect.size.height = 12;
upRect.origin.x = frame.origin.x + frame.size.width/2 - 6.5;
upRect.origin.x = frame.origin.x + frame.size.width/2 - 6;
upRect.origin.y = frame.origin.y + frame.size.height/2 - 11;
return upRect;
}
@ -130,4 +130,11 @@
[roundedRectanglePath setLineWidth: 1];
[roundedRectanglePath stroke];
}
-(NSBezierPath *) stepperBezierPathWithFrame:(NSRect)frame
{
CGFloat radius = 5;
frame = NSMakeRect(frame.origin.x + frame.size.width/2 - 6, frame.origin.y + frame.size.height/2 - 11, 13, 22);
NSBezierPath* roundedRectanglePath = [NSBezierPath bezierPathWithRoundedRect:frame xRadius: radius yRadius: radius];
return RETAIN(roundedRectanglePath);
}
@end

View File

@ -21,254 +21,101 @@ typedef enum {
GSTabBackgroundFill
} GSTabPart;
- (void) frameTabRectTopAndBottom: (NSRect)aRect
topColor: (NSColor *)topColor
bottomColor: (NSColor *)bottomColor
- (NSRect) tableHeaderCellDrawingRectForBounds: (NSRect)theRect
{
NSLog(@"frameTabRect");
NSRect bottom = aRect;
NSRect top = aRect;
NSSize borderSize;
top.size.height = 1;
bottom.origin.y = NSMaxY(aRect) - 1;
bottom.size.height = 1;
// This adjustment must match the drawn border
borderSize = NSMakeSize(0, 0);
[topColor set];
//NSRectFill(top);
[bottomColor set];
//NSRectFill(bottom);
return NSInsetRect(theRect, borderSize.width, borderSize.height);
}
- (void) drawTabFillInRect: (NSRect)aRect forPart: (GSTabPart)part type: (NSTabViewType)type
- (NSColor *) tableHeaderTextColorForState: (GSThemeControlState)state
{
NSColor *color;
{
if (type == NSBottomTabsBezelBorder)
{
switch (part)
{
case GSTabSelectedFill:
[self frameTabRectTopAndBottom: aRect
topColor: [NSColor clearColor]
bottomColor: [NSColor whiteColor]];
break;
case GSTabUnSelectedFill:
[self frameTabRectTopAndBottom: aRect
topColor: [NSColor darkGrayColor]
bottomColor: [NSColor whiteColor]];
break;
case GSTabBackgroundFill:
{
const NSRect clip = aRect;
aRect.origin.x -= 2;
aRect.origin.y = NSMinY(aRect) - 2;
aRect.size.width += 2;
aRect.size.height = 4;
//[self drawButton: aRect withClip: clip];
break;
}
default:
break;
}
}
else if (type == NSTopTabsBezelBorder)
{
switch (part)
{
case GSTabSelectedFill:
[self frameTabRectTopAndBottom: aRect
topColor: [NSColor whiteColor]
bottomColor: [NSColor clearColor]];
break;
case GSTabUnSelectedFill:
[self frameTabRectTopAndBottom: aRect
topColor: [NSColor whiteColor]
bottomColor: [NSColor whiteColor]];
break;
case GSTabBackgroundFill:
{
const NSRect clip = aRect;
aRect.origin.x -= 2;
aRect.origin.y = NSMaxY(aRect) - 1;
aRect.size.width += 2;
aRect.size.height = 4;
//[self drawButton: aRect withClip: clip];
break;
}
default:
break;
}
}
}
if (state == GSThemeHighlightedState)
color = [NSColor controlTextColor];
else
color = [NSColor controlTextColor];
return color;
}
- (CGFloat) tabHeightForType: (NSTabViewType)type
- (void) drawTableCornerView: (NSView*)cornerView
withClip: (NSRect)aRect
{
return 5;
}
- (NSRect) tabViewBackgroundRectForBounds: (NSRect)aRect
tabViewType: (NSTabViewType)type
{
const CGFloat tabHeight = [self tabHeightForType: type];
NSRect divide;
NSRect rect;
switch (type)
if ([cornerView isFlipped])
{
default:
case NSTopTabsBezelBorder:
aRect.size.height -= tabHeight;
aRect.origin.y += tabHeight;
break;
case NSBottomTabsBezelBorder:
aRect.size.height -= tabHeight;
break;
case NSLeftTabsBezelBorder:
aRect.size.width -= tabHeight;
aRect.origin.x += tabHeight;
break;
case NSRightTabsBezelBorder:
aRect.size.width -= tabHeight;
break;
case NSNoTabsBezelBorder:
case NSNoTabsLineBorder:
case NSNoTabsNoBorder:
break;
}
return aRect;
}
- (NSRect) tabViewContentRectForBounds: (NSRect)aRect
tabViewType: (NSTabViewType)type
tabView: (NSTabView *)view
{
NSRect cRect = [self tabViewBackgroundRectForBounds: aRect
tabViewType: type];
/*
NSString *name = GSStringFromTabViewType(type);
GSDrawTiles *tiles = [self tilesNamed: name state: GSThemeNormalState];
if (tiles == nil)
{
switch (type)
{
case NSBottomTabsBezelBorder:
cRect.origin.x += 1;
cRect.origin.y += 1;
cRect.size.width -= 3;
cRect.size.height -= 2;
break;
case NSNoTabsBezelBorder:
cRect.origin.x += 1;
cRect.origin.y += 1;
cRect.size.width -= 3;
cRect.size.height -= 2;
break;
case NSNoTabsLineBorder:
cRect.origin.y += 1;
cRect.origin.x += 1;
cRect.size.width -= 2;
cRect.size.height -= 2;
break;
case NSTopTabsBezelBorder:
cRect.origin.x += 1;
cRect.origin.y += 1;
cRect.size.width -= 3;
cRect.size.height -= 2;
break;
case NSLeftTabsBezelBorder:
cRect.origin.x += 1;
cRect.origin.y += 1;
cRect.size.width -= 3;
cRect.size.height -= 2;
break;
case NSRightTabsBezelBorder:
cRect.origin.x += 1;
cRect.origin.y += 1;
cRect.size.width -= 3;
cRect.size.height -= 2;
break;
case NSNoTabsNoBorder:
default:
break;
}
NSDivideRect(aRect, &divide, &rect, 1.0, NSMaxYEdge);
}
else
{
cRect = [tiles contentRectForRect: cRect
isFlipped: [view isFlipped]];
NSDivideRect(aRect, &divide, &rect, 1.0, NSMinYEdge);
}
*/
return cRect;
NSColor * basecolor = [[NSColor controlBackgroundColor] shadowWithLevel: 0.1];
NSGradient* buttonBackgroundGradient = [self _bezelGradientWithColor: basecolor];
[buttonBackgroundGradient drawInRect: rect angle: -90];
NSBezierPath* linesPath = [NSBezierPath bezierPath];
[linesPath setLineWidth: 1];
[linesPath moveToPoint: NSMakePoint(rect.origin.x, NSMinY(rect))];
[linesPath lineToPoint: NSMakePoint(rect.origin.x + rect.size.width, NSMinY(rect))];
[linesPath moveToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect))];
[linesPath lineToPoint: NSMakePoint(rect.origin.x + rect.size.width, NSMaxY(rect))];
NSColor * strokeColor = [NSColor colorWithCalibratedRed: 0.70
green: 0.70
blue: 0.70
alpha: 1.0];
[strokeColor setStroke];
[linesPath stroke];
}
- (void) drawTabViewRect: (NSRect)rect
inView: (NSView *)view
withItems: (NSArray *)items
selectedItem: (NSTabViewItem *)selected
- (void) drawTableHeaderCell: (NSTableHeaderCell *)cell
withFrame: (NSRect)cellFrame
inView: (NSView *)controlView
state: (GSThemeControlState)state
{
//// Color Declarations
/*
NSColor* white = [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 1];
NSColor* buttonStroke = [NSColor colorWithCalibratedRed: 0.557 green: 0.557 blue: 0.557 alpha: 1];
NSColor* black = [NSColor colorWithCalibratedRed: 0 green: 0 blue: 0 alpha: 1];
NSColor* clear = [NSColor colorWithCalibratedRed: 0 green: 0 blue: 0 alpha: 1];
NSColor* buttonNormal1 = [NSColor colorWithCalibratedRed: 0.953 green: 0.953 blue: 0.953 alpha: 1];
NSRect rect;
//// Gradient Declarations
NSGradient* normalButtongradient = [[NSGradient alloc] initWithColorsAndLocations:
white, 0.52,
buttonNormal1, 0.53, nil];
const NSUInteger howMany = [items count];
int i;
int previousState = 0;
const NSTabViewType type = [(NSTabView *)view tabViewType];
const NSRect bounds = [view bounds];
NSRect aRect = [self tabViewBackgroundRectForBounds: bounds tabViewType: type];
const BOOL truncate = [(NSTabView *)view allowsTruncatedLabels];
const CGFloat tabHeight = [self tabHeightForType: type];
[self drawTabViewBezelRect: aRect
tabViewType: type
inView: view];
if (type == NSBottomTabsBezelBorder
|| type == NSTopTabsBezelBorder)
// Leave a 1pt thick horizontal line underneath the header
if (![controlView isFlipped])
{
NSPoint iP;
if (type == NSTopTabsBezelBorder)
iP = bounds.origin;
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
if ([defs objectForKey: @"GSBrowserColumnSeparation"] != nil)
cellFrame.origin.y++;
}
//cellFrame.size.height--;
NSColor * basecolor;
if (state == GSThemeHighlightedState)
{
return [defs floatForKey: @"GSBrowserColumnSeparation"];
basecolor = [NSColor selectedControlColor];
}
else
{
else
iP = NSMakePoint(aRect.origin.x, NSMaxY(aRect));
basecolor = [[NSColor controlBackgroundColor] shadowWithLevel: 0.1];
}
NSGradient* buttonBackgroundGradient = [self _bezelGradientWithColor: basecolor];
[buttonBackgroundGradient drawInRect: cellFrame angle: -90];
for (i = 0; i < howMany; i++)
{
NSRect frame = NSMakeRect(iP.x, iP.y, 100, 30);
//// button2 Drawing
CGFloat button2CornerRadius = 4;
NSRect button2Rect = NSMakeRect(NSMinX(frame) + 50.5, NSMinY(frame) + NSHeight(frame) - 20.5, 45, 17);
NSRect button2InnerRect = NSInsetRect(button2Rect, button2CornerRadius, button2CornerRadius);
NSBezierPath* button2Path = [NSBezierPath bezierPath];
[button2Path moveToPoint: NSMakePoint(NSMinX(button2Rect), NSMinY(button2Rect))];
[button2Path appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(button2InnerRect), NSMinY(button2InnerRect)) radius: button2CornerRadius startAngle: 270 endAngle: 360];
[button2Path appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(button2InnerRect), NSMaxY(button2InnerRect)) radius: button2CornerRadius startAngle: 0 endAngle: 90];
[button2Path lineToPoint: NSMakePoint(NSMinX(button2Rect), NSMaxY(button2Rect))];
[button2Path closePath];
[normalButtongradient drawInBezierPath: button2Path angle: -90];
iP.x += frame.size.width;
}
}
*/
NSBezierPath* linesPath = [NSBezierPath bezierPath];
[linesPath setLineWidth: 1];
[linesPath moveToPoint: NSMakePoint(cellFrame.origin.x-0.5, NSMinY(cellFrame) + 5)];
[linesPath lineToPoint: NSMakePoint(cellFrame.origin.x-0.5, NSMaxY(cellFrame) - 5)];
[linesPath moveToPoint: NSMakePoint(cellFrame.origin.x, NSMinY(cellFrame))];
[linesPath lineToPoint: NSMakePoint(cellFrame.origin.x + cellFrame.size.width, NSMinY(cellFrame))];
[linesPath moveToPoint: NSMakePoint(cellFrame.origin.x, NSMaxY(cellFrame))];
[linesPath lineToPoint: NSMakePoint(cellFrame.origin.x + cellFrame.size.width, NSMaxY(cellFrame))];
NSColor * strokeColor = [NSColor colorWithCalibratedRed: 0.70
green: 0.70
blue: 0.70
alpha: 1.0];
[strokeColor setStroke];
[linesPath stroke];
}
@end

View File

@ -25,20 +25,24 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
- (void) drawWindowBackground: (NSRect) frame view: (NSView*) view
{
NSWindow * w = [view window];
NSColor* backgroundColor = [[view window] backgroundColor];
NSColor *borderColor = [Rik controlStrokeColor];
//i want to draw over the resize bar
frame.size.height += RESIZE_HEIGHT;
frame.origin.y -= RESIZE_HEIGHT;
frame.origin.x -= 1;
frame.size.width += 1;
NSRect backgroundRect = NSOffsetRect(frame, 0.5, 0.5);
NSBezierPath* backgroundPath = [NSBezierPath bezierPath];
NSRect backgroundRect;
if([w styleMask] & NSResizableWindowMask)
{
frame.size.height += RESIZE_HEIGHT;
frame.origin.y -= RESIZE_HEIGHT;
backgroundRect = NSOffsetRect(frame, 0.5, 0.5);
NSRect backgroundInnerRect = NSInsetRect( backgroundRect,
WINDOW_CORNER_RADIUS,
WINDOW_CORNER_RADIUS);
NSBezierPath* backgroundPath = [NSBezierPath bezierPath];
[backgroundPath setLineWidth: 1];
[backgroundPath appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(backgroundInnerRect), NSMinY(backgroundInnerRect))
@ -49,6 +53,13 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
[backgroundPath lineToPoint: NSMakePoint(NSMinX(backgroundRect), NSMaxY(backgroundRect))];
[backgroundPath closePath];
}
else
{
backgroundRect = NSOffsetRect(frame, 0.5, 0.5);
[backgroundPath appendBezierPathWithRect: backgroundRect];
}
[backgroundColor setFill];
[borderColor setStroke];

3
Rik.h
View File

@ -4,6 +4,9 @@
@interface Rik: GSTheme
+ (NSColor *) controlStrokeColor;
- (void) drawPathButton: (NSBezierPath*) path
in: (NSCell*)cell
state: (GSThemeControlState) state;
@end

6
Rik.m
View File

@ -8,9 +8,9 @@
+ (NSColor *) controlStrokeColor
{
return RETAIN([NSColor colorWithCalibratedRed: 0.3
green: 0.3
blue: 0.3
return RETAIN([NSColor colorWithCalibratedRed: 0.4
green: 0.4
blue: 0.4
alpha: 1]);
}
@end

16
RikScrollerArrowCell.h Normal file
View File

@ -0,0 +1,16 @@
#import <AppKit/NSButtonCell.h>
typedef enum {
RikScrollerArrowLeft,
RikScrollerArrowRight,
RikScrollerArrowUp,
RikScrollerArrowDown
} RikScrollerArrowType;
@interface RikScrollerArrowCell : NSButtonCell
{
RikScrollerArrowType scroller_arrow_type;
}
-(void) setArrowType: (RikScrollerArrowType) t;
@end

88
RikScrollerArrowCell.m Normal file
View File

@ -0,0 +1,88 @@
#include <AppKit/AppKit.h>
#include "RikScrollerArrowCell.h"
#include "Rik.h"
@implementation RikScrollerArrowCell
- (void) setArrowType: (RikScrollerArrowType) t
{
scroller_arrow_type = t;
}
- (void) drawBezelWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
{
GSThemeControlState buttonState = [self themeControlState];
NSBezierPath * path = [self pathForFrame: cellFrame];
[(Rik*)[GSTheme theme] drawPathButton: path
in: self
state: buttonState];
}
- (NSBezierPath*) pathForFrame: (NSRect)cellFrame
{
CGFloat r = 3;
cellFrame = NSInsetRect(cellFrame, 1, 1);
cellFrame.origin.x += 0.5;
cellFrame.origin.y += 0.5;
NSRect innerRect = NSInsetRect(cellFrame, r, r);
NSBezierPath* path = [NSBezierPath bezierPath];
switch(scroller_arrow_type)
{
case RikScrollerArrowLeft:
cellFrame.origin.x += 1.0;
[path appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(innerRect), NSMinY(innerRect))
radius: r
startAngle: 180
endAngle: 270];
[path lineToPoint: NSMakePoint(NSMaxX(cellFrame), NSMinY(cellFrame))];
[path lineToPoint: NSMakePoint(NSMaxX(cellFrame), NSMaxY(cellFrame))];
[path appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(innerRect), NSMaxY(innerRect))
radius: r
startAngle: 90
endAngle: 180];
[path closePath];
break;
case RikScrollerArrowRight:
cellFrame.origin.x -= 1.0;
[path moveToPoint: NSMakePoint(NSMinX(cellFrame), NSMinY(cellFrame))];
[path appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(innerRect), NSMinY(innerRect))
radius: r
startAngle: 270
endAngle: 360];
[path appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(innerRect), NSMaxY(innerRect))
radius: r
startAngle: 0
endAngle: 90];
[path lineToPoint: NSMakePoint(NSMinX(cellFrame), NSMaxY(cellFrame))];
break;
case RikScrollerArrowDown:
cellFrame.origin.y -= 1.0;
[path moveToPoint: NSMakePoint(NSMinX(cellFrame), NSMinY(cellFrame))];
[path moveToPoint: NSMakePoint(NSMaxX(cellFrame), NSMinY(cellFrame))];
[path appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(innerRect), NSMaxY(innerRect))
radius: r
startAngle: 0
endAngle: 90];
[path appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(innerRect), NSMaxY(innerRect))
radius: r
startAngle: 90
endAngle: 180];
[path lineToPoint: NSMakePoint(NSMinX(cellFrame), NSMinY(cellFrame))];
break;
case RikScrollerArrowUp:
cellFrame.origin.y += 1.0;
[path appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(innerRect), NSMinY(innerRect))
radius: r
startAngle: 180
endAngle: 270];
[path appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(innerRect), NSMinY(innerRect))
radius: r
startAngle: 270
endAngle: 360];
[path lineToPoint: NSMakePoint(NSMaxX(cellFrame), NSMaxY(cellFrame))];
[path lineToPoint: NSMakePoint(NSMinX(cellFrame), NSMaxY(cellFrame))];
[path closePath];
break;
}
return path;
}
@end

View File

@ -15,13 +15,12 @@
green: 0.6
blue:0.6
alpha: 1.0];
cellFrame = NSInsetRect(cellFrame, 1, 1);
CGFloat radius = 4;
cellFrame = NSInsetRect(cellFrame, 2, 2);
CGFloat radius = 5;
NSBezierPath* roundedRectanglePath = [NSBezierPath bezierPathWithRoundedRect: cellFrame
xRadius: radius
yRadius: radius];
[baseColor setFill];
[roundedRectanglePath fill];
}
@end

View File

@ -11,14 +11,12 @@
{
if (NSIsEmptyRect(cellFrame))
return;
// cellFrame = NSInsetRect(cellFrame, 1, 1);
NSColor * baseColor = [NSColor colorWithCalibratedRed: 0.95
green: 0.95
blue: 0.95
alpha: 1.0];
// if([self backgroundColor])
// baseColor = [self backgroundColor];
NSColor *shadowColor = [baseColor shadowWithLevel: 0.06];
NSColor *shadowColor = [baseColor shadowWithLevel: 0.15];
NSGradient* gr = [[NSGradient alloc] initWithColorsAndLocations:
shadowColor, 1.0,
baseColor, 0.7,
@ -30,6 +28,7 @@
if(horizontal)
a = 90;
[gr drawInRect: cellFrame angle: a];
//[self drawInteriorWithFrame: cellFrame inView: controlView];
[shadowColor set];
NSFrameRect(cellFrame);
}
@end

View File

@ -3,13 +3,9 @@
@implementation RikWindowButton
+ (void) initialize
+ (Class) cellClass
{
if (self == [RikWindowButton class])
{
[self setVersion: 1];
[self setCellClass: [RikWindowButtonCell class]];
}
return [RikWindowButtonCell class];
}
- (void) setBaseColor: (NSColor*)c
{