pub struct PaneNavigator<K> { /* private fields */ }Expand description
A destination history and the pane value it gives. Own it in an Entity
and hand it to a super::PaneScaffold, which keeps its directive current.
use gpui_kit_material::prelude::*;
// One pane at a time: the list, then the detail, then back.
let mut navigator = PaneNavigator::<u32>::list_detail();
assert!(navigator.is_expanded(PaneRole::Secondary));
navigator.navigate_to(PaneRole::Primary, Some(7));
assert!(navigator.is_expanded(PaneRole::Primary));
assert_eq!(navigator.content_key(), Some(&7));
navigator.navigate_back(BackNavigationBehavior::default());
assert!(navigator.is_expanded(PaneRole::Secondary));Implementations§
Sourcepub fn list_detail() -> Self
pub fn list_detail() -> Self
A list-detail navigator, starting on the list.
Sourcepub fn supporting_pane() -> Self
pub fn supporting_pane() -> Self
A supporting pane navigator, starting on the main pane.
Sourcepub fn history(&self) -> &[PaneDestination<K>]
pub fn history(&self) -> &[PaneDestination<K>]
The destination history, oldest first.
Sourcepub fn current(&self) -> Option<&PaneDestination<K>>
pub fn current(&self) -> Option<&PaneDestination<K>>
The latest destination.
Sourcepub fn content_key(&self) -> Option<&K>
pub fn content_key(&self) -> Option<&K>
The latest content key in the history, for what a detail pane shows.
Sourcepub fn directive(&self) -> PaneDirective
pub fn directive(&self) -> PaneDirective
The directive in force.
Sourcepub fn set_directive(&mut self, directive: PaneDirective) -> bool
pub fn set_directive(&mut self, directive: PaneDirective) -> bool
Apply a directive; true when it changed.
Sourcepub fn strategies(&self) -> &AdaptStrategies
pub fn strategies(&self) -> &AdaptStrategies
The adapt strategies in force.
Sourcepub fn value(&self) -> ThreePaneValue
pub fn value(&self) -> ThreePaneValue
The panes’ current value.
Sourcepub fn is_expanded(&self, pane: PaneRole) -> bool
pub fn is_expanded(&self, pane: PaneRole) -> bool
Whether a pane has its own partition, as a list checks before marking its selected row.
Navigate to a pane.
Whether there is a destination to go back to.
Go back; false when there was nothing to go back to, which also clears the history, as Compose does.
Trait Implementations§
Source§fn clone(&self) -> PaneNavigator<K>
fn clone(&self) -> PaneNavigator<K>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more