Class: TestSuiteOSXDelegate

Inherits:
Object
  • Object
show all
Defined in:
motion/test_suite_delegate.rb

Instance Method Summary collapse

Instance Method Details

#applicationDidFinishLaunching(notification) ⇒ Object



13
14
15
16
# File 'motion/test_suite_delegate.rb', line 13

def applicationDidFinishLaunching(notification)
  buildMenu
  buildWindow
end

#buildMenuObject



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
# File 'motion/test_suite_delegate.rb', line 26

def buildMenu
  @mainMenu = NSMenu.new

  appName = "BubbleWrap Tests"
  addMenu(appName) do
    addItemWithTitle("About #{appName}", action: 'orderFrontStandardAboutPanel:', keyEquivalent: '')
    addItem(NSMenuItem.separatorItem)
    addItemWithTitle('Preferences', action: 'openPreferences:', keyEquivalent: ',')
    addItem(NSMenuItem.separatorItem)
    servicesItem = addItemWithTitle('Services', action: nil, keyEquivalent: '')
    NSApp.servicesMenu = servicesItem.submenu = NSMenu.new
    addItem(NSMenuItem.separatorItem)
    addItemWithTitle("Hide #{appName}", action: 'hide:', keyEquivalent: 'h')
    item = addItemWithTitle('Hide Others', action: 'hideOtherApplications:', keyEquivalent: 'H')
    item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
    addItemWithTitle('Show All', action: 'unhideAllApplications:', keyEquivalent: '')
    addItem(NSMenuItem.separatorItem)
    addItemWithTitle("Quit #{appName}", action: 'terminate:', keyEquivalent: 'q')
  end

  NSApp.helpMenu = addMenu('Help') do
    addItemWithTitle("#{appName} Help", action: 'showHelp:', keyEquivalent: '?')
  end.menu

  NSApp.mainMenu = @mainMenu
end

#buildWindowObject



18
19
20
21
22
23
24
# File 'motion/test_suite_delegate.rb', line 18

def buildWindow
  @mainWindow = NSWindow.alloc.initWithContentRect([[240, 180], [480, 360]],
    styleMask: NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
    backing: NSBackingStoreBuffered,
    defer: false)
  @mainWindow.title = "BubbleWrap Tests"
end