blob: 65e0125162b1874a8a6fab77383c725d47a39660 [file] [log] [blame]
Ilya Moiseenko0c9ab7c2013-10-29 15:08:23 -07001/* -*- Mode: objc; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07002/**
3 * Copyright (c) 2013-2014, Regents of the University of California,
Ilya Moiseenko0c9ab7c2013-10-29 15:08:23 -07004 *
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07005 * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD
6 * authors and contributors.
7 *
8 * NFD Control Center is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with NFD
17 * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * \author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
20 * \author Ilya Moiseenko <http://ilyamoiseenko.com/>
Ilya Moiseenko0c9ab7c2013-10-29 15:08:23 -070021 */
22
23#import "tight-menu-item-view.h"
24
25@implementation TightMenuItemView
26
27-(void)setStatus:(NSString*)value
28{
29 status = value;
30}
31
32- (void) drawRect:(NSRect)dirtyRect
33{
34 [self setSubviews:[NSArray array]];
35
36 NSRect fullBounds = [self bounds];
37 fullBounds.size.height += 4;
38 [[NSBezierPath bezierPathWithRect:fullBounds] setClip];
39
40
41 [[NSColor colorWithCalibratedRed:(70.0f/255.0f)
42 green:(70.0f/255.0f)
43 blue:(70.0f/255.0f)
44 alpha:1.0] set];
45 NSRectFill(fullBounds);
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070046
Ilya Moiseenko0c9ab7c2013-10-29 15:08:23 -070047 NSTextField *connectionStatusText = [[NSTextField alloc] initWithFrame:[self bounds]];
48 [connectionStatusText setTextColor:[NSColor whiteColor]];
49 [connectionStatusText setStringValue:status];
50 [connectionStatusText setEditable:NO];
51 [connectionStatusText setBezeled:NO];
52 [connectionStatusText setDrawsBackground:NO];
53 [connectionStatusText setSelectable:NO];
54 [connectionStatusText setAlignment:NSCenterTextAlignment];
55 NSFont *theFont = [NSFont fontWithName:@"Lucida Grande" size:14];
56 [connectionStatusText setFont:theFont];
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070057
Ilya Moiseenko0c9ab7c2013-10-29 15:08:23 -070058 [self addSubview: connectionStatusText];
59}
60
61
62@end