blob: acd7830a42421d49b432afd5f6864ea7c546511e [file] [log] [blame]
Ilya Moiseenko0c9ab7c2013-10-29 15:08:23 -07001//
2/* -*- Mode: objc; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
3/*
4 * @copyright See LICENCE for copyright and license information.
5 *
6 * @author Alexander Afanasyev <alexander.afanasyev@ucla.edu>
7 * @author Ilya Moiseenko <iliamo@ucla.edu>
8 */
9
10#import "tight-menu-item-view.h"
11
12@implementation TightMenuItemView
13
14-(void)setStatus:(NSString*)value
15{
16 status = value;
17}
18
19- (void) drawRect:(NSRect)dirtyRect
20{
21 [self setSubviews:[NSArray array]];
22
23 NSRect fullBounds = [self bounds];
24 fullBounds.size.height += 4;
25 [[NSBezierPath bezierPathWithRect:fullBounds] setClip];
26
27
28 [[NSColor colorWithCalibratedRed:(70.0f/255.0f)
29 green:(70.0f/255.0f)
30 blue:(70.0f/255.0f)
31 alpha:1.0] set];
32 NSRectFill(fullBounds);
33
34 NSTextField *connectionStatusText = [[NSTextField alloc] initWithFrame:[self bounds]];
35 [connectionStatusText setTextColor:[NSColor whiteColor]];
36 [connectionStatusText setStringValue:status];
37 [connectionStatusText setEditable:NO];
38 [connectionStatusText setBezeled:NO];
39 [connectionStatusText setDrawsBackground:NO];
40 [connectionStatusText setSelectable:NO];
41 [connectionStatusText setAlignment:NSCenterTextAlignment];
42 NSFont *theFont = [NSFont fontWithName:@"Lucida Grande" size:14];
43 [connectionStatusText setFont:theFont];
44
45 [self addSubview: connectionStatusText];
46}
47
48
49@end