|
/* |
|
* NavigationCell.j |
|
* DesktopShop |
|
* |
|
* Created by Nicholas Small on February 2, 2010. |
|
* Copyright 2010, JadedPixel, Inc. All rights reserved. |
|
*/ |
|
|
|
@import <AppKit/CPView.j> |
|
|
|
|
|
@implementation NavigationCell : CPView |
|
{ |
|
CPTextField textField; |
|
} |
|
|
|
- (id)initWithFrame:(CGRect)aFrame |
|
{ |
|
self = [super initWithFrame:aFrame]; |
|
|
|
if (self) |
|
{ |
|
textField = [[CPTextField alloc] initWithFrame:CGRectMake(10.0, 0.0, CGRectGetWidth(aFrame) - 10.0, CGRectGetHeight(aFrame))]; |
|
[textField setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; |
|
[textField setVerticalAlignment:CPCenterVerticalTextAlignment]; |
|
[textField setLineBreakMode:CPLineBreakByTruncatingTail]; |
|
[textField setTextShadowOffset:CGSizeMake(0.0, 1.0)]; |
|
|
|
[textField setValue:[CPFont boldFontWithName:@"Myriad Pro" size:12] forThemeAttribute:@"font"]; |
|
[textField setValue:[CPColor colorWithCalibratedRed:0.455 green:0.506 blue:0.569 alpha:1.0] forThemeAttribute:@"text-color"]; |
|
[textField setValue:[CPColor whiteColor] forThemeAttribute:@"text-shadow-color"]; |
|
|
|
[textField setValue:[CPFont boldFontWithName:@"Myriad Pro" size:11] forThemeAttribute:@"font" inState:CPThemeStateSelected]; |
|
[textField setValue:[CPColor colorWithCalibratedWhite:0.94 alpha:1.0] forThemeAttribute:@"text-color" inState:CPThemeStateSelected]; |
|
[textField setValue:[CPColor colorWithCalibratedWhite:0.31 alpha:1.0] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateSelected]; |
|
|
|
[self addSubview:textField]; |
|
} |
|
|
|
return self; |
|
} |
|
|
|
- (void)setObjectValue:(id)anObject |
|
{ |
|
[textField setObjectValue:anObject]; |
|
} |
|
|
|
- (void)setThemeState:(id)aState |
|
{ |
|
[super setThemeState:aState]; |
|
[textField setThemeState:aState]; |
|
} |
|
|
|
- (void)unsetThemeState:(id)aState |
|
{ |
|
[super unsetThemeState:aState]; |
|
[textField unsetThemeState:aState]; |
|
} |
|
|
|
@end |
|
|
|
@implementation NavigationCell (CPCoding) |
|
|
|
- (id)initWithCoder:(CPCoder)aCoder |
|
{ |
|
self = [super initWithCoder:aCoder]; |
|
|
|
if (self) |
|
textField = [aCoder decodeObjectForKey:@"NavigationCellTextField"]; |
|
|
|
return self; |
|
} |
|
|
|
- (void)encodeWithCoder:(CPCoder)aCoder |
|
{ |
|
[super encodeWithCoder:aCoder]; |
|
[aCoder encodeObject:textField forKey:@"NavigationCellTextField"]; |
|
} |
|
|
|
@end |