mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-31 01:24:31 +02:00
other: add comments to new types
This commit is contained in:
parent
852e2e86c7
commit
4a95b09b46
@ -11,7 +11,7 @@ pub struct BottomLayout {
|
|||||||
pub total_row_height_ratio: u32,
|
pub total_row_height_ratio: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents a start and end coordinate in some dimension.
|
/// Represents a start and end coordinate in some dimension.
|
||||||
type LineSegment = (u32, u32);
|
type LineSegment = (u32, u32);
|
||||||
|
|
||||||
type WidgetMappings = (u32, BTreeMap<LineSegment, u64>);
|
type WidgetMappings = (u32, BTreeMap<LineSegment, u64>);
|
||||||
@ -695,27 +695,44 @@ impl BottomLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub enum BottomLayoutNode {
|
pub(crate) enum BottomLayoutNode {
|
||||||
// Container(BottomContainer),
|
/// A container type, containing more [`BottomLayoutNode`] children.
|
||||||
// Widget(BottomWidget),
|
Container(BottomContainer),
|
||||||
// }
|
|
||||||
|
|
||||||
// pub struct BottomContainer {
|
/// A leaf node, containing a [`BottomWidget`].
|
||||||
// children: Vec<BottomLayoutNode>,
|
Widget(BottomWidget),
|
||||||
// root_ratio: u32,
|
}
|
||||||
// growth_type: BottomLayoutNodeSizing,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub enum BottomContainerType {
|
/// A "container" that contains more [`BottomLayoutNode`]s.
|
||||||
// Row,
|
pub(crate) struct BottomContainer {
|
||||||
// Col,
|
/// The children elements.
|
||||||
// }
|
pub(crate) children: Vec<BottomLayoutNode>,
|
||||||
|
|
||||||
// pub enum BottomLayoutNodeSizing {
|
/// How the container should be sized.
|
||||||
// Ratio(u32),
|
pub(crate) growth_type: BottomElementSizing,
|
||||||
// CanvasHandles,
|
}
|
||||||
// FlexGrow,
|
|
||||||
// }
|
/// The direction in which children in a [`BottomContainer`] will be laid out.
|
||||||
|
pub(crate) enum BottomContainerType {
|
||||||
|
/// Lay out all children horizontally.
|
||||||
|
Row,
|
||||||
|
|
||||||
|
/// Lay out all children vertically.
|
||||||
|
Col,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// How the element sizing should be determined.
|
||||||
|
pub(crate) enum BottomElementSizing {
|
||||||
|
/// Denotes that the canvas should follow the given ratio of `lhs:rhs` to determine spacing for the element.
|
||||||
|
Ratio { lhs: u32, rhs: u32 },
|
||||||
|
|
||||||
|
/// Denotes that the canvas should let this element grow to take up whatever remaining space is left after
|
||||||
|
/// sizing the other sibling elements.
|
||||||
|
FlexGrow,
|
||||||
|
|
||||||
|
/// Denotes that the canvas can do whatever it likes to determine spacing for the element.
|
||||||
|
CanvasHandles,
|
||||||
|
}
|
||||||
|
|
||||||
/// Represents a single row in the layout.
|
/// Represents a single row in the layout.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@ -803,7 +820,7 @@ impl BottomCol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct BottomColRow {
|
pub struct BottomColRow {
|
||||||
pub children: Vec<BottomWidget>,
|
pub children: Vec<BottomWidget>,
|
||||||
pub total_widget_ratio: u32,
|
pub total_widget_ratio: u32,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user