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,
pub propagation: EventPropagationHandle,
}Expand description
FOCUS_CHANGED_EVENT arguments.
Fields§
§timestamp: DInstantInstant the event happened.
prev_focus: Option<InteractionPath>Previously focused widget.
new_focus: Option<InteractionPath>Newly focused widget.
highlight: boolIf 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: FocusChangedCauseWhat caused this event.
Focus navigation actions that can move the focus away from the new_focus.
propagation: EventPropagationHandlePropagation handle associated with this event instance.
Cloned arguments share the same handle, some arguments may also share the handle of another event if they share the same cause.
Implementations§
Source§impl FocusChangedArgs
impl FocusChangedArgs
Sourcepub fn new(
timestamp: impl Into<DInstant>,
propagation: 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: 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 the focus nor the parent of the previous focus.
Sourcepub fn is_focus_enter_enabled(&self, widget_id: WidgetId) -> bool
pub fn is_focus_enter_enabled(&self, widget_id: WidgetId) -> bool
If widget_id is the new focus or a parent of the new focus and is enabled;
and was not the focus nor the parent of the previous focus or was not enabled.
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 the new focus nor a parent of the new focus.
Sourcepub fn is_focus_leave_enabled(&self, widget_id: WidgetId) -> bool
pub fn is_focus_leave_enabled(&self, widget_id: WidgetId) -> bool
If widget_id is the previous focus or a parent of the previous focus and was enabled;
and is not the new focus nor a parent of the new focus or is disabled.
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 is_in_target(&self, id: WidgetId) -> bool
fn is_in_target(&self, id: WidgetId) -> bool
If is in prev_focus or new_focus.
Source§fn propagation(&self) -> &EventPropagationHandle
fn propagation(&self) -> &EventPropagationHandle
Source§fn clone_boxed(&self) -> Box<dyn AnyEventArgs>
fn clone_boxed(&self) -> Box<dyn AnyEventArgs>
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
Source§impl PartialEq for FocusChangedArgs
impl PartialEq for FocusChangedArgs
impl EventArgs for FocusChangedArgs
impl StructuralPartialEq 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> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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