@jimka/typescript-ui / layout / VBox
Class: VBox
Defined in: src/typescript/lib/layout/VBox.ts:24
A layout manager that places children in a single vertical column, using each child's preferred height and an optional width-stretching mode.
Extends
Constructors
new VBox()
new VBox(spacing: number | VBoxOptions, options?: VBoxOptions): VBoxDefined in: src/typescript/lib/layout/VBox.ts:30
Parameters
spacing
number | VBoxOptions
options?
Returns
Overrides
Methods
attach()
attach(container: Component): thisDefined in: src/typescript/lib/layout/LayoutManager.ts:58
Associates this layout manager with a container component.
Parameters
container
The container component to attach to.
Returns
this
Inherited from
delLayoutConstraints()
delLayoutConstraints(component: Component): undefined | LayoutConstraintsDefined in: src/typescript/lib/layout/LayoutManager.ts:276
Removes and returns the stored layout constraints for a component.
Parameters
component
The component whose constraints should be removed.
Returns
undefined | LayoutConstraints
The removed constraints, or undefined if none were stored.
Inherited from
LayoutManager.delLayoutConstraints
detach()
detach(): thisDefined in: src/typescript/lib/layout/LayoutManager.ts:67
Dissociates this layout manager from its container.
Returns
this
Inherited from
doLayout()
doLayout(): voidDefined in: src/typescript/lib/layout/VBox.ts:218
Places children top-to-bottom using their preferred heights, with optional width stretching.
Returns
void
Remarks
When stretching is enabled, each child's width is clamped to its max size rather than its preferred size. Children without a preferred size fall back to defaultComponentHeight. Children with a weight layout constraint share the remaining height (after unweighted children have taken their preferred heights) proportionally to their weight values.
Overrides
getClassName()
getClassName(): stringDefined in: src/typescript/lib/core/BaseObject.ts:44
Returns the runtime class name of this object.
Returns
string
The name of the constructor function as a string.
Inherited from
getComponentSpacing()
getComponentSpacing(): numberDefined in: src/typescript/lib/layout/VBox.ts:67
Returns the pixel spacing between child components.
Returns
number
The current spacing in pixels.
getContainer()
getContainer(): null | ComponentDefined in: src/typescript/lib/layout/LayoutManager.ts:78
Returns the container component this layout manager is attached to.
Returns
null | Component
The attached container, or null if not attached.
Inherited from
getId()
getId(): stringDefined in: src/typescript/lib/core/BaseObject.ts:24
Returns the unique identifier for this object.
Returns
string
The UUID string assigned at construction time.
Inherited from
getLayoutConstraints()
getLayoutConstraints(component: Component): undefined | LayoutConstraintsDefined in: src/typescript/lib/layout/LayoutManager.ts:291
Returns the stored layout constraints for a component.
Parameters
component
The component to look up.
Returns
undefined | LayoutConstraints
The stored constraints, or undefined if none are set.
Inherited from
LayoutManager.getLayoutConstraints
getMaxSize()
getMaxSize(): null | SizeDefined in: src/typescript/lib/layout/VBox.ts:179
Returns the maximum size: the narrowest child maximum width and the sum of child maximum heights plus spacing.
Returns
null | Size
The maximum {width, height}, or null if no container is attached.
Overrides
getMinSize()
getMinSize(): null | SizeDefined in: src/typescript/lib/layout/VBox.ts:143
Returns the minimum size: the widest child minimum width and the sum of child minimum heights plus spacing.
Returns
null | Size
The minimum {width, height}, or null if no container is attached.
Overrides
getPreferredSize()
getPreferredSize(): null | SizeDefined in: src/typescript/lib/layout/VBox.ts:107
Returns the preferred size: the widest child width and the sum of child heights plus spacing.
Returns
null | Size
The preferred {width, height}, or null if no container is attached.
Overrides
LayoutManager.getPreferredSize
isStretching()
isStretching(): booleanDefined in: src/typescript/lib/layout/VBox.ts:87
Returns whether children stretch to fill the container width.
Returns
boolean
true if stretching is enabled.
placeComponent()
placeComponent(
component: Component,
x: number,
y: number,
maxWidth: number,
maxHeight: number,
fill?: null | FillType,
anchor?: null | AnchorType): voidDefined in: src/typescript/lib/layout/LayoutManager.ts:126
Positions and sizes a child component within the given bounds, respecting fill and anchor constraints.
Parameters
component
The child component to position.
x
number
Left edge of the cell in the container's coordinate space.
y
number
Top edge of the cell in the container's coordinate space.
maxWidth
number
Available width for the component.
maxHeight
number
Available height for the component.
fill?
Optional. Fill strategy overriding the component's own constraints.
null | FillType
anchor?
Optional. Anchor point overriding the component's own constraints.
null | AnchorType
Returns
void
Remarks
The method checks the component's stored LayoutConstraints first; the fill and anchor parameters serve as fallbacks. After positioning, doLayout is called on the child so nested layouts are updated in a single pass.
Inherited from
setComponentSpacing()
setComponentSpacing(spacing: number): thisDefined in: src/typescript/lib/layout/VBox.ts:76
Sets the pixel spacing between child components.
Parameters
spacing
number
Spacing in pixels.
Returns
this
setId()
setId(id: string): thisDefined in: src/typescript/lib/core/BaseObject.ts:33
Sets the unique identifier for this object.
Parameters
id
string
The new identifier string to assign.
Returns
this
Inherited from
setLayoutConstraints()
setLayoutConstraints(component: Component, constraints?: LayoutConstraints): undefined | LayoutConstraintsDefined in: src/typescript/lib/layout/LayoutManager.ts:260
Stores layout constraints for a component, or removes them if constraints is undefined.
Parameters
component
The component whose constraints are being set.
constraints?
Optional. The constraints to store; omit to delete existing constraints.
Returns
undefined | LayoutConstraints
The stored constraints, or undefined if they were deleted.
Inherited from
LayoutManager.setLayoutConstraints
setStretching()
setStretching(stretching: boolean): thisDefined in: src/typescript/lib/layout/VBox.ts:96
Sets whether children stretch to fill the container width.
Parameters
stretching
boolean
Pass true to enable width stretching.
Returns
this