pub struct LayoutTree { /* private fields */ }Expand description
Arena-based mutable layout tree.
Implementations§
Source§impl LayoutTree
impl LayoutTree
Sourcepub fn add_panel(
&mut self,
kind: impl Into<Arc<str>>,
constraints: Constraints,
) -> Result<(PanelId, NodeId), PaneError>
pub fn add_panel( &mut self, kind: impl Into<Arc<str>>, constraints: Constraints, ) -> Result<(PanelId, NodeId), PaneError>
Add a panel node. Returns the generated PanelId and the arena NodeId.
Sourcepub fn add_row(
&mut self,
gap: f32,
children: Vec<NodeId>,
) -> Result<NodeId, PaneError>
pub fn add_row( &mut self, gap: f32, children: Vec<NodeId>, ) -> Result<NodeId, PaneError>
Add a row container with the given gap and children.
Sourcepub fn add_col(
&mut self,
gap: f32,
children: Vec<NodeId>,
) -> Result<NodeId, PaneError>
pub fn add_col( &mut self, gap: f32, children: Vec<NodeId>, ) -> Result<NodeId, PaneError>
Add a column container with the given gap and children.
Sourcepub fn add_taffy_node(
&mut self,
style: Style,
children: Vec<NodeId>,
) -> Result<NodeId, PaneError>
pub fn add_taffy_node( &mut self, style: Style, children: Vec<NodeId>, ) -> Result<NodeId, PaneError>
Add a raw Taffy passthrough node.
Sourcepub fn clear_dirty(&mut self)
pub fn clear_dirty(&mut self)
Clear the dirty flag after a successful compile.
Sourcepub fn panel_id_high_water(&self) -> u32
pub fn panel_id_high_water(&self) -> u32
One past the highest issued PanelId. Used to size Vec-indexed storage.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Total number of live nodes in the arena.
Sourcepub fn panel_count(&self) -> usize
pub fn panel_count(&self) -> usize
Total number of panel nodes in the tree.
Sourcepub fn window_size(&self) -> usize
pub fn window_size(&self) -> usize
How many panels the active window shows at once. Default is 1. Scrollable sets this to 2.
Sourcepub fn set_window_size(&mut self, size: usize)
pub fn set_window_size(&mut self, size: usize)
Set the active window size.
Sourcepub fn kind_count(&self) -> usize
pub fn kind_count(&self) -> usize
Total number of distinct panel kinds.
Sourcepub fn panels_by_kind(&self, kind: &str) -> &[PanelId]
pub fn panels_by_kind(&self, kind: &str) -> &[PanelId]
All PanelIds with the given kind.
Sourcepub fn set_constraints(
&mut self,
pid: PanelId,
constraints: Constraints,
) -> Result<(), PaneError>
pub fn set_constraints( &mut self, pid: PanelId, constraints: Constraints, ) -> Result<(), PaneError>
Update a panel’s constraints.
Sourcepub fn panel_constraints(&self, pid: PanelId) -> Result<Constraints, PaneError>
pub fn panel_constraints(&self, pid: PanelId) -> Result<Constraints, PaneError>
Get a panel’s current constraints.
Sourcepub fn children(&self, id: NodeId) -> Result<&[NodeId], PaneError>
pub fn children(&self, id: NodeId) -> Result<&[NodeId], PaneError>
Get the children of a node. Returns an empty slice for leaf nodes.
Sourcepub fn parent(&self, id: NodeId) -> Result<Option<NodeId>, PaneError>
pub fn parent(&self, id: NodeId) -> Result<Option<NodeId>, PaneError>
Get the parent of a node. Returns None for root nodes.
Sourcepub fn node_for_panel(&self, pid: PanelId) -> Option<NodeId>
pub fn node_for_panel(&self, pid: PanelId) -> Option<NodeId>
Resolve a PanelId to its arena NodeId, if present.
Sourcepub fn insert_child_at(
&mut self,
container: NodeId,
idx: usize,
child: NodeId,
) -> Result<(), PaneError>
pub fn insert_child_at( &mut self, container: NodeId, idx: usize, child: NodeId, ) -> Result<(), PaneError>
Insert a child into a container at the given index, updating parent_map.
Sourcepub fn remove_panel(&mut self, pid: PanelId) -> Result<(), PaneError>
pub fn remove_panel(&mut self, pid: PanelId) -> Result<(), PaneError>
Remove a panel from the tree entirely.
Sourcepub fn move_panel(
&mut self,
pid: PanelId,
position: Position,
) -> Result<(), PaneError>
pub fn move_panel( &mut self, pid: PanelId, position: Position, ) -> Result<(), PaneError>
Move a panel to a new position (possibly in a different container).