pub struct PressSource(/* private fields */);Expand description
Source of a Press event
This identifies the source of a click, touch or pointer motion. It
identifies which mouse button is pressed (if any) and whether this is a
double-click (see Self::repetitions).
This may be used to track a click/touch, but note that identifiers may be
re-used after the event completes, thus an Event::PressStart with
PressSource equal to a prior instance does not indicate that the same
finger / mouse was used.
Further note: identifying multiple mice is not currently supported.
Implementations§
Source§impl PressSource
impl PressSource
Identify the mouse button used
This returns Some(button) for mouse events with a button. It returns
None for touch events and mouse events without a button (e.g. motion).
Sourcepub fn is_primary(self) -> bool
pub fn is_primary(self) -> bool
Returns true if this represents the left mouse button or a touch event
Sourcepub fn is_secondary(self) -> bool
pub fn is_secondary(self) -> bool
Returns true if this represents the right mouse button
Sourcepub fn is_tertiary(self) -> bool
pub fn is_tertiary(self) -> bool
Returns true if this represents the middle mouse button
Sourcepub fn repetitions(self) -> u32
pub fn repetitions(self) -> u32
The repetitions value
This is 1 for a single-click and all touch events, 2 for a double-click,
3 for a triple-click, etc. For Event::PointerMove without a grab this is 0.
Trait Implementations§
Source§impl Clone for PressSource
impl Clone for PressSource
Source§fn clone(&self) -> PressSource
fn clone(&self) -> PressSource
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PressSource
impl Debug for PressSource
Source§impl Hash for PressSource
impl Hash for PressSource
Source§impl PartialEq for PressSource
impl PartialEq for PressSource
impl Copy for PressSource
impl Eq for PressSource
impl StructuralPartialEq for PressSource
Auto Trait Implementations§
impl Freeze for PressSource
impl RefUnwindSafe for PressSource
impl Send for PressSource
impl Sync for PressSource
impl Unpin for PressSource
impl UnwindSafe for PressSource
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<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
Source§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Source§fn cast_approx(self) -> T
fn cast_approx(self) -> T
Source§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
Source§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Source§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Source§fn cast_floor(self) -> T
fn cast_floor(self) -> T
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>
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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.