Add state::Scoped & rename Elements as Contents

This commit is contained in:
tarkah 2022-11-02 19:25:27 -07:00
parent 923878c7b7
commit 988515d57f
2 changed files with 100 additions and 94 deletions

View file

@ -281,6 +281,15 @@ impl Internal {
}
}
/// The scoped internal state of the [`PaneGrid`]
#[derive(Debug)]
pub enum Scoped<'a> {
/// The state when all panes are visible
All(&'a Internal),
/// The state when a pane is maximized
Maximized(Node),
}
/// The current action of a [`PaneGrid`].
///
/// [`PaneGrid`]: crate::widget::PaneGrid
@ -328,9 +337,12 @@ impl Action {
}
}
impl Internal {
/// The layout [`Node`] of the [`Internal`] state
impl<'a> Scoped<'a> {
/// The layout [`Node`] of the [`Scope`] state
pub fn layout(&self) -> &Node {
&self.layout
match self {
Scoped::All(Internal { layout, .. }) => layout,
Scoped::Maximized(layout) => layout,
}
}
}