summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-07-22 02:58:14 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-07-22 02:58:14 +0200
commit35b1b8b0e72bd57ddc793624c6c26c1f0c3eb9e1 (patch)
tree4232d223cce2f9e85371e103d32516bfd454c3ed /native
parent021b173ef3f469d28dbb8564cc8a653c0c057282 (diff)
downloadiced-35b1b8b0e72bd57ddc793624c6c26c1f0c3eb9e1.tar.gz
iced-35b1b8b0e72bd57ddc793624c6c26c1f0c3eb9e1.tar.bz2
iced-35b1b8b0e72bd57ddc793624c6c26c1f0c3eb9e1.zip
Add `focused` method to `pane_grid::State`
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/pane_grid/state.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs
index e1585968..f537c7de 100644
--- a/native/src/widget/pane_grid/state.rs
+++ b/native/src/widget/pane_grid/state.rs
@@ -122,6 +122,14 @@ impl<T> State<T> {
&self.internal.layout
}
+ /// Returns the focused [`Pane`] of the [`State`], if there is one.
+ ///
+ /// [`Pane`]: struct.Pane.html
+ /// [`State`]: struct.State.html
+ pub fn focused(&self) -> Option<Pane> {
+ self.internal.focused_pane()
+ }
+
/// Returns the active [`Pane`] of the [`State`], if there is one.
///
/// A [`Pane`] is active if it is focused and is __not__ being dragged.
@@ -351,6 +359,14 @@ impl Internal {
self.action
}
+ pub fn focused_pane(&self) -> Option<Pane> {
+ match self.action {
+ Action::Idle { focus } => focus,
+ Action::Dragging { pane, .. } => Some(pane),
+ Action::Resizing { focus, .. } => focus,
+ }
+ }
+
pub fn active_pane(&self) -> Option<Pane> {
match self.action {
Action::Idle { focus } => focus,