+@end
+/* }}} */
+/* Package Cell {{{ */
+@interface PackageCell : UITableCell {
+ UITextLabel *name_;
+ UIRightTextLabel *version_;
+ UITextLabel *description_;
+}
+
+- (void) dealloc;
+
+- (PackageCell *) initWithPackage:(Package *)package;
+
+- (void) _setSelected:(float)fraction;
+- (void) setSelected:(BOOL)selected;
+- (void) setSelected:(BOOL)selected withFade:(BOOL)fade;
+- (void) _setSelectionFadeFraction:(float)fraction;
+
+@end
+
+@implementation PackageCell
+
+- (void) dealloc {
+ [name_ release];
+ [version_ release];
+ [description_ release];
+ [super dealloc];
+}
+
+- (PackageCell *) initWithPackage:(Package *)package {
+ if ((self = [super init]) != nil) {
+ GSFontRef bold = GSFontCreateWithName("Helvetica", kGSFontTraitBold, 22);
+ GSFontRef large = GSFontCreateWithName("Helvetica", kGSFontTraitNone, 16);
+ GSFontRef small = GSFontCreateWithName("Helvetica", kGSFontTraitNone, 14);
+
+ CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
+ float clear[] = {0, 0, 0, 0};
+
+ name_ = [[UITextLabel alloc] initWithFrame:CGRectMake(12, 7, 250, 25)];
+ [name_ setText:[package name]];
+ [name_ setBackgroundColor:CGColorCreate(space, clear)];
+ [name_ setFont:bold];
+
+ version_ = [[UIRightTextLabel alloc] initWithFrame:CGRectMake(290, 7, 70, 25)];
+ [version_ setText:[package version]];
+ [version_ setBackgroundColor:CGColorCreate(space, clear)];
+ [version_ setFont:large];
+
+ description_ = [[UITextLabel alloc] initWithFrame:CGRectMake(13, 35, 315, 20)];
+ [description_ setText:[package tagline]];
+ [description_ setBackgroundColor:CGColorCreate(space, clear)];
+ [description_ setFont:small];
+
+ [self addSubview:name_];
+ [self addSubview:version_];
+ [self addSubview:description_];
+
+ CFRelease(small);
+ CFRelease(large);
+ CFRelease(bold);
+ } return self;
+}
+
+- (void) _setSelected:(float)fraction {
+ CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
+
+ float black[] = {
+ interpolate(0.0, 1.0, fraction),
+ interpolate(0.0, 1.0, fraction),
+ interpolate(0.0, 1.0, fraction),
+ 1.0};
+
+ float blue[] = {
+ interpolate(0.2, 1.0, fraction),
+ interpolate(0.2, 1.0, fraction),
+ interpolate(1.0, 1.0, fraction),
+ 1.0};
+
+ float gray[] = {
+ interpolate(0.4, 1.0, fraction),
+ interpolate(0.4, 1.0, fraction),
+ interpolate(0.4, 1.0, fraction),
+ 1.0};
+
+ [name_ setColor:CGColorCreate(space, black)];
+ [version_ setColor:CGColorCreate(space, blue)];
+ [description_ setColor:CGColorCreate(space, gray)];
+}
+
+- (void) setSelected:(BOOL)selected {
+ [self _setSelected:(selected ? 1.0 : 0.0)];
+ [super setSelected:selected];
+}
+
+- (void) setSelected:(BOOL)selected withFade:(BOOL)fade {
+ if (!fade)
+ [self _setSelected:(selected ? 1.0 : 0.0)];
+ [super setSelected:selected withFade:fade];
+}
+
+- (void) _setSelectionFadeFraction:(float)fraction {
+ [self _setSelected:fraction];
+ [super _setSelectionFadeFraction:fraction];
+}
+