Skip to content

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Panupan Sriautharawong committed Dec 17, 2011
1 parent 7499507 commit 4261432
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion WILLTabView/WILLTabCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ - (void) drawSegment:(NSInteger)segment inFrame:(NSRect)frame withView:(NSView *
middleImage = [NSImage imageNamed:@TAB_NORMAL];
rightImage = [NSImage imageNamed:@TAB_NORMAL];

if ((highlightedSegment == segment) | ([self isSelectedForSegment:segment] && highlightedSegment == -1)){
if ((highlightedSegment == segment) || ([self isSelectedForSegment:segment] && highlightedSegment == -1)){
leftImage = [NSImage imageNamed:@TAB_BORDER];
middleImage = [NSImage imageNamed:@TAB_SELECTED];
rightImage = [NSImage imageNamed:@TAB_BORDER];
Expand Down
19 changes: 10 additions & 9 deletions WILLTabView/WILLTabView/WILLSubTabCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,28 @@ - (void) drawSegment:(NSInteger)seg inFrame:(NSRect)frame withView:(NSView *)con
[self setWidth:frame.size.width forSegment:seg];

NSBezierPath* drawingPath = [NSBezierPath bezierPath];
[drawingPath appendBezierPathWithRoundedRect:NSInsetRect(frame, 2, 2) xRadius:10 yRadius:10];
[[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:.4] setFill];
[drawingPath appendBezierPathWithRoundedRect:NSInsetRect(frame, 4, 3) xRadius:8 yRadius:8];
[[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:.3] setFill];
if (seg == highlightedSegment || [self isSelectedForSegment:seg]) {
[drawingPath fill];
[drawingPath setLineWidth:1];
[[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:.1] set];
[[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:.31] set];
[drawingPath stroke];
}

NSMutableParagraphStyle *paragraph;
paragraph = [[NSMutableParagraphStyle alloc] init];
[paragraph setLineBreakMode:NSLineBreakByTruncatingTail];
[paragraph setAlignment:NSCenterTextAlignment];

NSColor *textColor = seg == highlightedSegment || [self isSelectedForSegment:seg] ? [NSColor whiteColor] : [NSColor blackColor];
NSDictionary *labelAttr = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont systemFontOfSize:[NSFont smallSystemFontSize]], NSFontAttributeName,
[self isSelectedForSegment:seg] ? [NSColor whiteColor] : [NSColor blackColor], NSForegroundColorAttributeName,
//shadow, NSShadowAttributeName,
paragraph, NSParagraphStyleAttributeName, nil];
[NSFont boldSystemFontOfSize:10], NSFontAttributeName,
textColor, NSForegroundColorAttributeName,
//shadow, NSShadowAttributeName,
paragraph, NSParagraphStyleAttributeName, nil];
NSAttributedString *attrStr = [[NSAttributedString alloc] initWithString:label attributes:labelAttr];
[attrStr drawInRect:NSInsetRect(frame, 2, 3)];
[attrStr drawInRect:NSInsetRect(frame, 2, 4)];
}

- (id)initWithCoder:(NSCoder *)decoder;
Expand Down

0 comments on commit 4261432

Please sign in to comment.