summaryrefslogtreecommitdiffstats
path: root/native/src/widget/pane_grid/state.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-10 02:32:57 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-10 02:32:57 +0100
commitd6d5cf0294b1231f4909a782e90b491cc6838fae (patch)
tree41e746cb2559df2e2c8c94715cd6bd1c9c10617e /native/src/widget/pane_grid/state.rs
parentc53022e8dff6fc6286b60bc897232fe4cb6e6202 (diff)
downloadiced-d6d5cf0294b1231f4909a782e90b491cc6838fae.tar.gz
iced-d6d5cf0294b1231f4909a782e90b491cc6838fae.tar.bz2
iced-d6d5cf0294b1231f4909a782e90b491cc6838fae.zip
Restore hotkeys in `pane_grid` example
- Implement `subscription::events_with` - Remove `pane_grid::KeyPressEvent` - Return closest sibling in `pane_grid::State::close`
Diffstat (limited to 'native/src/widget/pane_grid/state.rs')
-rw-r--r--native/src/widget/pane_grid/state.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs
index e2793641..be36b070 100644
--- a/native/src/widget/pane_grid/state.rs
+++ b/native/src/widget/pane_grid/state.rs
@@ -227,12 +227,13 @@ impl<T> State<T> {
let _ = self.internal.layout.resize(split, ratio);
}
- /// Closes the given [`Pane`] and returns its internal state, if it exists.
+ /// Closes the given [`Pane`] and returns its internal state and its closest
+ /// sibling, if it exists.
///
/// [`Pane`]: struct.Pane.html
- pub fn close(&mut self, pane: &Pane) -> Option<T> {
- if let Some(_) = self.internal.layout.remove(pane) {
- self.panes.remove(pane)
+ pub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)> {
+ if let Some(sibling) = self.internal.layout.remove(pane) {
+ self.panes.remove(pane).map(|state| (state, sibling))
} else {
None
}