Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DockLayout

A layout which provides a flexible docking arrangement. The namespace for the DockLayout class statics.

Notes

The consumer of this layout is responsible for handling all signals from the generated tab bars and managing the visibility of widgets and tab bars as needed.

Hierarchy

Implements

  • IIterable<Widget>
  • IDisposable

Index

Type aliases

Static AreaConfig

A type alias for a general area config.

Static FitPolicy

FitPolicy: "set-no-constraint" | "set-min-size"

A type alias for the layout fit policy.

Notes

The fit policy controls the computed size constraints which are applied to the parent widget by the layout.

Some layout implementations may ignore the fit policy.

Static HorizontalAlignment

HorizontalAlignment: "left" | "center" | "right"

A type alias for the horizontal alignment of a widget.

Static InsertMode

InsertMode: "split-top" | "split-left" | "split-right" | "split-bottom" | "tab-before" | "tab-after"

A type alias for the supported insertion modes.

An insert mode is used to specify how a widget should be added to the dock layout relative to a reference widget.

Static VerticalAlignment

VerticalAlignment: "top" | "center" | "bottom"

A type alias for the vertical alignment of a widget.

Constructors

constructor

Properties

Private _box

_box: IBoxSizing | null = null

Private _dirty

_dirty: boolean = false

Private _document

_document: Document | ShadowRoot

Private _hiddenMode

_hiddenMode: HiddenMode

Private _items

_items: Private.ItemMap = new Map<Widget, LayoutItem>()

Private _root

_root: Private.LayoutNode | null = null

Private _spacing

_spacing: number = 4

renderer

renderer: IRenderer

The renderer used by the dock layout.

Accessors

fitPolicy

  • Get the fit policy for the layout.

    Notes

    The fit policy controls the computed size constraints which are applied to the parent widget by the layout.

    Some layout implementations may ignore the fit policy.

    Returns FitPolicy

  • Set the fit policy for the layout.

    Notes

    The fit policy controls the computed size constraints which are applied to the parent widget by the layout.

    Some layout implementations may ignore the fit policy.

    Changing the fit policy will clear the current size constraint for the parent widget and then re-fit the parent.

    Parameters

    Returns void

hiddenMode

isDisposed

  • get isDisposed(): boolean

isEmpty

  • get isEmpty(): boolean

parent

  • get parent(): Widget | null
  • set parent(value: Widget | null): void
  • Get the parent widget of the layout.

    Notes

    This is set automatically when installing the layout on the parent widget. The parent widget should not be set directly by user code.

    Returns Widget | null

  • Set the parent widget of the layout.

    Notes

    This is set automatically when installing the layout on the parent widget. The parent widget should not be set directly by user code.

    Parameters

    Returns void

spacing

  • get spacing(): number
  • set spacing(value: number): void

Methods

Private _createHandle

  • _createHandle(): HTMLDivElement

Private _createTabBar

Private _fit

  • _fit(): void

Private _insertSplit

  • _insertSplit(widget: Widget, ref: Widget | null, refNode: TabLayoutNode | null, orientation: Private.Orientation, after: boolean): void
  • Insert a widget as a new split area.

    Notes

    This does not attach the widget to the parent widget.

    Parameters

    • widget: Widget
    • ref: Widget | null
    • refNode: TabLayoutNode | null
    • orientation: Private.Orientation
    • after: boolean

    Returns void

Private _insertTab

  • _insertTab(widget: Widget, ref: Widget | null, refNode: TabLayoutNode | null, after: boolean): void
  • Insert a widget next to an existing tab.

    Notes

    This does not attach the widget to the parent widget.

    Parameters

    • widget: Widget
    • ref: Widget | null
    • refNode: TabLayoutNode | null
    • after: boolean

    Returns void

Private _removeWidget

  • _removeWidget(widget: Widget): void
  • Remove the specified widget from the layout structure.

    Notes

    This is a no-op if the widget is not in the layout tree.

    This does not detach the widget from the parent node.

    Parameters

    Returns void

Private _splitRoot

  • _splitRoot(orientation: Private.Orientation): SplitLayoutNode
  • Ensure the root is a split node with the given orientation.

    Parameters

    • orientation: Private.Orientation

    Returns SplitLayoutNode

Private _update

  • _update(offsetWidth: number, offsetHeight: number): void
  • Update the layout position and size of the widgets.

    The parent offset dimensions should be -1 if unknown.

    Parameters

    • offsetWidth: number
    • offsetHeight: number

    Returns void

addWidget

  • Add a widget to the dock layout.

    Parameters

    • widget: Widget

      The widget to add to the dock layout.

    • Default value options: IAddOptions = {}

      The additional options for adding the widget.

      Notes

      The widget will be moved if it is already contained in the layout.

      An error will be thrown if the reference widget is invalid.

    Returns void

Protected attachWidget

  • attachWidget(widget: Widget): void
  • Attach the widget to the layout parent widget.

    Parameters

    • widget: Widget

      The widget to attach to the parent.

      Notes

      This is a no-op if the widget is already attached.

    Returns void

Protected detachWidget

  • detachWidget(widget: Widget): void
  • Detach the widget from the layout parent widget.

    Parameters

    • widget: Widget

      The widget to detach from the parent.

      Notes

      This is a no-op if the widget is not attached.

    Returns void

dispose

  • dispose(): void

handles

  • handles(): IIterator<HTMLDivElement>
  • Create an iterator over the handles in the layout.

    Returns IIterator<HTMLDivElement>

    A new iterator over the handles in the layout.

hitTestTabAreas

  • Find the tab area which contains the given client position.

    Parameters

    • clientX: number

      The client X position of interest.

    • clientY: number

      The client Y position of interest.

    Returns ITabAreaGeometry | null

    The geometry of the tab area at the given position, or null if there is no tab area at the given position.

Protected init

  • init(): void

iter

moveHandle

  • moveHandle(handle: HTMLDivElement, offsetX: number, offsetY: number): void
  • Move a handle to the given offset position.

    Parameters

    • handle: HTMLDivElement

      The handle to move.

    • offsetX: number

      The desired offset X position of the handle.

    • offsetY: number

      The desired offset Y position of the handle.

      Notes

      If the given handle is not contained in the layout, this is no-op.

      The handle will be moved as close as possible to the desired position without violating any of the layout constraints.

      Only one of the coordinates is used depending on the orientation of the handle. This method accepts both coordinates to make it easy to invoke from a mouse move event without needing to know the handle orientation.

    Returns void

Protected onAfterAttach

  • onAfterAttach(msg: Message): void
  • A message handler invoked on an 'after-attach' message.

    Notes

    The default implementation of this method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

Protected onAfterDetach

  • onAfterDetach(msg: Message): void
  • A message handler invoked on an 'after-detach' message.

    Notes

    The default implementation of this method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

Protected onAfterHide

  • onAfterHide(msg: Message): void
  • A message handler invoked on an 'after-hide' message.

    Notes

    The default implementation of this method forwards the message to all non-hidden widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

Protected onAfterShow

  • onAfterShow(msg: Message): void
  • A message handler invoked on an 'after-show' message.

    Notes

    The default implementation of this method forwards the message to all non-hidden widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeAttach

  • onBeforeAttach(msg: Message): void

Protected onBeforeDetach

  • onBeforeDetach(msg: Message): void
  • A message handler invoked on a 'before-detach' message.

    Notes

    The default implementation of this method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeHide

  • onBeforeHide(msg: Message): void
  • A message handler invoked on a 'before-hide' message.

    Notes

    The default implementation of this method forwards the message to all non-hidden widgets. It assumes all widget nodes are attached to the parent widget node.

    This may be reimplemented by subclasses as needed.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeShow

  • onBeforeShow(msg: Message): void

Protected onChildHidden

Protected onChildRemoved

Protected onChildShown

Protected onFitRequest

  • onFitRequest(msg: Message): void

Protected onResize

Protected onUpdateRequest

  • onUpdateRequest(msg: Message): void

processParentMessage

  • processParentMessage(msg: Message): void
  • Process a message sent to the parent widget.

    Parameters

    • msg: Message

      The message sent to the parent widget.

      Notes

      This method is called by the parent widget to process a message.

      Subclasses may reimplement this method as needed.

    Returns void

removeWidget

  • removeWidget(widget: Widget): void
  • Remove a widget from the layout.

    Parameters

    • widget: Widget

      The widget to remove from the layout.

      Notes

      A widget is automatically removed from the layout when its parent is set to null. This method should only be invoked directly when removing a widget from a layout which has yet to be installed on a parent widget.

      This method does not modify the widget's parent.

    Returns void

restoreLayout

  • Restore the layout to a previously saved configuration.

    Parameters

    • config: ILayoutConfig

      The layout configuration to restore.

      Notes

      Widgets which currently belong to the layout but which are not contained in the config will be unparented.

    Returns void

saveLayout

  • Save the current configuration of the dock layout.

    Returns ILayoutConfig

    A new config object for the current layout state.

    Notes

    The return value can be provided to the restoreLayout method in order to restore the layout to its current configuration.

selectedWidgets

  • selectedWidgets(): IIterator<Widget>
  • Create an iterator over the selected widgets in the layout.

    Returns IIterator<Widget>

    A new iterator over the selected user widgets.

    Notes

    This iterator yields the widgets corresponding to the current tab of each tab bar in the layout.

tabBars

widgets

  • widgets(): IIterator<Widget>
  • Create an iterator over the user widgets in the layout.

    Returns IIterator<Widget>

    A new iterator over the user widgets in the layout.

    Notes

    This iterator does not include the generated tab bars.

Static getHorizontalAlignment

  • Get the horizontal alignment for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    Returns HorizontalAlignment

    The horizontal alignment for the widget.

    Notes

    If the layout width allocated to a widget is larger than its max width, the horizontal alignment controls how the widget is placed within the extra horizontal space.

    If the allocated width is less than the widget's max width, the horizontal alignment has no effect.

    Some layout implementations may ignore horizontal alignment.

Static getVerticalAlignment

  • Get the vertical alignment for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    Returns VerticalAlignment

    The vertical alignment for the widget.

    Notes

    If the layout height allocated to a widget is larger than its max height, the vertical alignment controls how the widget is placed within the extra vertical space.

    If the allocated height is less than the widget's max height, the vertical alignment has no effect.

    Some layout implementations may ignore vertical alignment.

Static setHorizontalAlignment

  • Set the horizontal alignment for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    • value: HorizontalAlignment

      The value for the horizontal alignment.

      Notes

      If the layout width allocated to a widget is larger than its max width, the horizontal alignment controls how the widget is placed within the extra horizontal space.

      If the allocated width is less than the widget's max width, the horizontal alignment has no effect.

      Some layout implementations may ignore horizontal alignment.

      Changing the horizontal alignment will post an update-request message to widget's parent, provided the parent has a layout installed.

    Returns void

Static setVerticalAlignment

  • Set the vertical alignment for a widget.

    Parameters

    • widget: Widget

      The widget of interest.

    • value: VerticalAlignment

      The value for the vertical alignment.

      Notes

      If the layout height allocated to a widget is larger than its max height, the vertical alignment controls how the widget is placed within the extra vertical space.

      If the allocated height is less than the widget's max height, the vertical alignment has no effect.

      Some layout implementations may ignore vertical alignment.

      Changing the horizontal alignment will post an update-request message to widget's parent, provided the parent has a layout installed.

    Returns void

Generated using TypeDoc