summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
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,