-@implementation WBIconLabel
-
-- (void) dealloc {
- [string_ release];
- [super dealloc];
-}
-
-- (id) initWithString:(NSString *)string {
- string_ = [string retain];
- return self;
-}
-
-WBDelegate(string_)
-
-- (NSString *) _iconLabelStyle {
- NSString *key = docked_ ? @"DockedIconLabelStyle" : @"UndockedIconLabelStyle";
- NSString *style = [Info_ objectForKey:key];
- return style;
-}
-
-- (CGSize) drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(int)mode alignment:(int)alignment {
- if (NSString *custom = [self _iconLabelStyle]) {
- NSString *style = [NSString stringWithFormat:@""
- "font-family: Helvetica; "
- "font-weight: bold; "
- "font-size: 11px; "
- "text-align: center; "
- "color: %@; "
- "%@", docked_ ? @"white" : @"#b3b3b3", custom];
-
- if (Debug_)
- NSLog(@"WB:Debug:style = %@", style);
- [string_ drawInRect:rect withStyle:style];
- return CGSizeZero;
- }
-
- return [string_ drawInRect:rect withFont:font lineBreakMode:mode alignment:alignment];
-}
-
-- (void) drawInRect:(CGRect)rect withStyle:(NSString *)style {
- if (NSString *custom = [self _iconLabelStyle]) {
- NSString *combined = [NSString stringWithFormat:@"%@; %@", style, custom];
- if (Debug_)
- NSLog(@"WB:Debug:combined = %@", combined);
- return [string_ drawInRect:rect withStyle:combined];
- }
- return [string_ drawInRect:rect withStyle:style];
-}
-
-- (BOOL) respondsToSelector:(SEL)sel {
- return
- sel == @selector(setInDock:)
- ? true : [super respondsToSelector:sel];
-}
-
-- (void) setInDock:(BOOL)docked {
- docked_ = docked;
-}
-
-@end
-