Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WidgetSwitcher

A widget that contains other widgets and switches between them. Only one child widget is active and visible at a time.

Hierarchy

Index

Methods

addChild

getActiveIndex

  • getActiveIndex(): number
    • Return the currently active widget index. Returns -1 if there are no child widgets.

    Returns number

getActiveWidget

  • getActiveWidget(): Widget | undefined

getAllChildren

getChildAt

  • getChildAt(index: number): Widget | undefined
  • Return the child widget at the given index. Returns undefined if no child exists at the index.

    Parameters

    • index: number

      Index where to get the child widget

    Returns Widget | undefined

getNumChildren

  • getNumChildren(): number
  • Return the number of child widgets

    Returns number

getOwningObject

getParent

  • getParent(): Widget | undefined
  • Return the widget that contains this widget, for example a border that wraps a check box. Returns undefined if this object has no parent.

    Returns Widget | undefined

insertChild

  • Insert a child widget at the given index. Inserts at the end if the index is not valid.

    Parameters

    • child: Widget

      The widget to insert

    • index: number

      Index at which to insert the new child

    Returns WidgetSwitcher

isEnabled

  • isEnabled(): boolean

isVisible

  • isVisible(): boolean

removeAllChildren

  • removeAllChildren(): void

removeChild

  • removeChild(child: Widget): void
  • Remove the given child widget

    Parameters

    • child: Widget

      The widget to remove

    Returns void

removeChildAt

  • removeChildAt(index: number): void
  • Remove the child widget at the given index

    Parameters

    • index: number

      Index where to remove the child widget

    Returns void

setActiveIndex

  • setActiveIndex(index: number): Widget
    • Set the currently active widget index

    Parameters

    • index: number

    Returns Widget

setActiveWidget

setEnabled

  • setEnabled(enabled: boolean): this
  • Set whether the widget is enabled. When a widget is disabled, users can't interact with it and it is greyed out. When a widget that contains other widgets (like VerticalBox) is disabled, all its children behave as if disabled, too. By default, widgets are enabled.

    Parameters

    • enabled: boolean

      Whether to enable the widget.

    Returns this

setVisible

  • setVisible(visible: boolean): Widget
  • Set whether the widget is visible. When a widget that contains other widgets (like VerticalBox) is invisible, all its children are invisible, too. The layout of widgets is updated when visibility changes, and invisible widgets are treated as if they don't exist.

    Parameters

    • visible: boolean

      Whether the widget is visible.

    Returns Widget