Skip to content

Stack

[Source]

A container that holds multiple named children but only renders the active one. Used for tabbed interfaces where switching between views should preserve child state.

actor tag Stack is
  CompositeWidget tag

Implements


Constructors

create

[Source]

new tag create(
  p: WidgetParent tag)
: Stack tag^

Parameters

Returns


Public Behaviours

set_input_actor

[Source]

Store a reference to the InputActor for focus scope gating.

be set_input_actor(
  input: InputActor tag)

Parameters


add_child

[Source]

Register a child by name. The first child added becomes active. If the Stack already has dimensions, the child is resized immediately. Non-active children have their scope disabled if input_actor is set.

be add_child(
  name: String val,
  widget: Widget tag)

Parameters


show

[Source]

Switch the active child. No-op if the name doesn't exist or is already active.

be show(
  name: String val)

Parameters


receive_grid

[Source]

Store all children's grids, but only trigger a deferred render if the grid came from the active child.

be receive_grid(
  widget: Any tag,
  grid: Grid val)

Parameters


resize

[Source]

Resize ALL children to full container size, not just the active one.

be resize(
  w: USize val,
  h: USize val)

Parameters


trigger_render

[Source]

be trigger_render()

receive_key

[Source]

be receive_key(
  key: KeyEvent val)

Parameters


receive_focus

[Source]

be receive_focus()

receive_blur

[Source]

be receive_blur()

set_debug_bg

[Source]

be set_debug_bg(
  color: (Default val | Black val | Red val | 
    Green val | Yellow val | Blue val | 
    Magenta val | Cyan val | White val | 
    BrightBlack val | BrightRed val | BrightGreen val | 
    BrightYellow val | BrightBlue val | BrightMagenta val | 
    BrightCyan val | BrightWhite val | Rainbow val))

Parameters


Public Functions

state

[Source]

fun ref state()
: WidgetState ref

Returns


render

[Source]

Return the active child's grid directly. If no active child, return the background.

fun ref render()
: Grid val

Returns


render_background

[Source]

fun ref render_background()
: Grid val

Returns


register_child

[Source]

fun ref register_child(
  widget: Widget tag)
: None val

Parameters

Returns


render_and_send

[Source]

fun ref render_and_send()
: None val

Returns