Skip to main content

NavigationViewItem

Struct NavigationViewItem 

Source
pub struct NavigationViewItem {
Show 13 fields pub id: String, pub kind: NavigationViewItemKind, pub content: WidgetRef, pub has_content: bool, pub text: Option<String>, pub icon: Option<WidgetRef>, pub menu_items: Vec<NavigationViewItem>, pub selects_on_invoked: bool, pub is_enabled: bool, pub is_visible: bool, pub info_badge: Option<WidgetRef>, pub has_unrealized_children: bool, pub tool_tip: Option<ToolTip>,
}
Expand description

Stable item data; the parent owns selection, expansion and focus across reparenting.

Fields§

§id: String

Identity that remains unchanged when an item moves or enters a flyout.

§kind: NavigationViewItemKind

The source container class to present.

§content: WidgetRef

The content widget shown beside the icon.

§has_content: bool

Whether Content is non-null; false selects the icon-only template state.

§text: Option<String>

Original string content used for the suggested compact tooltip.

§icon: Option<WidgetRef>

Optional icon shown in the presenter’s icon column.

§menu_items: Vec<NavigationViewItem>

Eager child descriptors in their source order.

§selects_on_invoked: bool

Whether invocation changes selection as well as raising ItemInvoked.

§is_enabled: bool

Whether pointer and keyboard input are accepted.

§is_visible: bool

Whether the item participates in layout and navigation.

§info_badge: Option<WidgetRef>

Content for the template’s InfoBadgePresenter.

§has_unrealized_children: bool

Allows the Expanding callback to populate children on demand.

§tool_tip: Option<ToolTip>

Explicit tooltip content overriding the suggested string label.

Implementations§

Source§

impl NavigationViewItem

Source

pub fn new<K>(id: impl Into<String>, content: impl IntoWidget<K>) -> Self

Creates an entry with a stable identity and arbitrary content.

Source

pub fn without_content(self) -> Self

Clears Content while preserving a stable descriptor identity.

Source

pub fn text(id: impl Into<String>, text: impl Into<String>) -> Self

Creates string content and retains its suggested tooltip.

Source

pub fn header(id: impl Into<String>, text: impl Into<String>) -> Self

Creates a noninteractive section heading.

Source

pub fn separator(id: impl Into<String>) -> Self

Creates a noninteractive section separator.

Source

pub fn icon<K>(self, icon: impl IntoWidget<K>) -> Self

Sets the icon column’s content.

Source

pub fn menu_items(self, items: impl IntoIterator<Item = Self>) -> Self

Sets the ordered child collection.

Source

pub fn selects_on_invoked(self, value: bool) -> Self

Sets whether invocation also changes selection.

Source

pub fn is_enabled(self, value: bool) -> Self

Sets whether the item accepts input.

Source

pub fn is_visible(self, value: bool) -> Self

Sets whether the item participates in layout.

Source

pub fn info_badge<K>(self, badge: impl IntoWidget<K>) -> Self

Sets the badge presenter content.

Source

pub fn tool_tip(self, tool_tip: ToolTip) -> Self

Overrides the automatic suggested tooltip for this item.

Source

pub fn has_unrealized_children(self, value: bool) -> Self

Enables expansion before children have been supplied.

Trait Implementations§

Source§

impl Clone for NavigationViewItem

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NavigationViewItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>