pub struct PopupMenu {
pub items: Vec<MenuEntry>,
pub state: PopupMenuState,
pub style: MenuStyle,
}Fields§
§items: Vec<MenuEntry>§state: PopupMenuState§style: MenuStyleImplementations§
Source§impl PopupMenu
impl PopupMenu
pub fn new(items: Vec<MenuEntry>) -> Self
pub fn open_at(&mut self, pos: Point)
pub fn close(&mut self)
pub fn is_open(&self) -> bool
pub fn take_suppress_mouse_up(&mut self) -> bool
pub fn handle_event( &mut self, event: &Event, viewport: Size, ) -> (EventResult, MenuResponse)
Sourcepub fn body_contains(&self, pos: Point, viewport: Size) -> bool
pub fn body_contains(&self, pos: Point, viewport: Size) -> bool
Return true if pos falls inside any of the popup’s currently
laid-out panels (the open menu plus any nested submenus). Used
by MenuBar to detect a mouse-up in “neutral space” — outside
both the menu bar AND the popup body — so the bar can dismiss
the popup without waiting for a follow-up event.
pub fn handle_shortcut( &mut self, key: &Key, modifiers: Modifiers, ) -> MenuResponse
pub fn paint( &self, ctx: &mut dyn DrawCtx, font: Arc<Font>, font_size: f64, viewport: Size, )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PopupMenu
impl RefUnwindSafe for PopupMenu
impl Send for PopupMenu
impl Sync for PopupMenu
impl Unpin for PopupMenu
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
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