LensStudio:Ui.Section
EnumCollapsible section widget for grouping content.
Index
Example
export class SectionPanel extends PanelPlugin {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.UiSectionExample';
d.name = 'Section Example';
d.defaultDockState = DockState.Detached;
d.defaultSize = new Size(400, 250);
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 = 8;
root.layout = layout;
const title = new Label(root);
title.text = 'Section Enum Demo';
title.fontRole = FontRole.TitleBold;
layout.addWidget(title);
const info = new Label(root);
info.text = 'Section enum: Left, Center, Right. Used by OverflowToolBar.addWidget().';
info.wordWrap = true;
layout.addWidget(info);
// Section is an enum (Left, Center, Right) used to position
// widgets within an OverflowToolBar
const toolbar = new OverflowToolBar(root);
layout.addWidget(toolbar);
const leftBtn = new PushButton(root);
leftBtn.text = 'Left';
toolbar.addWidget(leftBtn, Section.Left);
const centerBtn = new PushButton(root);
centerBtn.text = 'Center';
toolbar.addWidget(centerBtn, Section.Center);
const rightBtn = new PushButton(root);
rightBtn.text = 'Right';
toolbar.addWidget(rightBtn, Section.Right);
return root;
}
deinit(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
}
}
Enumeration Members
Center
Center:
number
Center section of the layout area.
Left
Left:
number
Left section of the layout area.
Right
Right:
number
Right section of the layout area.