1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 06:02:57 +00:00

Better fonts for filter bar.

This commit is contained in:
Mitchell Livingston 2006-07-16 16:08:45 +00:00
parent 67eaa8809b
commit 904c30cb89

View file

@ -107,44 +107,41 @@
//call only once to avoid overlapping text //call only once to avoid overlapping text
- (void) setText: (NSString *) text - (void) setText: (NSString *) text
{ {
NSShadow * stringShadow = [[NSShadow alloc] init];
[stringShadow setShadowOffset: NSMakeSize(1.0, -1.0)];
[stringShadow setShadowBlurRadius: 1.0];
NSDictionary * normalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: NSDictionary * normalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSColor blackColor], NSForegroundColorAttributeName, [NSColor blackColor], NSForegroundColorAttributeName,
[NSFont messageFontOfSize: 12.0], NSFontAttributeName, [NSFont fontWithName: @"Helvetica" size: 12.0], NSFontAttributeName, nil];
stringShadow, NSShadowAttributeName, nil];
NSDictionary * highlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: NSDictionary * highlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSColor whiteColor], NSForegroundColorAttributeName, [NSColor whiteColor], NSForegroundColorAttributeName,
[NSFont messageFontOfSize: 12.0], NSFontAttributeName, [NSFont fontWithName: @"Helvetica Bold" size: 12.0], NSFontAttributeName, nil];
stringShadow, NSShadowAttributeName, nil];
[stringShadow release]; NSSize textSizeNormal = [text sizeWithAttributes: normalAttributes],
textSizeBold = [text sizeWithAttributes: highlightedAttributes],
NSSize textSize = [text sizeWithAttributes: normalAttributes],
buttonSize = [self frame].size; buttonSize = [self frame].size;
NSRect textRect = NSMakeRect((buttonSize.width - textSize.width) * 0.5,
(buttonSize.height - textSize.height) * 0.5 + 1.5, textSize.width, textSize.height); NSRect textRectNormal = NSMakeRect((buttonSize.width - textSizeNormal.width) * 0.5,
(buttonSize.height - textSizeNormal.height) * 0.5 + 1.5, textSizeNormal.width, textSizeNormal.height),
textRectBold = NSMakeRect((buttonSize.width - textSizeBold.width) * 0.5,
(buttonSize.height - textSizeBold.height) * 0.5 + 1.5, textSizeBold.width, textSizeBold.height);
//normal button //normal button
[fButtonNormal lockFocus]; [fButtonNormal lockFocus];
[text drawInRect: textRect withAttributes: normalAttributes]; [text drawInRect: textRectNormal withAttributes: normalAttributes];
[fButtonNormal unlockFocus]; [fButtonNormal unlockFocus];
//rolled over button //rolled over button
[fButtonOver lockFocus]; [fButtonOver lockFocus];
[text drawInRect: textRect withAttributes: highlightedAttributes]; [text drawInRect: textRectBold withAttributes: highlightedAttributes];
[fButtonOver unlockFocus]; [fButtonOver unlockFocus];
//pressed button //pressed button
[fButtonPressed lockFocus]; [fButtonPressed lockFocus];
[text drawInRect: textRect withAttributes: highlightedAttributes]; [text drawInRect: textRectBold withAttributes: highlightedAttributes];
[fButtonPressed unlockFocus]; [fButtonPressed unlockFocus];
//selected button //selected button
[fButtonSelected lockFocus]; [fButtonSelected lockFocus];
[text drawInRect: textRect withAttributes: highlightedAttributes]; [text drawInRect: textRectBold withAttributes: highlightedAttributes];
[fButtonSelected unlockFocus]; [fButtonSelected unlockFocus];
[self setImage: fButtonNormal]; [self setImage: fButtonNormal];