diff options
author | 2020-07-01 22:44:37 +0200 | |
---|---|---|
committer | 2020-07-01 22:44:37 +0200 | |
commit | 99a50d6b2ff2c54c276d3a142071bd77ac38e4f0 (patch) | |
tree | 0f8eca7533cf6eef8fdf0661fe2c0c4fe83f9243 /native/src/widget/pane_grid/state.rs | |
parent | 79aa225001dda0efc7b9d8301641a4806f259960 (diff) | |
parent | e50c61f7ff8c7bd559afb66025eaded78ca423bb (diff) | |
download | iced-99a50d6b2ff2c54c276d3a142071bd77ac38e4f0.tar.gz iced-99a50d6b2ff2c54c276d3a142071bd77ac38e4f0.tar.bz2 iced-99a50d6b2ff2c54c276d3a142071bd77ac38e4f0.zip |
Merge pull request #431 from hecrj/feature/pane-grid-splits
Splits iterator for `PaneGrid` and minor improvements
Diffstat (limited to 'native/src/widget/pane_grid/state.rs')
-rw-r--r-- | native/src/widget/pane_grid/state.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs index 4b13fb8e..a4cfb6f6 100644 --- a/native/src/widget/pane_grid/state.rs +++ b/native/src/widget/pane_grid/state.rs @@ -154,8 +154,10 @@ impl<T> State<T> { /// [`Pane`]: struct.Pane.html /// [`State::active`]: struct.State.html#method.active pub fn adjacent(&self, pane: &Pane, direction: Direction) -> Option<Pane> { - let regions = - self.internal.layout.regions(0.0, Size::new(4096.0, 4096.0)); + let regions = self + .internal + .layout + .pane_regions(0.0, Size::new(4096.0, 4096.0)); let current_region = regions.get(pane)?; @@ -191,6 +193,13 @@ impl<T> State<T> { self.internal.focus(pane); } + /// Unfocuses the current focused [`Pane`]. + /// + /// [`Pane`]: struct.Pane.html + pub fn unfocus(&mut self) { + self.internal.unfocus(); + } + /// Splits the given [`Pane`] into two in the given [`Axis`] and /// initializing the new [`Pane`] with the provided internal state. /// @@ -362,20 +371,20 @@ impl Internal { } } - pub fn regions( + pub fn pane_regions( &self, spacing: f32, size: Size, ) -> HashMap<Pane, Rectangle> { - self.layout.regions(spacing, size) + self.layout.pane_regions(spacing, size) } - pub fn splits( + pub fn split_regions( &self, spacing: f32, size: Size, ) -> HashMap<Split, (Axis, Rectangle, f32)> { - self.layout.splits(spacing, size) + self.layout.split_regions(spacing, size) } pub fn focus(&mut self, pane: &Pane) { |