+@interface WBSThemesTableViewCell : UITableViewCell {
+ UIImageView *checkmark_;
+ UIImageView *icon_;
+ UILabel *name_;
+}
+
+@end
+
+@implementation WBSThemesTableViewCell
+
+- (void) dealloc {
+ [super dealloc];
+ [checkmark_ release];
+ [icon_ release];
+ [name_ release];
+}
+
+- (id) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuse {
+ if ((self = [super initWithFrame:frame reuseIdentifier:reuse]) != nil) {
+ CGFloat border(48), check(40), icon(64);
+ UIView *content([self contentView]);
+ CGSize size([content frame].size);
+
+ checkmark_ = [[UIImageView alloc] initWithFrame:CGRectMake(std::floor((border - check) / 2), 0, check, size.height)];
+ [checkmark_ setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
+ [content addSubview:checkmark_];
+
+ name_ = [[UILabel alloc] initWithFrame:CGRectMake(border, 0, 0, size.height)];
+ [name_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
+ [content addSubview:name_];
+
+ icon_ = [[UIImageView alloc] initWithFrame:CGRectMake(size.width - icon - 48, 0, icon, icon)];
+ [content addSubview:icon_];
+ } return self;
+}
+
+- (void) setCheck:(bool)inactive {
+ [self setImage:(inactive ? uncheckedImage : checkImage)];
+}
+
+- (void) setTheme:(NSDictionary *)theme {
+ [name_ setText:[theme objectForKey:@"Name"]];
+
+ NSNumber *active([theme objectForKey:@"Active"]);
+ BOOL inactive(active == nil || ![active boolValue]);
+ [self setCheck:inactive];
+
+ CGRect area([name_ frame]);
+ area.size.width = ([icon_ image] == nil ? self.contentView.frame.size.width : icon_.frame.origin.x) - area.origin.x - 9;
+ [name_ setFrame:area];
+}
+
+@end
+