pub struct NativeMenu { /* private fields */ }Expand description
A menu rendered by the operating system.
Build it with the NativeMenu::menu / NativeMenu::separator builders,
then call NativeMenu::show to display it at a position.
Implementations§
Source§impl NativeMenu
impl NativeMenu
Append a clickable item that dispatches action when selected.
Append an item, controlling its disabled state.
Append an item, controlling its checked state (a check mark is shown).
Append a submenu built from another NativeMenu.
Sourcepub fn show(self, position: Point<Pixels>, window: &mut Window, cx: &mut App)
pub fn show(self, position: Point<Pixels>, window: &mut Window, cx: &mut App)
Pop up the menu at position (window coordinates, in logical pixels).
The menu is shown without blocking the caller: the OS tracking loop runs
off GPUI’s call stack, so GPUI is not borrowed while it is open. When an
item is selected, its action is dispatched via Window::dispatch_action.
Trait Implementations§
Source§impl Default for NativeMenu
impl Default for NativeMenu
Source§fn default() -> NativeMenu
fn default() -> NativeMenu
Source§impl From<Menu> for NativeMenu
Reuse an existing GPUI menu definition as a native menu.
impl From<Menu> for NativeMenu
Reuse an existing GPUI menu definition as a native menu.
Actions, separators, submenus, checked, and disabled are mapped over;
system menus (e.g. macOS Services) have no native popup equivalent and are
skipped.
Auto Trait Implementations§
impl !RefUnwindSafe for NativeMenu
impl !Sync for NativeMenu
impl !UnwindSafe for NativeMenu
impl Freeze for NativeMenu
impl Send for NativeMenu
impl Unpin for NativeMenu
impl UnsafeUnpin for NativeMenu
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().