Struct zng_ext_input::gesture::ClickArgs
source · pub struct ClickArgs {
pub timestamp: DInstant,
pub window_id: WindowId,
pub device_id: Option<DeviceId>,
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: DInstant
Instant the event happened.
window_id: WindowId
Id of window that received the event.
device_id: Option<DeviceId>
Id of device that generated the event.
Is None
if the event was generated programmatically.
source: ClickArgsSource
Specific info from the source of this event.
click_count: NonZeroU32
Sequential 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: bool
If the event was auto-generated by holding the key or button pressed.
modifiers: ModifiersState
What modifier keys where pressed when this event happened.
target: InteractionPath
The 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<DeviceId>>,
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<DeviceId>>, 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<DeviceId>>,
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<DeviceId>>, 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_enabled(&self, widget_id: WidgetId) -> bool
pub fn is_enabled(&self, widget_id: WidgetId) -> bool
Returns true
if the widget is enabled in target
.
sourcepub fn is_disabled(&self, widget_id: WidgetId) -> bool
pub fn is_disabled(&self, widget_id: WidgetId) -> bool
Returns true
if the widget is disabled in target
.
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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