pub enum ClickEvent {
Mouse(MouseClickEvent),
Keyboard(KeyboardClickEvent),
}Expand description
A click event, generated when a mouse button or keyboard button is pressed and released.
Variants§
Mouse(MouseClickEvent)
A click event trigger by a mouse button being pressed and released.
Keyboard(KeyboardClickEvent)
A click event trigger by a keyboard button being pressed and released.
Implementations§
Source§impl ClickEvent
impl ClickEvent
Sourcepub fn modifiers(&self) -> Modifiers
pub fn modifiers(&self) -> Modifiers
Returns the modifiers that were held during the click event
Keyboard: The keyboard click events never have modifiers.
Mouse: Modifiers that were held during the mouse key up event.
Sourcepub fn position(&self) -> Point<Pixels>
pub fn position(&self) -> Point<Pixels>
Returns the position of the click event
Keyboard: The bottom left corner of the clicked hitbox
Mouse: The position of the mouse when the button was released.
Sourcepub fn mouse_position(&self) -> Option<Point<Pixels>>
pub fn mouse_position(&self) -> Option<Point<Pixels>>
Returns the mouse position of the click event
Keyboard: None
Mouse: The position of the mouse when the button was released.
Sourcepub fn is_right_click(&self) -> bool
pub fn is_right_click(&self) -> bool
Returns if this was a right click
Keyboard: false
Mouse: Whether the right button was pressed and released
Sourcepub fn standard_click(&self) -> bool
pub fn standard_click(&self) -> bool
Returns whether the click was a standard click
Keyboard: Always true
Mouse: Left button pressed and released
Sourcepub fn first_focus(&self) -> bool
pub fn first_focus(&self) -> bool
Returns whether the click focused the element
Keyboard: false, keyboard clicks only work if an element is already focused
Mouse: Whether this was the first focusing click
Sourcepub fn click_count(&self) -> usize
pub fn click_count(&self) -> usize
Returns the click count of the click event
Keyboard: Always 1
Mouse: Count of clicks from MouseUpEvent
Sourcepub fn is_keyboard(&self) -> bool
pub fn is_keyboard(&self) -> bool
Returns whether the click event is generated by a keyboard event
Trait Implementations§
Source§impl Clone for ClickEvent
impl Clone for ClickEvent
Source§fn clone(&self) -> ClickEvent
fn clone(&self) -> ClickEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClickEvent
impl Debug for ClickEvent
Auto Trait Implementations§
impl Freeze for ClickEvent
impl RefUnwindSafe for ClickEvent
impl Send for ClickEvent
impl Sync for ClickEvent
impl Unpin for ClickEvent
impl UnwindSafe for ClickEvent
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<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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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>
ReadEndian::read_from_little_endian().