use std::collections::BTreeMap;
use tui::layout::Direction;
use crate::canvas::LayoutConstraint;
use crate::constants::DEFAULT_WIDGET_ID;
use crate::error::{BottomError, Result};
use crate::options::layout_options::{Row, RowChildren};
use crate::utils::error;
/// Represents a start and end coordinate in some dimension.
type LineSegment = (u32, u32);
type WidgetMappings = (u32, BTreeMap<LineSegment, u64>);
type ColumnRowMappings = (u32, BTreeMap<LineSegment, WidgetMappings>);
type ColumnMappings = (u32, BTreeMap<LineSegment, ColumnRowMappings>);
/// A "container" that contains more [`Node`]s.
#[derive(Debug, Clone)]
pub(crate) struct Container {
/// The children elements.
pub(crate) children: Vec<NodeId>,
/// How the container should be sized.
pub(crate) constraint: LayoutConstraint,
/// The direction.
direction: ContainerDirection,
}
impl Container {
pub(crate) fn row(children: Vec<NodeId>, sizing: LayoutConstraint) -> Self {
Self {
children,
constraint: sizing,
direction: ContainerDirection::Row,
}
}
pub(crate) fn col(children: Vec<NodeId>, constraint: LayoutConstraint) -> Self {
Self {
children,