forked from wiffbi/Kimidi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrayMenu.m
70 lines (47 loc) · 1.69 KB
/
TrayMenu.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// TrayMenu.m
// Kimidi
//
// Created by Richard Schreiber on 28.07.09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "TrayMenu.h"
#import "AppController.h"
@implementation TrayMenu
- (void) openWebsite:(id)sender {
NSURL *url = [NSURL URLWithString:@"https://github.com/matatata/Kimidi/blob/master/README.md"];
[[NSWorkspace sharedWorkspace] openURL:url];
}
- (void) actionQuit:(id)sender {
[NSApp terminate:sender];
}
- (NSMenu *) createMenu {
NSZone *menuZone = [NSMenu menuZone];
NSMenu *menu = [[NSMenu allocWithZone:menuZone] init];
NSMenuItem *menuItem;
menuItem = [menu addItemWithTitle:@"Visit Website"
action:@selector(openWebsite:)
keyEquivalent:@""];
[menuItem setTarget:self];
// Add Separator
[menu addItem:[NSMenuItem separatorItem]];
// Add Quit Action
menuItem = [menu addItemWithTitle:@"Quit Kimidi"
action:@selector(actionQuit:)
keyEquivalent:@""];
[menuItem setTarget:self];
return menu;
}
- (void) applicationDidFinishLaunching:(NSNotification *)notification {
NSMenu *menu = [self createMenu];
_statusItem = [[[NSStatusBar systemStatusBar]
statusItemWithLength:NSSquareStatusItemLength] retain];
[_statusItem setMenu:menu];
[_statusItem setHighlightMode:YES];
[_statusItem setToolTip:@"Kimidi\nTransforms global hotkeys to MIDI messages\nfor selected track control in Ableton Live"];
[_statusItem setImage:[NSImage imageNamed:@"menubar.png"]];
[_statusItem setAlternateImage:[NSImage imageNamed:@"menubar-hover.png"]];
[menu release];
[[[AppController alloc] init] awakeFromNib];
}
@end