You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
9 years ago
|
|
||
|
|
||
|
#import "MenubarController.h"
|
||
|
#import "StatusItemView.h"
|
||
|
|
||
|
@implementation MenubarController
|
||
|
|
||
|
@synthesize statusItemView = _statusItemView;
|
||
|
|
||
|
#pragma mark -
|
||
|
|
||
|
- (id)init
|
||
|
{
|
||
|
self = [super init];
|
||
|
if (self != nil)
|
||
|
{
|
||
|
// Install status item into the menu bar
|
||
|
NSStatusItem *statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:STATUS_ITEM_VIEW_WIDTH];
|
||
|
_statusItemView = [[StatusItemView alloc] initWithStatusItem:statusItem];
|
||
|
_statusItemView.image = [NSImage imageNamed:@"Status"];
|
||
|
_statusItemView.alternateImage = [NSImage imageNamed:@"StatusHighlighted"];
|
||
|
_statusItemView.action = @selector(togglePanel:);
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)dealloc
|
||
|
{
|
||
|
[[NSStatusBar systemStatusBar] removeStatusItem:self.statusItem];
|
||
|
}
|
||
|
|
||
|
#pragma mark -
|
||
|
#pragma mark Public accessors
|
||
|
|
||
|
- (NSStatusItem *)statusItem
|
||
|
{
|
||
|
return self.statusItemView.statusItem;
|
||
|
}
|
||
|
|
||
|
#pragma mark -
|
||
|
|
||
|
- (BOOL)hasActiveIcon
|
||
|
{
|
||
|
return self.statusItemView.isHighlighted;
|
||
|
}
|
||
|
|
||
|
- (void)setHasActiveIcon:(BOOL)flag
|
||
|
{
|
||
|
self.statusItemView.isHighlighted = flag;
|
||
|
}
|
||
|
|
||
|
@end
|