pub struct NavigationSuite { /* private fields */ }Expand description
Adaptive navigation around caller-owned content.
The selection is controlled: report it through Self::on_change and pass
it back with Self::selected. It survives a change of navigation, and so
does keyboard focus, because all three forms share this element’s id and
therefore their focus handles.
use gpui_kit_material::prelude::*;
let suite = NavigationSuite::new("suite", "Main")
.items([
NavItem::new("home", "Home", NavIcon::new("home", "home")),
NavItem::new("mail", "Mail", NavIcon::new("mail", "mail")),
])
.selected("home")
.expanded_type(NavigationSuiteType::RailExpanded);Implementations§
Sourcepub fn new(id: impl Into<ElementId>, label: impl Into<SharedString>) -> Self
pub fn new(id: impl Into<ElementId>, label: impl Into<SharedString>) -> Self
label is the navigation landmark’s accessible name.
Sourcepub fn items(self, items: impl IntoIterator<Item = NavItem>) -> Self
pub fn items(self, items: impl IntoIterator<Item = NavItem>) -> Self
The destinations, shown by every form.
Sourcepub fn selected(self, value: impl Into<SharedString>) -> Self
pub fn selected(self, value: impl Into<SharedString>) -> Self
The selected destination’s value.
Sourcepub fn layout_type(self, layout_type: Option<NavigationSuiteType>) -> Self
pub fn layout_type(self, layout_type: Option<NavigationSuiteType>) -> Self
Fix the navigation, overriding the adaptive rule. None is adaptive.
Sourcepub fn size_class(self, size_class: Option<WindowSizeClass>) -> Self
pub fn size_class(self, size_class: Option<WindowSizeClass>) -> Self
Classify this size instead of the window’s: for a suite framed inside a
larger window, as previews are. None reads the window.
Sourcepub fn expanded_from(self, from: Option<WindowWidthClass>) -> Self
pub fn expanded_from(self, from: Option<WindowWidthClass>) -> Self
The width class the navigation expands at (large by default). None
never expands.
Sourcepub fn expanded_type(self, expanded_type: NavigationSuiteType) -> Self
pub fn expanded_type(self, expanded_type: NavigationSuiteType) -> Self
What the expanded navigation is: NavigationSuiteType::Drawer by
default, or NavigationSuiteType::RailExpanded as m3e defaults to.
Hide the navigation; the content takes the freed space. The change animates, and a hidden navigation cannot take focus.
Sourcepub fn primary_action(self, action: impl IntoElement) -> Self
pub fn primary_action(self, action: impl IntoElement) -> Self
The primary action, typically a FAB: floating above a bar, heading a rail, or first in a drawer. It stays above a hidden bar.
Sourcepub fn child(self, child: impl IntoElement) -> Self
pub fn child(self, child: impl IntoElement) -> Self
Add to the content area, which fills the space the navigation leaves.
Sourcepub fn on_change(
self,
handler: impl Fn(&SharedString, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_change( self, handler: impl Fn(&SharedString, &mut Window, &mut App) + 'static, ) -> Self
Called with a newly selected destination’s value.
Sourcepub fn on_type_change(
self,
handler: impl Fn(&NavigationSuiteType, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_type_change( self, handler: impl Fn(&NavigationSuiteType, &mut Window, &mut App) + 'static, ) -> Self
Called when the size or an option changes the navigation form.
Trait Implementations§
Source§type Element = ViewElement<NavigationSuite>
type Element = ViewElement<NavigationSuite>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement].Auto Trait Implementations§
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
§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> ⓘ
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> ⓘ
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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.