pub struct SubMenuItem {
pub label: String,
pub items: Vec<MenuItem>,
pub enabled: bool,
pub hotkey: Option<char>,
pub help_context: Option<String>,
pub focused_item: Option<usize>,
pub is_open: bool,
}Expand description
A submenu containing other menu items.
Fields§
§label: StringText label displayed to the user
items: Vec<MenuItem>Collection of menu items in the submenu
enabled: boolWhether the submenu is enabled
hotkey: Option<char>Optional hotkey for quick access
help_context: Option<String>Help context for additional information
focused_item: Option<usize>Index of the currently focused item when this submenu is open
is_open: boolWhether this submenu is currently open
Implementations§
Source§impl SubMenuItem
impl SubMenuItem
Sourcepub fn with_hotkey<S: Into<String>>(label: S, hotkey: char) -> Self
pub fn with_hotkey<S: Into<String>>(label: S, hotkey: char) -> Self
Creates a new submenu item with label and hotkey.
Sourcepub fn with_items<S: Into<String>>(
label: S,
hotkey: Option<char>,
items: Vec<MenuItem>,
) -> Self
pub fn with_items<S: Into<String>>( label: S, hotkey: Option<char>, items: Vec<MenuItem>, ) -> Self
Creates a new submenu item with title, hotkey, and items.
§Example
use tui_vision::menus::{SubMenuItem, MenuItem};
let submenu = SubMenuItem::with_items("Find", Some('F'), vec![
MenuItem::new_action("Find", "edit.find"),
MenuItem::new_action("Find Next", "edit.find_next"),
]);Sourcepub fn hotkey(self, hotkey: char) -> Self
pub fn hotkey(self, hotkey: char) -> Self
Sets the hotkey for this submenu item (builder pattern).
Sourcepub fn help_context<S: Into<String>>(self, help_context: S) -> Self
pub fn help_context<S: Into<String>>(self, help_context: S) -> Self
Sets the help context for this submenu item (builder pattern).
Trait Implementations§
Source§impl Clone for SubMenuItem
impl Clone for SubMenuItem
Source§fn clone(&self) -> SubMenuItem
fn clone(&self) -> SubMenuItem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SubMenuItem
impl Debug for SubMenuItem
Source§impl PartialEq for SubMenuItem
impl PartialEq for SubMenuItem
impl Eq for SubMenuItem
impl StructuralPartialEq for SubMenuItem
Auto Trait Implementations§
impl Freeze for SubMenuItem
impl RefUnwindSafe for SubMenuItem
impl Send for SubMenuItem
impl Sync for SubMenuItem
impl Unpin for SubMenuItem
impl UnwindSafe for SubMenuItem
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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