-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestHarness.rb
More file actions
36 lines (30 loc) · 943 Bytes
/
TestHarness.rb
File metadata and controls
36 lines (30 loc) · 943 Bytes
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
#
# TestHarness.rb
# WindowMover
#
# Created by Andrew Willis on 1/22/09.
# Copyright (c) 2009 __MyCompanyName__. All rights reserved.
#
class TestHarness
attr_writer :menu
def awakeFromNib
# register the hotkey
@hotkey = NDHotKeyEvent.hotKeyWithKeyCode(46, character:46, modifierFlags: (NSCommandKeyMask + NSShiftKeyMask))
@hotkey.setTarget(self, selector:("buttonClicked:"))
@hotkey.setEnabled(true)
# create the status item
bundle = NSBundle.bundleForClass(self.class)
icon_path = bundle.pathForResource("menubar_icon", ofType:"tif")
status_item = NSStatusBar.systemStatusBar.statusItemWithLength(24) # TODO: why is 24 the right size here?
status_item.image = NSImage.new.initWithContentsOfFile(icon_path)
status_item.menu = @menu
end
def statusItemClicked(sender)
NSApp.terminate(sender)
end
def buttonClicked(sender)
front = FrontWindow.new
frame = front.frame
front.toggleScreen
end
end