Add Menu.setApplicationMenu API to set main menu of NSApp.
This commit is contained in:
parent
64a8664ffe
commit
937b811c8d
5 changed files with 46 additions and 5 deletions
|
@ -1,7 +1,8 @@
|
|||
EventEmitter = require('events').EventEmitter
|
||||
BrowserWindow = require 'browser_window'
|
||||
|
||||
Menu = process.atomBinding('menu').Menu
|
||||
bindings = process.atomBinding 'menu'
|
||||
Menu = bindings.Menu
|
||||
Menu::__proto__ = EventEmitter.prototype
|
||||
|
||||
popup = Menu::popup
|
||||
|
@ -24,4 +25,8 @@ Menu::appendRadioItem = (args...) -> @insertRadioItem -1, args...
|
|||
Menu::appendSeparator = (args...) -> @insertSeparator -1, args...
|
||||
Menu::appendSubMenu = (args...) -> @insertSubMenu -1, args...
|
||||
|
||||
Menu.setApplicationMenu = (menu) ->
|
||||
throw new TypeError('Invalid menu') unless menu?.constructor is Menu
|
||||
bindings.setApplicationMenu menu
|
||||
|
||||
module.exports = Menu
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue