// 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.
exportclassDockStateExamplePanelextendsPanelPlugin { connections: any[]; staticdescriptor() { constd = newDescriptor(); 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 = newSize(320, 180); d.menuActionHierarchy = ['Window', 'Examples', 'DockState Example']; returnd; } constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) { super(pluginSystem, descriptor); this.connections = []; } createWidget(parent: Widget): Widget { constroot = newWidget(parent); constlayout = newBoxLayout(); layout.setDirection(Direction.TopToBottom); layout.spacing = 6; root.layout = layout;
constinfo = newLabel(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);
Enum representing dock widget state.
Example