pub struct ContextMenu { /* private fields */ }Expand description
A vertically stacked popup menu with a single selection.
Implementations§
Source§impl ContextMenu
impl ContextMenu
pub fn new(items: Vec<MenuItem>) -> Self
pub fn item(&self, index: usize) -> Option<&MenuItem>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn items(&self) -> &[MenuItem]
Sourcepub fn bounds(&self, area: Rect) -> Rect
pub fn bounds(&self, area: Rect) -> Rect
The popup rect for area, size clamped to the items and to the area.
Sourcepub fn handle_key(&mut self, code: KeyCode) -> MenuEvent
pub fn handle_key(&mut self, code: KeyCode) -> MenuEvent
Route a key press, returning the resulting MenuEvent.
Trait Implementations§
Source§impl Clone for ContextMenu
impl Clone for ContextMenu
Auto Trait Implementations§
impl Freeze for ContextMenu
impl RefUnwindSafe for ContextMenu
impl Send for ContextMenu
impl Sync for ContextMenu
impl Unpin for ContextMenu
impl UnsafeUnpin for ContextMenu
impl UnwindSafe for ContextMenu
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<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