+@interface WBIconLabel : NSProxy {
+ NSString *label_;
+ BOOL docked_;
+}
+
+- (id) initWithLabel:(NSString *)label;
+- (void) setInDock:(BOOL)docked;
+
+@end
+
+@implementation WBIconLabel
+
+- (void) dealloc {
+ [label_ release];
+ [super dealloc];
+}
+
+- (id) initWithLabel:(NSString *)label {
+ label_ = [label retain];
+ return self;
+}
+
+- (BOOL) respondsToSelector:(SEL)sel {
+ return
+ sel == @selector(setInDock:)
+ ? YES : [super respondsToSelector:sel];
+}
+
+- (NSMethodSignature*) methodSignatureForSelector:(SEL)sel {
+ if (NSMethodSignature *sig = [label_ methodSignatureForSelector:sel])
+ return sig;
+ NSLog(@"WB:Error: [WBIconLabel methodSignatureForSelector:(%s)]", sel_getName(sel));
+ return nil;
+}
+
+- (void) forwardInvocation:(NSInvocation*)inv {
+ SEL sel = [inv selector];
+ if ([label_ respondsToSelector:sel])
+ [inv invokeWithTarget:label_];
+ else
+ NSLog(@"WB:Error: [WBIconLabel forwardInvocation:(%s)]", sel_getName(sel));
+}
+
+- (NSString *) _iconLabelStyle {
+ return Info_ == nil ? nil : [Info_ objectForKey:(docked_ ? @"DockIconLabelStyle" : @"IconLabelStyle")];
+}
+
+- (CGSize) drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(int)mode alignment:(int)alignment {
+ if (NSString *custom = [self _iconLabelStyle]) {
+ [label_ drawInRect:rect withStyle:[NSString stringWithFormat:@"font-family: Helvetica; font-weight: bold; font-size: 11px; text-align: center; %@", custom]];
+ return CGSizeZero;
+ }
+
+ return [label_ drawInRect:rect withFont:font lineBreakMode:mode alignment:alignment];
+}
+
+- (void) drawInRect:(CGRect)rect withStyle:(NSString *)style {
+ if (NSString *custom = [self _iconLabelStyle])
+ return [label_ drawInRect:rect withStyle:[NSString stringWithFormat:@"%@; %@", style, custom]];
+ return [label_ drawInRect:rect withStyle:style];
+}
+
+- (void) setInDock:(BOOL)docked {
+ docked_ = docked;
+}
+
+@end
+
+void SBIconLabel$setInDock$(SBIconLabel<WinterBoard> *self, SEL sel, BOOL docked) {
+ id label;
+ object_getInstanceVariable(self, "_label", (void **) &label);
+ if (Info_ == nil || [Info_ boolForKey:@"IconLabelInDock"])
+ docked = YES;
+ if (label != nil && [label respondsToSelector:@selector(setInDock:)])
+ [label setInDock:docked];
+ return [self wb_setInDock:docked];
+}
+
+id SBIconLabel$initWithSize$label$(SBIconLabel<WinterBoard> *self, SEL sel, CGSize size, NSString *label) {
+ return [self wb_initWithSize:size label:[[[WBIconLabel alloc] initWithLabel:label] autorelease]];
+}
+