Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GridLayout

A layout which arranges its widgets in a grid. The namespace for the GridLayout class statics.

Hierarchy

Implements

  • IIterable<Widget>
  • IDisposable

Index

Constructors

constructor

Properties

Private _box

_box: IBoxSizing | null = null

Private _columnSizers

_columnSizers: BoxSizer[] = [new BoxSizer()]

Private _columnSpacing

_columnSpacing: number = 4

Private _columnStarts

_columnStarts: number[] = []

Private _dirty

_dirty: boolean = false

Private _items

_items: LayoutItem[] = []

Private _rowSizers

_rowSizers: BoxSizer[] = [new BoxSizer()]

Private _rowSpacing

_rowSpacing: number = 4

Private _rowStarts

_rowStarts: number[] = []

Accessors

columnCount

  • get columnCount(): number
  • set columnCount(value: number): void
  • Get the number of columns in the layout.

    Notes

    The minimum column count is 1.

    Returns number

  • Set the number of columns in the layout.

    Notes

    The minimum column count is 1.

    Parameters

    • value: number

    Returns void

columnSpacing

  • get columnSpacing(): number
  • set columnSpacing(value: number): void
  • Get the column spacing for the layout.

    Returns number

  • Set the col spacing for the layout.

    Parameters

    • value: number

    Returns void

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

isDisposed

  • get isDisposed(): 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

rowCount

  • get rowCount(): number
  • set rowCount(value: number): void
  • Get the number of rows in the layout.

    Notes

    The minimum row count is 1.

    Returns number

  • Set the number of rows in the layout.

    Notes

    The minimum row count is 1.

    Parameters

    • value: number

    Returns void

rowSpacing

  • get rowSpacing(): number
  • set rowSpacing(value: number): void
  • Get the row spacing for the layout.

    Returns number

  • Set the row spacing for the layout.

    Parameters

    • value: number

    Returns void

Methods

Private _fit

  • _fit(): void
  • Fit the layout to the total size required by the widgets.

    Returns void

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

  • addWidget(widget: Widget): void
  • Add a widget to the grid layout.

    Parameters

    • widget: Widget

      The widget to add to the layout.

      Notes

      If the widget is already contained in the layout, this is no-op.

    Returns void

Protected attachWidget

  • attachWidget(widget: Widget): void
  • Attach a widget to the parent's DOM node.

    Parameters

    • widget: Widget

      The widget to attach to the parent.

    Returns void

columnStretch

  • columnStretch(index: number): number
  • Get the stretch factor for a specific column.

    Parameters

    • index: number

      The column index of interest.

    Returns number

    The stretch factor for the column.

    Notes

    This returns -1 if the index is out of range.

Protected detachWidget

  • detachWidget(widget: Widget): void
  • Detach a widget from the parent's DOM node.

    Parameters

    • widget: Widget

      The widget to detach from the parent.

    Returns void

dispose

  • dispose(): void

Protected init

  • init(): void

iter

  • Create an iterator over the widgets in the layout.

    Returns IIterator<Widget>

    A new iterator over the widgets in the layout.

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

  • A message handler invoked on a 'child-removed' message.

    Notes

    This will remove the child widget from the layout.

    Subclasses should not typically reimplement this method.

    Parameters

    Returns void

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 grid 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

rowStretch

  • rowStretch(index: number): number
  • Get the stretch factor for a specific row.

    Parameters

    • index: number

      The row index of interest.

    Returns number

    The stretch factor for the row.

    Notes

    This returns -1 if the index is out of range.

setColumnStretch

  • setColumnStretch(index: number, value: number): void
  • Set the stretch factor for a specific column.

    Parameters

    • index: number

      The column index of interest.

    • value: number

      The stretch factor for the column.

      Notes

      This is a no-op if the index is out of range.

    Returns void

setRowStretch

  • setRowStretch(index: number, value: number): void
  • Set the stretch factor for a specific row.

    Parameters

    • index: number

      The row index of interest.

    • value: number

      The stretch factor for the row.

      Notes

      This is a no-op if the index is out of range.

    Returns void

Static getCellConfig

  • Get the cell config for the given widget.

    Parameters

    • widget: Widget

      The widget of interest.

    Returns ICellConfig

    The cell config for the widget.

Static setCellConfig

  • Set the cell config for the given widget.

    Parameters

    • widget: Widget

      The widget of interest.

    • value: Partial<ICellConfig>

      The value for the cell config.

    Returns void

Generated using TypeDoc