pub struct LongPressController { /* private fields */ }Expand description
Reports a press held in place for a delay.
Time advances only through Event::Tick, so the Widget must receive ticks (the
EventMask::TIMER class). The press is cancelled by a release, or by moving more than
slop pixels. It reports ControllerEvent::LongPressed at most once per press.
Implementations§
Source§impl LongPressController
impl LongPressController
Sourcepub const DEFAULT_DELAY: Duration
pub const DEFAULT_DELAY: Duration
The default hold time.
Sourcepub const DEFAULT_SLOP: u32 = 6
pub const DEFAULT_SLOP: u32 = 6
The default distance, in pixels, the pointer may wander during a long press.
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a controller for the left mouse button with the default delay and slop.
§Returns
The controller.
Sourcepub fn with_delay(delay: Duration) -> Self
pub fn with_delay(delay: Duration) -> Self
Trait Implementations§
Source§impl Controller for LongPressController
impl Controller for LongPressController
Source§fn handle(
&mut self,
widget: WidgetId,
event: &Event,
out: &mut Vec<ControllerEvent>,
)
fn handle( &mut self, widget: WidgetId, event: &Event, out: &mut Vec<ControllerEvent>, )
Examines one event and reports any result.
§Arguments
widget- The ID of the owningWidget.event- The event theWidgetreceived.out- Where results are pushed.
Source§fn event_mask(&self) -> EventMask
fn event_mask(&self) -> EventMask
Returns the event classes this controller needs.
§Returns
The mask added to the Widget’s event mask.
Auto Trait Implementations§
impl Freeze for LongPressController
impl RefUnwindSafe for LongPressController
impl Send for LongPressController
impl Sync for LongPressController
impl Unpin for LongPressController
impl UnsafeUnpin for LongPressController
impl UnwindSafe for LongPressController
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