pub struct AdaptEventCx<'a: 'b, 'b> { /* private fields */ }Expand description
Implementations§
Source§impl<'a: 'b, 'b> AdaptEventCx<'a, 'b>
impl<'a: 'b, 'b> AdaptEventCx<'a, 'b>
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
Check whether this widget is disabled
Sourcepub fn set_disabled(&mut self, state: bool)
pub fn set_disabled(&mut self, state: bool)
Set/unset disabled status for this widget
Sourcepub fn request_timer(&mut self, handle: TimerHandle, delay: Duration)
pub fn request_timer(&mut self, handle: TimerHandle, delay: Duration)
Schedule a timed update
Widget updates may be used for delayed action. For animation, prefer to
use Draw::animate or
Self::request_frame_timer.
This widget will receive an update for timer handle at
approximately time = now + delay (or possibly a little later due to
frame-rate limiters and processing time).
Requesting an update with delay == 0 is valid except from a timer
handler where it may cause an infinite loop.
Multiple timer requests with the same id and handle are merged
(see TimerHandle documentation).
Sourcepub fn request_frame_timer(&mut self, handle: TimerHandle)
pub fn request_frame_timer(&mut self, handle: TimerHandle)
Schedule a frame timer update
Widget id will receive Event::Timer with this handle either
before or soon after the next frame is drawn.
This may be useful for animations which mutate widget state. Animations
which don’t mutate widget state may use
Draw::animate instead.
It is expected that handle.earliest() == true (style guide).
Methods from Deref<Target = EventState>§
Sourcepub fn has_input_focus(&self, w_id: &Id) -> Option<bool>
pub fn has_input_focus(&self, w_id: &Id) -> Option<bool>
Get whether this widget has input focus
Return values:
Noneif the widget does not have selection focusSome(false)if the widget has selection focus but not keyboard or IME focusSome(true)if the widget has keyboard and/or IME focus
Sourcepub fn modifiers(&self) -> ModifiersState
pub fn modifiers(&self) -> ModifiersState
Get the current modifier state
Get whether this widget has navigation focus
Get the current navigation focus, if any
This is the widget selected by navigating the UI with the Tab key.
Note: changing navigation focus (e.g. via EventCx::clear_nav_focus,
EventCx::request_nav_focus or EventCx::next_nav_focus) does not
immediately affect the result of this method.
Sourcepub fn is_depressed(&self, w_id: &Id) -> bool
pub fn is_depressed(&self, w_id: &Id) -> bool
Check whether the given widget is visually depressed
Sourcepub fn is_under_mouse(&self, w_id: &Id) -> bool
pub fn is_under_mouse(&self, w_id: &Id) -> bool
Get whether the widget is under the mouse pointer
Sourcepub fn any_grab_on(&self, id: &Id) -> bool
pub fn any_grab_on(&self, id: &Id) -> bool
Returns true if there is a mouse or touch grab on id or any descendant of id
Sourcepub fn press_velocity(&self, source: PressSource) -> Option<Vec2>
pub fn press_velocity(&self, source: PressSource) -> Option<Vec2>
Get velocity of the mouse pointer or a touch
The velocity is calculated at the time this method is called using existing samples of motion.
Where the source is a mouse this always succeeds.
For touch events this requires an active grab and is not
guaranteed to succeed; currently only a limited number of presses with
mode GrabMode::Grab are tracked for velocity.
Sourcepub fn window_has_focus(&self) -> bool
pub fn window_has_focus(&self) -> bool
True when the window has focus
Sourcepub fn is_disabled(&self, w_id: &Id) -> bool
pub fn is_disabled(&self, w_id: &Id) -> bool
Check whether a widget is disabled
A widget is disabled if any ancestor is.
Sourcepub fn config(&self) -> &WindowConfig
pub fn config(&self) -> &WindowConfig
Access configuration data
All widgets will be reconfigured if configuration data changes.
Sourcepub fn config_enable_pan(&self, source: PressSource) -> bool
pub fn config_enable_pan(&self, source: PressSource) -> bool
Is mouse panning enabled?
Sourcepub fn config_enable_mouse_text_pan(&self) -> bool
pub fn config_enable_mouse_text_pan(&self) -> bool
Is mouse text panning enabled?
Sourcepub fn config_test_pan_thresh(&self, dist: Offset) -> bool
pub fn config_test_pan_thresh(&self, dist: Offset) -> bool
Test pan threshold against config, adjusted for scale factor
Returns true when dist is large enough to switch to pan mode.
Trait Implementations§
Source§impl<'a: 'b, 'b> Deref for AdaptEventCx<'a, 'b>
impl<'a: 'b, 'b> Deref for AdaptEventCx<'a, 'b>
Auto Trait Implementations§
impl<'a, 'b> !RefUnwindSafe for AdaptEventCx<'a, 'b>
impl<'a, 'b> !Send for AdaptEventCx<'a, 'b>
impl<'a, 'b> !Sync for AdaptEventCx<'a, 'b>
impl<'a, 'b> !UnwindSafe for AdaptEventCx<'a, 'b>
impl<'a, 'b> Freeze for AdaptEventCx<'a, 'b>
impl<'a, 'b> Unpin for AdaptEventCx<'a, 'b>
impl<'a, 'b> UnsafeUnpin for AdaptEventCx<'a, 'b>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.