summaryrefslogtreecommitdiffstats
path: root/src/tuice/layout/build_layout.rs
blob: 709eed499ae461a8b130dd90dc59749317cda0e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use tui::layout::Rect;

use crate::tuice::{Bounds, Element, LayoutNode, TmpComponent};

pub fn build_layout_tree<Message>(area: Rect, root: &Element<'_, Message>) -> LayoutNode {
    let mut root_layout_node = LayoutNode::from_area(area);
    let bounds = Bounds {
        min_width: 0,
        min_height: 0,
        max_width: area.width,
        max_height: area.height,
    };

    let _ = root.layout(bounds, &mut root_layout_node);

    root_layout_node
}