pub struct ContextMenu { /* private fields */ }Expand description
A secondary-click menu over child. See the module docs.
Implementations§
Source§impl ContextMenu
impl ContextMenu
Sourcepub fn new(
id: impl Into<ElementId>,
child: impl IntoElement,
items: Vec<MenuItem>,
) -> Self
pub fn new( id: impl Into<ElementId>, child: impl IntoElement, items: Vec<MenuItem>, ) -> Self
A context menu with items over the child area. id keys the
menu’s state; give every instance its own.
Sourcepub fn recipe(self, name: impl Into<SharedString>) -> Self
pub fn recipe(self, name: impl Into<SharedString>) -> Self
Named theme overlay from herogpui_theme::ComponentThemes::menu,
forwarded onto the painted Menu as crate::Dropdown::recipe
forwards it. Stackable; a missing name adds no override.
Sourcepub fn item_content(
self,
render: impl Fn(&SharedString, InteractiveState) -> AnyElement + 'static,
) -> Self
pub fn item_content( self, render: impl Fn(&SharedString, InteractiveState) -> AnyElement + 'static, ) -> Self
Replaces each item’s label, forwarded onto the painted Menu. See
Menu::item_content.
Sourcepub fn item_start_content(
self,
render: impl Fn(&SharedString, InteractiveState) -> Option<AnyElement> + 'static,
) -> Self
pub fn item_start_content( self, render: impl Fn(&SharedString, InteractiveState) -> Option<AnyElement> + 'static, ) -> Self
The leading element of each row, forwarded onto the painted Menu.
See Menu::item_start_content.
Sourcepub fn on_action(
self,
f: impl Fn(&SharedString, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_action( self, f: impl Fn(&SharedString, &mut Window, &mut App) + 'static, ) -> Self
Runs with the chosen item’s key; the menu then closes.
Sourcepub fn on_open_change(
self,
f: impl Fn(&bool, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_open_change( self, f: impl Fn(&bool, &mut Window, &mut App) + 'static, ) -> Self
Reports every open and close.
Sourcepub fn disabled_keys(
self,
keys: impl IntoIterator<Item = impl Into<SharedString>>,
) -> Self
pub fn disabled_keys( self, keys: impl IntoIterator<Item = impl Into<SharedString>>, ) -> Self
Items that render dimmed and cannot be chosen or focused.
Sourcepub fn is_disabled(self, v: bool) -> Self
pub fn is_disabled(self, v: bool) -> Self
A disabled context menu ignores secondary clicks; the area still renders and receives every other event.
Trait Implementations§
Source§impl IntoElement for ContextMenu
impl IntoElement for ContextMenu
Source§type Element = ViewElement<ContextMenu>
type Element = ViewElement<ContextMenu>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for ContextMenu
impl RenderOnce for ContextMenu
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.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<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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 more