pub struct ClickArgs {
pub timestamp: DInstant,
pub window_id: WindowId,
pub device_id: Option<InputDeviceId>,
pub source: ClickArgsSource,
pub click_count: NonZeroU32,
pub is_repeat: bool,
pub modifiers: ModifiersState,
pub target: InteractionPath,
/* private fields */
}Expand description
CLICK_EVENT arguments.
Fields§
§timestamp: DInstantInstant the event happened.
window_id: WindowIdId of window that received the event.
device_id: Option<InputDeviceId>Id of device that generated the event.
Is None if the event was generated programmatically.
source: ClickArgsSourceSpecific info from the source of this event.
click_count: NonZeroU32Sequential click count. Number 1 is single click, 2 is double click, etc.
Mouse clicks are translated directly, keyboard clicks are the key repeat count plus one.
is_repeat: boolIf the event was auto-generated by holding the key or button pressed.
modifiers: ModifiersStateWhat modifier keys where pressed when this event happened.
target: InteractionPathThe mouse input top-most hit or the focused element at the time of the key input.
Implementations§
Source§impl ClickArgs
impl ClickArgs
Sourcepub fn new(
timestamp: impl Into<DInstant>,
propagation_handle: EventPropagationHandle,
window_id: impl Into<WindowId>,
device_id: impl Into<Option<InputDeviceId>>,
source: impl Into<ClickArgsSource>,
click_count: impl Into<NonZeroU32>,
is_repeat: impl Into<bool>,
modifiers: impl Into<ModifiersState>,
target: impl Into<InteractionPath>,
) -> Self
pub fn new( timestamp: impl Into<DInstant>, propagation_handle: EventPropagationHandle, window_id: impl Into<WindowId>, device_id: impl Into<Option<InputDeviceId>>, source: impl Into<ClickArgsSource>, click_count: impl Into<NonZeroU32>, is_repeat: impl Into<bool>, modifiers: impl Into<ModifiersState>, target: impl Into<InteractionPath>, ) -> Self
New args from values that convert into the argument types.
Sourcepub fn now(
window_id: impl Into<WindowId>,
device_id: impl Into<Option<InputDeviceId>>,
source: impl Into<ClickArgsSource>,
click_count: impl Into<NonZeroU32>,
is_repeat: impl Into<bool>,
modifiers: impl Into<ModifiersState>,
target: impl Into<InteractionPath>,
) -> Self
pub fn now( window_id: impl Into<WindowId>, device_id: impl Into<Option<InputDeviceId>>, source: impl Into<ClickArgsSource>, click_count: impl Into<NonZeroU32>, is_repeat: impl Into<bool>, modifiers: impl Into<ModifiersState>, target: impl Into<InteractionPath>, ) -> Self
Arguments for event that happened now (INSTANT.now).
Source§impl ClickArgs
impl ClickArgs
Sourcepub fn is_primary(&self) -> bool
pub fn is_primary(&self) -> bool
If the event counts as primary click.
A primary click causes the default widget function interaction.
Returns true if the click source is a left mouse button click or a
primary click shortcut or a touch tap.
Sourcepub fn is_context(&self) -> bool
pub fn is_context(&self) -> bool
If the event counts as a context menu request.
Returns true if the click_count is 1 and the
click source is a right mouse button click or a context click shortcut
or a touch long press.
Sourcepub fn is_mouse_btn(&self, mouse_button: MouseButton) -> bool
pub fn is_mouse_btn(&self, mouse_button: MouseButton) -> bool
If the event was caused by a press of mouse_button.
Sourcepub fn is_single(&self) -> bool
pub fn is_single(&self) -> bool
If the click_count is 1.
Sourcepub fn is_double(&self) -> bool
pub fn is_double(&self) -> bool
If the click_count is 2.
Sourcepub fn is_triple(&self) -> bool
pub fn is_triple(&self) -> bool
If the click_count is 3.
Sourcepub fn is_from_mouse(&self) -> bool
pub fn is_from_mouse(&self) -> bool
If this event was generated by a mouse device.
Sourcepub fn is_from_touch(&self) -> bool
pub fn is_from_touch(&self) -> bool
If this event was generated by a touch device.
Sourcepub fn is_from_keyboard(&self) -> bool
pub fn is_from_keyboard(&self) -> bool
If this event was generated by a keyboard device.
Sourcepub fn is_from_access(&self) -> bool
pub fn is_from_access(&self) -> bool
If this event was generated by accessibility automation event.
Note that accessibility assistants can also simulate mouse click events, these events are not classified as accessibility sourced.
Trait Implementations§
Source§impl AnyEventArgs for ClickArgs
impl AnyEventArgs for ClickArgs
Source§fn delivery_list(&self, list: &mut UpdateDeliveryList)
fn delivery_list(&self, list: &mut UpdateDeliveryList)
The target.
Source§fn clone_any(&self) -> Box<dyn AnyEventArgs>
fn clone_any(&self) -> Box<dyn AnyEventArgs>
Source§fn propagation(&self) -> &EventPropagationHandle
fn propagation(&self) -> &EventPropagationHandle
Source§impl From<MouseClickArgs> for ClickArgs
impl From<MouseClickArgs> for ClickArgs
Source§fn from(args: MouseClickArgs) -> Self
fn from(args: MouseClickArgs) -> Self
Source§impl From<TouchLongPressArgs> for ClickArgs
impl From<TouchLongPressArgs> for ClickArgs
Source§fn from(args: TouchLongPressArgs) -> Self
fn from(args: TouchLongPressArgs) -> Self
Source§impl From<TouchTapArgs> for ClickArgs
impl From<TouchTapArgs> for ClickArgs
Source§fn from(args: TouchTapArgs) -> Self
fn from(args: TouchTapArgs) -> Self
Auto Trait Implementations§
impl Freeze for ClickArgs
impl RefUnwindSafe for ClickArgs
impl Send for ClickArgs
impl Sync for ClickArgs
impl Unpin for ClickArgs
impl UnwindSafe for ClickArgs
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more