pub struct MenuPopup { /* private fields */ }Expand description
A trigger that opens a MaterialMenu in Kit’s popover overlay.
open is controlled: Kit’s popover reports pointer toggles, outside
clicks and Escape through on_open_change, and an activated item closes
the menu the same way (unless Self::close_on_activate is off).
Keyboard activation of the trigger itself is the caller’s (e.g. its
button’s click handler).
A cascading sub-menu (Self::submenu) opens beside the item that owns
it, on the side away from the popup’s anchor edge, with the same reveal
motion. Right on a sub-menu item activates it (the caller opens the
sub-menu, which takes focus); Left or Escape inside the sub-menu reports
false through Self::on_submenu_change and returns focus to the
parent menu.
Implementations§
Source§impl MenuPopup
impl MenuPopup
pub fn new( id: impl Into<ElementId>, trigger: impl IntoElement, menu: MaterialMenu, ) -> Self
Sourcepub fn close_on_activate(self, close: bool) -> Self
pub fn close_on_activate(self, close: bool) -> Self
Close the menu when an item (other than a sub-menu) is activated (default). Off, the menu stays open, e.g. to toggle several items.
A cascading sub-menu for the main menu’s item at flat index
(counting across groups), shown while open.
Left or Escape inside the open sub-menu reports false.
pub fn open(self, open: bool) -> Self
pub fn on_open_change( self, handler: impl Fn(&bool, &mut Window, &mut App) + 'static, ) -> Self
Trait Implementations§
Source§impl IntoElement for MenuPopup
impl IntoElement for MenuPopup
Source§type Element = ViewElement<MenuPopup>
type Element = ViewElement<MenuPopup>
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].Auto Trait Implementations§
impl !RefUnwindSafe for MenuPopup
impl !Send for MenuPopup
impl !Sync for MenuPopup
impl !UnwindSafe for MenuPopup
impl Freeze for MenuPopup
impl Unpin for MenuPopup
impl UnsafeUnpin for MenuPopup
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§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,
§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,
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
§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,
§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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.