pub struct MacContextMenu<'a> {
pub items: &'a [NSMenuItem],
pub is_open: &'a mut bool,
pub spawn_pos: &'a mut Pos2,
pub selected_idx: &'a mut Option<usize>,
pub theme: Option<&'a MacTheme>,
}Expand description
Context Menu state and renderer.
Fields§
§items: &'a [NSMenuItem]Slice of menu items to display.
is_open: &'a mut boolMutable reference to menu open state.
spawn_pos: &'a mut Pos2Mutable reference to menu screen spawn position.
selected_idx: &'a mut Option<usize>Mutable reference to currently highlighted menu item index.
theme: Option<&'a MacTheme>Optional macOS dynamic theme reference.
Implementations§
Source§impl<'a> MacContextMenu<'a>
impl<'a> MacContextMenu<'a>
Sourcepub fn new(
items: &'a [NSMenuItem],
is_open: &'a mut bool,
spawn_pos: &'a mut Pos2,
selected_idx: &'a mut Option<usize>,
) -> Self
pub fn new( items: &'a [NSMenuItem], is_open: &'a mut bool, spawn_pos: &'a mut Pos2, selected_idx: &'a mut Option<usize>, ) -> Self
Creates a new context menu.
Sourcepub fn attach_to(&mut self, response: &Response)
pub fn attach_to(&mut self, response: &Response)
Checks a widget response (such as on a canvas card or outline row) and activates the context menu if secondary-clicked (right-clicked).
Sourcepub fn handle_input(&mut self, input: &InputState) -> Option<String>
pub fn handle_input(&mut self, input: &InputState) -> Option<String>
Handles keyboard events (Arrow Down, Arrow Up, Enter, Escape).
Auto Trait Implementations§
impl<'a> !UnwindSafe for MacContextMenu<'a>
impl<'a> Forget for MacContextMenu<'a>
impl<'a> Freeze for MacContextMenu<'a>
impl<'a> RefUnwindSafe for MacContextMenu<'a>
impl<'a> Send for MacContextMenu<'a>
impl<'a> Sync for MacContextMenu<'a>
impl<'a> Unpin for MacContextMenu<'a>
impl<'a> UnsafeUnpin for MacContextMenu<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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