From da0840bb53d6808f112cd8d7053926f6328e4fc4 Mon Sep 17 00:00:00 2001 From: Naveen Michaud-Agrawal Date: Mon, 17 Aug 2020 23:43:57 -0400 Subject: [PATCH] Modify to example to show/hide add button --- examples/example-dockpanel/src/index.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/examples/example-dockpanel/src/index.ts b/examples/example-dockpanel/src/index.ts index 53cdb28dc..6543364fd 100644 --- a/examples/example-dockpanel/src/index.ts +++ b/examples/example-dockpanel/src/index.ts @@ -355,8 +355,25 @@ function main(): void { dock.addWidget(b2, { mode: 'split-right', ref: y1 }); dock.id = 'dock'; + dock.widgetAddRequested.connect((sender: DockPanel, args: DockPanel.IWidgetAddRequestedArgs) => { + let w = new ContentWidget("Green"); + sender.addWidget(w, { ref: args.tabBar.titles[0].owner }); + }); + let savedLayouts: DockPanel.ILayoutConfig[] = []; + commands.addCommand('example:add-button', { + label: 'Toggle add button', + mnemonic: 0, + caption: 'Toggle add Button', + execute: () => { + dock.addButtonEnabled = !dock.addButtonEnabled; + console.log('Toggle add button'); + } + }); + contextMenu.addItem({ command: 'example:add-button', selector: '.content' }); + + commands.addCommand('save-dock-layout', { label: 'Save Layout', caption: 'Save the current dock layout',