2 Smultron version 3.1, 2007-05-19
3 Written by Peter Borg, pgw3@mac.com
4 Find the latest version at http://smultron.sourceforge.net
6 Copyright 2004-2007 Peter Borg
8 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
16 #import "SMLStatusBarTextFieldCell.h"
18 @implementation SMLStatusBarTextFieldCell
21 - (id)initTextCell:(NSString *)text
23 if (self = [super initTextCell:text]) {
25 // statusBarGradient = [[CTGradient statusBarGradient] retain];
28 attributes = [[NSMutableDictionary dictionaryWithDictionary:[[self attributedStringValue] attributesAtIndex:0 effectiveRange:NULL]] mutableCopy];
29 [attributes setValue:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]] forKey:NSFontAttributeName];
30 [attributes setValue:[NSColor colorWithCalibratedWhite:0.05 alpha:0.9] forKey:@"NSColor"];
37 - (void)drawWithFrame:(NSRect)inFrame inView:(NSView *)inView
39 [statusBarGradient fillRect:inFrame angle:90];
41 NSRect centeredRect = inFrame;
42 centeredRect.size = [[self stringValue] sizeWithAttributes:attributes];
43 centeredRect.origin.x += ((inFrame.size.width - centeredRect.size.width) / 2.0);
44 centeredRect.origin.y = ((inFrame.size.height - centeredRect.size.height) / 2.0) - 1;
46 [[self stringValue] drawInRect:centeredRect withAttributes:attributes];