From 988515d57f8c67a22ca0554f3e1327b26e5c6ecf Mon Sep 17 00:00:00 2001 From: tarkah Date: Wed, 2 Nov 2022 19:25:27 -0700 Subject: Add state::Scoped & rename Elements as Contents --- native/src/widget/pane_grid/state.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'native/src/widget/pane_grid') diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs index 92d26f5a..b5bebc2e 100644 --- a/native/src/widget/pane_grid/state.rs +++ b/native/src/widget/pane_grid/state.rs @@ -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, + } } } -- cgit