pub struct Layer {
pub components: Vec<Box<dyn Component>>,
pub layout: Option<Layout>,
pub shadow: Shadow,
pub visible: bool,
pub kind: LayerKind,
}Expand description
A full-terminal-size surface that holds its own components and layout.
Layers stack from index 0 (bottom/floor) to N (top/front). The TUI
renders each layer independently and then composites them front-to-back,
stripping cells that are hidden by higher layers.
Fields§
§components: Vec<Box<dyn Component>>Components owned by this layer.
layout: Option<Layout>Optional layout for splitting the layer among its components.
shadow: ShadowVisual effect applied to lower layers behind this layer.
visible: boolWhether this layer participates in rendering.
kind: LayerKindTUI classification of this layer.
Implementations§
Source§impl Layer
impl Layer
Sourcepub fn with_component(component: Box<dyn Component>) -> Self
pub fn with_component(component: Box<dyn Component>) -> Self
Create a layer that already contains a single component.
Sourcepub fn set_layout(&mut self, layout: Layout)
pub fn set_layout(&mut self, layout: Layout)
Assign a layout to this layer.
Sourcepub fn render(
&self,
width: u16,
height: u16,
focused_index: Option<usize>,
) -> Rendered
pub fn render( &self, width: u16, height: u16, focused_index: Option<usize>, ) -> Rendered
Render this layer to a full-terminal-size buffer.
The returned Rendered has exactly height lines. focused_index
identifies which of this layer’s components currently has focus so that
its cursor can be translated into screen coordinates.