15 #ifndef COCOA_LABEL_MM
16 #define COCOA_LABEL_MM
23 - (id)initWithFrame:(NSRect)frame {
24 self = [
super initWithFrame:frame];
38 NSString *title = [
self stringValue];
39 if (title && [title length]>0) {
40 NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
41 [NSColor blackColor], NSForegroundColorAttributeName,
42 [
self font], NSFontAttributeName,
44 return [title sizeWithAttributes:attributes];
49 -(void) computeMinWidth {
50 NSSize size = [
self neededTextSize];
54 - (void)setStringValue:(NSString *)aString {
58 NSRange htmlRange = [aString rangeOfString:@"<html>"];
59 if (htmlRange.location != NSNotFound) {
60 NSRange endHtmlRange = [aString rangeOfString:@"</html>"];
61 if (endHtmlRange.location != NSNotFound) {
62 NSString *stringToUse =
@"";
63 NSRange cutRange = NSUnionRange(htmlRange, endHtmlRange);
64 stringToUse = [aString stringByReplacingCharactersInRange:cutRange withString:@""];
65 [
super setStringValue:stringToUse];
66 [
self computeMinWidth];
71 [
super setStringValue:aString];
72 [
self computeMinWidth];
82 #pragma mark Protocol Methods