pub struct ContextMenuHandle { /* private fields */ }Expand description
Opens a ContextMenu from code, at a point. For a trigger that decides
for itself when a menu is asked for, such as a canvas that pans with the
right button and wants a menu only for a right-click that does not drag:
it handles the press, and opens the menu with Self::open_at.
Implementations§
Source§impl ContextMenuHandle
impl ContextMenuHandle
pub fn new() -> ContextMenuHandle
Sourcepub fn open_at(&self, ctx: &mut EventCtx, position: Point) -> bool
pub fn open_at(&self, ctx: &mut EventCtx, position: Point) -> bool
Open the menu at position, in window coordinates, once the current
event is handled; if it is open, it moves there. The menu’s items are
read again, so a provider given with ContextMenu::items_when can
list what applies where it opened. If the widget handling the event
has focus, the menu gives focus back to it when it closes, unless a
click elsewhere closes it. Returns false if the menu has not been
laid out yet.
Trait Implementations§
Source§impl Clone for ContextMenuHandle
impl Clone for ContextMenuHandle
Source§fn clone(&self) -> ContextMenuHandle
fn clone(&self) -> ContextMenuHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for ContextMenuHandle
impl Default for ContextMenuHandle
Source§fn default() -> ContextMenuHandle
fn default() -> ContextMenuHandle
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ContextMenuHandle
impl !Send for ContextMenuHandle
impl !Sync for ContextMenuHandle
impl !UnwindSafe for ContextMenuHandle
impl Forget for ContextMenuHandle
impl Freeze for ContextMenuHandle
impl Move for ContextMenuHandle
impl Unpin for ContextMenuHandle
impl UnsafeUnpin for ContextMenuHandle
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> 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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.