pub struct ContextMenu { /* private fields */ }Expand description
The same menu, opened at the pointer over a region rather than from a trigger.
Implementations§
Source§impl ContextMenu
impl ContextMenu
pub fn new( ident: impl Into<Ident>, _window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
Sourcepub fn name(self, name: impl Into<SharedString>) -> Self
pub fn name(self, name: impl Into<SharedString>) -> Self
Names the command surface independently of the region under it.
pub fn set_name( &mut self, name: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
Sourcepub fn target(self, target: impl Into<SharedString>) -> Self
pub fn target(self, target: impl Into<SharedString>) -> Self
What the wrapped region stands for. Reported when the menu opens, so a host can decide whether to select it. Defaults to the menu’s own id.
Sourcepub fn content(
self,
content: impl Fn(&mut Window, &mut App) -> AnyElement + 'static,
) -> Self
pub fn content( self, content: impl Fn(&mut Window, &mut App) -> AnyElement + 'static, ) -> Self
Supplies the wrapped region, rebuilt on every frame.
pub fn set_items(&mut self, items: Vec<MenuItem>, cx: &mut Context<'_, Self>)
pub fn is_open(&self) -> bool
pub fn position(&self) -> Point<Pixels>
Sourcepub fn open_at(
&mut self,
position: Point<Pixels>,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn open_at( &mut self, position: Point<Pixels>, window: &mut Window, cx: &mut Context<'_, Self>, )
Opens at a window position. Reports the target and nothing else: what is selected stays the host’s answer.
pub fn close(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
pub fn dismiss(&mut self, window: &mut Window, cx: &mut Context<'_, Self>)
Trait Implementations§
Source§impl Debug for ContextMenu
impl Debug for ContextMenu
impl EventEmitter<ContextMenuEvent> for ContextMenu
Source§impl Focusable for ContextMenu
impl Focusable for ContextMenu
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Source§impl Render for ContextMenu
impl Render for ContextMenu
Auto Trait Implementations§
impl !RefUnwindSafe for ContextMenu
impl !Send for ContextMenu
impl !Sync for ContextMenu
impl !UnwindSafe for ContextMenu
impl Freeze for ContextMenu
impl Unpin for ContextMenu
impl UnsafeUnpin 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
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> ⓘ
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