pub struct PopupMenu { /* private fields */ }Implementations§
Source§impl PopupMenu
impl PopupMenu
pub fn build( window: &mut Window, cx: &mut App, f: impl FnOnce(Self, &mut Window, &mut Context<'_, PopupMenu>) -> Self, ) -> Entity<Self>
Sourcepub fn action_context(self, handle: FocusHandle) -> Self
pub fn action_context(self, handle: FocusHandle) -> Self
Set the focus handle of Entity to handle actions.
When the menu is dismissed or before an action is triggered, the focus will be returned to this handle.
Then the action will be dispatched to this handle.
Sourcepub fn min_w(self, width: impl Into<Pixels>) -> Self
pub fn min_w(self, width: impl Into<Pixels>) -> Self
Set min width of the popup menu, default is 120px
Sourcepub fn max_w(self, width: impl Into<Pixels>) -> Self
pub fn max_w(self, width: impl Into<Pixels>) -> Self
Set max width of the popup menu, default is 500px
Sourcepub fn max_h(self, height: impl Into<Pixels>) -> Self
pub fn max_h(self, height: impl Into<Pixels>) -> Self
Set max height of the popup menu, default is half of the window height
Sourcepub fn scrollable(self, scrollable: bool) -> Self
pub fn scrollable(self, scrollable: bool) -> Self
Set the menu to be scrollable to show vertical scrollbar.
NOTE: If this is true, the sub-menus will cannot be support.
Sourcepub fn external_link_icon(self, visible: bool) -> Self
pub fn external_link_icon(self, visible: bool) -> Self
Set the menu to show external link icon, default is true.
Add Menu Item
Add Menu Item with enable state
Add Menu Item with disabled state
Sourcepub fn label(self, label: impl Into<SharedString>) -> Self
pub fn label(self, label: impl Into<SharedString>) -> Self
Add label
Sourcepub fn link(
self,
label: impl Into<SharedString>,
href: impl Into<String>,
) -> Self
pub fn link( self, label: impl Into<SharedString>, href: impl Into<String>, ) -> Self
Add Menu to open link
Sourcepub fn link_with_disabled(
self,
label: impl Into<SharedString>,
href: impl Into<String>,
disabled: bool,
) -> Self
pub fn link_with_disabled( self, label: impl Into<SharedString>, href: impl Into<String>, disabled: bool, ) -> Self
Add Menu to open link with disabled state
Sourcepub fn link_with_icon(
self,
label: impl Into<SharedString>,
icon: impl Into<Icon>,
href: impl Into<String>,
) -> Self
pub fn link_with_icon( self, label: impl Into<SharedString>, icon: impl Into<Icon>, href: impl Into<String>, ) -> Self
Add Menu to open link
Add Menu Item with Icon.
Add Menu Item with Icon and disabled state
Add Menu Item with check icon
Add Menu Item with check icon and disabled state
Add Menu Item with custom element render.
Add Menu Item with custom element render with disabled state.
Add Menu Item with custom element render with icon.
Add Menu Item with custom element render with check state
Add a Submenu
Add a Submenu item with icon
Sourcepub fn item(self, item: impl Into<PopupMenuItem>) -> Self
pub fn item(self, item: impl Into<PopupMenuItem>) -> Self
Add menu item.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl FluentBuilder for PopupMenu
impl FluentBuilder for PopupMenu
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 Focusable for PopupMenu
impl Focusable for PopupMenu
Source§fn focus_handle(&self, _: &App) -> FocusHandle
fn focus_handle(&self, _: &App) -> FocusHandle
impl EventEmitter<DismissEvent> for PopupMenu
Auto Trait Implementations§
impl Freeze for PopupMenu
impl !RefUnwindSafe for PopupMenu
impl !Send for PopupMenu
impl !Sync for PopupMenu
impl Unpin for PopupMenu
impl !UnwindSafe for PopupMenu
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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