pub struct FocusChangedArgs {
pub timestamp: DInstant,
pub prev_focus: Option<InteractionPath>,
pub new_focus: Option<InteractionPath>,
pub highlight: bool,
pub cause: FocusChangedCause,
pub enabled_nav: FocusNavAction,
/* private fields */
}
Expand description
FOCUS_CHANGED_EVENT
arguments.
Fields§
§timestamp: DInstant
Instant the event happened.
prev_focus: Option<InteractionPath>
Previously focused widget.
new_focus: Option<InteractionPath>
Newly focused widget.
highlight: bool
If the focused widget should visually indicate that it is focused.
This is true
when the focus change is caused by a key press, false
when it is caused by a mouse click.
Some widgets, like text input, may ignore this field and always indicate that they are focused.
cause: FocusChangedCause
What caused this event.
Focus navigation actions that can move the focus away from the new_focus
.
Implementations§
source§impl FocusChangedArgs
impl FocusChangedArgs
sourcepub fn new(
timestamp: impl Into<DInstant>,
propagation_handle: EventPropagationHandle,
prev_focus: impl Into<Option<InteractionPath>>,
new_focus: impl Into<Option<InteractionPath>>,
highlight: impl Into<bool>,
cause: impl Into<FocusChangedCause>,
enabled_nav: impl Into<FocusNavAction>,
) -> Self
pub fn new( timestamp: impl Into<DInstant>, propagation_handle: EventPropagationHandle, prev_focus: impl Into<Option<InteractionPath>>, new_focus: impl Into<Option<InteractionPath>>, highlight: impl Into<bool>, cause: impl Into<FocusChangedCause>, enabled_nav: impl Into<FocusNavAction>, ) -> Self
New args from values that convert into the argument types.
sourcepub fn now(
prev_focus: impl Into<Option<InteractionPath>>,
new_focus: impl Into<Option<InteractionPath>>,
highlight: impl Into<bool>,
cause: impl Into<FocusChangedCause>,
enabled_nav: impl Into<FocusNavAction>,
) -> Self
pub fn now( prev_focus: impl Into<Option<InteractionPath>>, new_focus: impl Into<Option<InteractionPath>>, highlight: impl Into<bool>, cause: impl Into<FocusChangedCause>, enabled_nav: impl Into<FocusNavAction>, ) -> Self
Arguments for event that happened now (INSTANT.now
).
source§impl FocusChangedArgs
impl FocusChangedArgs
sourcepub fn is_widget_move(&self) -> bool
pub fn is_widget_move(&self) -> bool
If the focus is still in the same widget, but the widget path changed.
sourcepub fn is_enabled_change(&self) -> bool
pub fn is_enabled_change(&self) -> bool
If the focus is still in the same widget path, but some or all interactivity has changed.
sourcepub fn is_highlight_changed(&self) -> bool
pub fn is_highlight_changed(&self) -> bool
If the focus is still in the same widget but highlight
changed.
sourcepub fn is_focus(&self, widget_id: WidgetId) -> bool
pub fn is_focus(&self, widget_id: WidgetId) -> bool
If widget_id
is the new focus and was not before.
sourcepub fn is_blur(&self, widget_id: WidgetId) -> bool
pub fn is_blur(&self, widget_id: WidgetId) -> bool
If widget_id
is the previous focus and is not now.
sourcepub fn is_focus_enter(&self, widget_id: WidgetId) -> bool
pub fn is_focus_enter(&self, widget_id: WidgetId) -> bool
If widget_id
is the new focus or a parent of the new focus and was not a parent of the previous focus.
sourcepub fn is_focus_leave(&self, widget_id: WidgetId) -> bool
pub fn is_focus_leave(&self, widget_id: WidgetId) -> bool
If widget_id
is the previous focus or a parent of the previous focus and is not a parent of the new focus.
sourcepub fn is_focused(&self, widget_id: WidgetId) -> bool
pub fn is_focused(&self, widget_id: WidgetId) -> bool
If the widget is the new focus.
sourcepub fn is_focus_within(&self, widget_id: WidgetId) -> bool
pub fn is_focus_within(&self, widget_id: WidgetId) -> bool
If the widget is in the new focus path.
Trait Implementations§
source§impl AnyEventArgs for FocusChangedArgs
impl AnyEventArgs for FocusChangedArgs
source§fn delivery_list(&self, list: &mut UpdateDeliveryList)
fn delivery_list(&self, list: &mut UpdateDeliveryList)
The prev_focus
and new_focus
.
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 Clone for FocusChangedArgs
impl Clone for FocusChangedArgs
source§fn clone(&self) -> FocusChangedArgs
fn clone(&self) -> FocusChangedArgs
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FocusChangedArgs
impl Debug for FocusChangedArgs
Auto Trait Implementations§
impl Freeze for FocusChangedArgs
impl RefUnwindSafe for FocusChangedArgs
impl Send for FocusChangedArgs
impl Sync for FocusChangedArgs
impl Unpin for FocusChangedArgs
impl UnwindSafe for FocusChangedArgs
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