Skip to content

Commit

Permalink
Modify to example to show/hide add button
Browse files Browse the repository at this point in the history
  • Loading branch information
nmichaud committed Aug 18, 2020
1 parent 9c662cb commit da0840b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/example-dockpanel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Widget>) => {
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',
Expand Down

0 comments on commit da0840b

Please sign in to comment.