win: Add BrowserWindow.setMenu API.
This commit is contained in:
parent
2024ae5dba
commit
5a6ff0f80d
7 changed files with 54 additions and 1 deletions
|
@ -17,6 +17,14 @@ BrowserWindow::toggleDevTools = ->
|
|||
BrowserWindow::restart = ->
|
||||
@loadUrl(@getUrl())
|
||||
|
||||
BrowserWindow::setMenu = (menu) ->
|
||||
throw new Error('BrowserWindow.setMenu is only available on Windows') unless process.platform is 'win32'
|
||||
|
||||
throw new TypeError('Invalid menu') unless menu?.constructor?.name is 'Menu'
|
||||
|
||||
@menu = menu # Keep a reference of menu in case of GC.
|
||||
@menu.attachToWindow this
|
||||
|
||||
BrowserWindow.getFocusedWindow = ->
|
||||
windows = objectsRegistry.getAllWindows()
|
||||
return window for window in windows when window.isFocused()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue