win: Setting enabled/visiable should also update menu.
This commit is contained in:
parent
dfa1ae1c20
commit
d38ffea4a3
2 changed files with 32 additions and 21 deletions
|
@ -64,18 +64,7 @@ Menu::insert = (pos, item) ->
|
|||
|
||||
switch item.type
|
||||
when 'normal' then @insertItem pos, item.commandId, item.label
|
||||
when 'checkbox'
|
||||
# Update states when clicked on Windows.
|
||||
if process.platform is 'win32'
|
||||
v8Util.setHiddenValue item, 'checked', item.checked
|
||||
Object.defineProperty item, 'checked',
|
||||
enumerable: true
|
||||
get: -> v8Util.getHiddenValue item, 'checked'
|
||||
set: (val) =>
|
||||
v8Util.setHiddenValue item, 'checked', val
|
||||
@_updateStates() if process.platform is 'win32'
|
||||
|
||||
@insertCheckItem pos, item.commandId, item.label
|
||||
when 'checkbox' then @insertCheckItem pos, item.commandId, item.label
|
||||
when 'separator' then @insertSeparator pos
|
||||
when 'submenu' then @insertSubMenu pos, item.commandId, item.label, item.submenu
|
||||
when 'radio'
|
||||
|
@ -85,7 +74,6 @@ Menu::insert = (pos, item) ->
|
|||
@groupsMap[item.groupId].push item
|
||||
|
||||
# Setting a radio menu item should flip other items in the group.
|
||||
v8Util.setHiddenValue item, 'checked', item.checked
|
||||
Object.defineProperty item, 'checked',
|
||||
enumerable: true
|
||||
get: -> v8Util.getHiddenValue item, 'checked'
|
||||
|
@ -101,6 +89,9 @@ Menu::insert = (pos, item) ->
|
|||
|
||||
@setSublabel pos, item.sublabel if item.sublabel?
|
||||
|
||||
# Make menu accessable to items.
|
||||
item.menu = this
|
||||
|
||||
# Remember the items.
|
||||
@items.splice pos, 0, item
|
||||
@commandsMap[item.commandId] = item
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue