LensStudio:Ui.DockState
EnumEnum representing dock widget state.
Index
Example
// DockState is the enum that controls how a PanelPlugin docks when first
// opened — Attached (docked inside the main window) or Detached (floating).
// Set it on PanelDescriptor.defaultDockState when registering a panel plugin.
export class DockStateExamplePanel extends PanelPlugin {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.DockStateExample';
d.name = 'DockState Example';
d.description = 'Opens as a floating (Detached) panel';
// Force the panel to open as a floating window the first time it is
// shown. Switch to DockState.Attached to have it dock into the main
// layout instead.
d.defaultDockState = DockState.Detached;
d.defaultSize = new Size(320, 180);
d.menuActionHierarchy = ['Window', 'Examples', 'DockState Example'];
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
createWidget(parent: Widget): Widget {
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
layout.spacing = 6;
root.layout = layout;
const title = new Label(root);
title.text = 'DockState.Detached';
title.fontRole = FontRole.TitleBold;
layout.addWidget(title);
const info = new Label(root);
info.text =
'This panel was registered with PanelDescriptor.defaultDockState = ' +
'DockState.Detached, so it opens as a floating window. DockState has ' +
'two values: Attached (docked into the main window) and Detached ' +
'(floating).';
info.wordWrap = true;
layout.addWidget(info);
return root;
}
deinit(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
}
}
Enumeration Members
Attached
Attached:
number
Dock state when the UI element is attached.
Detached
Detached:
number
Dock state when the UI element is detached.