pub struct FocusHandle {
pub tab_index: isize,
pub tab_stop: bool,
/* private fields */
}Expand description
A handle which can be used to track and manipulate the focused element in a window.
Fields§
§tab_index: isizeThe index of this element in the tab order.
tab_stop: boolWhether this element can be focused by tab navigation.
Implementations§
Source§impl FocusHandle
impl FocusHandle
Sourcepub fn tab_index(self, index: isize) -> Self
pub fn tab_index(self, index: isize) -> Self
Sets the tab index of the element associated with this handle.
Sourcepub fn tab_stop(self, tab_stop: bool) -> Self
pub fn tab_stop(self, tab_stop: bool) -> Self
Sets whether the element associated with this handle is a tab stop.
When false, the element will not be included in the tab order.
Sourcepub fn downgrade(&self) -> WeakFocusHandle
pub fn downgrade(&self) -> WeakFocusHandle
Converts this focus handle into a weak variant, which does not prevent it from being released.
Sourcepub fn focus(&self, window: &mut Window)
pub fn focus(&self, window: &mut Window)
Moves the focus to the element associated with this handle.
Sourcepub fn is_focused(&self, window: &Window) -> bool
pub fn is_focused(&self, window: &Window) -> bool
Obtains whether the element associated with this handle is currently focused.
Sourcepub fn contains_focused(&self, window: &Window, cx: &App) -> bool
pub fn contains_focused(&self, window: &Window, cx: &App) -> bool
Obtains whether the element associated with this handle contains the focused element or is itself focused.
Sourcepub fn within_focused(&self, window: &Window, cx: &mut App) -> bool
pub fn within_focused(&self, window: &Window, cx: &mut App) -> bool
Obtains whether the element associated with this handle is contained within the focused element or is itself focused.
Sourcepub fn contains(&self, other: &Self, window: &Window) -> bool
pub fn contains(&self, other: &Self, window: &Window) -> bool
Obtains whether this handle contains the given handle in the most recently rendered frame.
Sourcepub fn dispatch_action(
&self,
action: &dyn Action,
window: &mut Window,
cx: &mut App,
)
pub fn dispatch_action( &self, action: &dyn Action, window: &mut Window, cx: &mut App, )
Dispatch an action on the element that rendered this focus handle
Trait Implementations§
Source§impl Clone for FocusHandle
impl Clone for FocusHandle
Source§impl Debug for FocusHandle
impl Debug for FocusHandle
Source§impl Drop for FocusHandle
impl Drop for FocusHandle
Source§impl<'a> From<&'a FocusHandle> for ElementId
impl<'a> From<&'a FocusHandle> for ElementId
Source§fn from(handle: &'a FocusHandle) -> Self
fn from(handle: &'a FocusHandle) -> Self
Source§impl PartialEq<FocusHandle> for WeakFocusHandle
impl PartialEq<FocusHandle> for WeakFocusHandle
Source§impl PartialEq<WeakFocusHandle> for FocusHandle
impl PartialEq<WeakFocusHandle> for FocusHandle
Source§impl PartialEq for FocusHandle
impl PartialEq for FocusHandle
impl Eq for FocusHandle
Auto Trait Implementations§
impl Freeze for FocusHandle
impl !RefUnwindSafe for FocusHandle
impl Send for FocusHandle
impl Sync for FocusHandle
impl Unpin for FocusHandle
impl !UnwindSafe for FocusHandle
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§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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