pub struct TextContextMenu { /* private fields */ }Expand description
Embeddable controller wrapping an optional open PopupMenu. Default
yields a closed menu, so a widget can hold one with ..Default::default().
Implementations§
Source§impl TextContextMenu
impl TextContextMenu
pub fn new() -> Self
pub fn is_open(&self) -> bool
pub fn close(&mut self)
Sourcepub fn open(&mut self, pos: Point, has_selection: bool, editable: bool)
pub fn open(&mut self, pos: Point, has_selection: bool, editable: bool)
Build the items honouring enablement, then open at pos (the right-click
position, in the widget’s local coordinates — the same space its
paint_global_overlay paints in).
has_selection— Cut and Copy are enabled only with a selection.editable— Cut and Paste are enabled only when the widget accepts input (not read-only / disabled). Copy stays available read-only, and Select All is always enabled.
Sourcepub fn handle_event(
&mut self,
event: &Event,
) -> (EventResult, Option<TextMenuAction>)
pub fn handle_event( &mut self, event: &Event, ) -> (EventResult, Option<TextMenuAction>)
Route an event into the open menu. Returns the menu’s EventResult
(consume it if is_consumed()) and any chosen action for the caller to
dispatch. Choosing an item or dismissing the menu closes it here.
Sourcepub fn click_at(&mut self, pos: Point) -> Option<TextMenuAction>
pub fn click_at(&mut self, pos: Point) -> Option<TextMenuAction>
Convenience wrapper for a synthetic left click at pos — used by tests
to activate a menu item through the real menu event path.
pub fn paint(&mut self, ctx: &mut dyn DrawCtx, font: Arc<Font>, font_size: f64)
Trait Implementations§
Source§impl Clone for TextContextMenu
impl Clone for TextContextMenu
Source§fn clone(&self) -> TextContextMenu
fn clone(&self) -> TextContextMenu
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 TextContextMenu
impl Default for TextContextMenu
Source§fn default() -> TextContextMenu
fn default() -> TextContextMenu
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for TextContextMenu
impl !Send for TextContextMenu
impl !Sync for TextContextMenu
impl !UnwindSafe for TextContextMenu
impl Freeze for TextContextMenu
impl Unpin for TextContextMenu
impl UnsafeUnpin for TextContextMenu
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>
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().