Skip to main content

FocusableActionDetector

Struct FocusableActionDetector 

Source
pub struct FocusableActionDetector {
Show 14 fields pub key: Option<KeyRef>, pub enabled: bool, pub focus_node: Option<FocusNodeRef>, pub autofocus: bool, pub descendants_are_focusable: bool, pub descendants_are_traversable: bool, pub actions: Option<HashMap<TypeId, ActionRef>>, pub shortcuts: Option<ShortcutMap>, pub on_show_focus_highlight: Option<ValueChanged<bool>>, pub on_show_hover_highlight: Option<ValueChanged<bool>>, pub on_focus_change: Option<ValueChanged<bool>>, pub mouse_cursor: MouseCursorRef, pub include_focus_semantics: bool, pub child: WidgetRef,
}
Expand description

A widget that combines the functionality of Actions, Shortcuts, MouseRegion and a Focus widget to create a detector that defines actions and key bindings, and provides callbacks for handling focus and hover highlights.

This widget can be used to give a control the required detection modes for focus and hover handling. It is most often used when authoring a new control widget, and the new control should be enabled for keyboard traversal and activation.

This widget doesn’t have any visual representation, it is just a detector that provides focus and hover capabilities.

It hosts its own FocusNode or uses focus_node, if given.

Fields§

§key: Option<KeyRef>§enabled: bool

Is this widget enabled or not.

If disabled, will not send any notifications needed to update highlight or focus state, and will not define or respond to any actions or shortcuts.

When disabled, adds Focus to the widget tree, but sets Focus::can_request_focus to false.

§focus_node: Option<FocusNodeRef>

An optional focus node to use as the focus node for this widget.

§autofocus: bool

True if this widget will be selected as the initial focus when no other node in its scope is currently focused.

§descendants_are_focusable: bool

If false, will make this widget’s descendants unfocusable.

§descendants_are_traversable: bool

If false, will make this widget’s descendants untraversable.

§actions: Option<HashMap<TypeId, ActionRef>>

A map of Intent types to Action objects that defines which actions this widget knows about.

§shortcuts: Option<ShortcutMap>

The map of shortcuts that describes the mapping between a key sequence defined by a ShortcutActivator and the Intent that will be emitted when that key sequence is pressed.

§on_show_focus_highlight: Option<ValueChanged<bool>>

A function that will be called when the focus highlight should be shown or hidden.

This method is not triggered at the unmount of the widget.

§on_show_hover_highlight: Option<ValueChanged<bool>>

A function that will be called when the hover highlight should be shown or hidden.

This method is not triggered at the unmount of the widget.

§on_focus_change: Option<ValueChanged<bool>>

A function that will be called when the focus changes.

Called with true if the focus_node has primary focus.

§mouse_cursor: MouseCursorRef

The cursor for a mouse pointer when it enters or is hovering over the widget.

The mouse_cursor defaults to MouseCursor.defer, deferring the choice of cursor to the next region behind it in hit-test order.

§include_focus_semantics: bool

Whether to include semantics from Focus.

Defaults to true.

§child: WidgetRef

The child widget for this FocusableActionDetector widget.

Implementations§

Source§

impl FocusableActionDetector

Source

pub fn new<K>(child: impl IntoWidget<K>) -> FocusableActionDetector

Source

pub fn key(self, key: KeyRef) -> FocusableActionDetector

Dart FocusableActionDetector(key:).

Source

pub fn enabled(self, enabled: bool) -> FocusableActionDetector

Dart FocusableActionDetector(enabled:).

Source

pub fn focus_node(self, focus_node: FocusNodeRef) -> FocusableActionDetector

Dart FocusableActionDetector(focusNode:).

Source

pub fn autofocus(self, autofocus: bool) -> FocusableActionDetector

Dart FocusableActionDetector(autofocus:).

Source

pub fn descendants_are_focusable( self, descendants_are_focusable: bool, ) -> FocusableActionDetector

Dart FocusableActionDetector(descendantsAreFocusable:).

Source

pub fn descendants_are_traversable( self, descendants_are_traversable: bool, ) -> FocusableActionDetector

Dart FocusableActionDetector(descendantsAreTraversable:).

Source

pub fn actions( self, actions: HashMap<TypeId, ActionRef>, ) -> FocusableActionDetector

Dart FocusableActionDetector(actions:).

Source

pub fn shortcuts(self, shortcuts: ShortcutMap) -> FocusableActionDetector

Dart FocusableActionDetector(shortcuts:).

Source

pub fn on_show_focus_highlight( self, on_show_focus_highlight: impl Fn(&mut App, bool) + 'static, ) -> FocusableActionDetector

Dart FocusableActionDetector(onShowFocusHighlight:).

Source

pub fn on_show_hover_highlight( self, on_show_hover_highlight: impl Fn(&mut App, bool) + 'static, ) -> FocusableActionDetector

Dart FocusableActionDetector(onShowHoverHighlight:).

Source

pub fn on_focus_change( self, on_focus_change: impl Fn(&mut App, bool) + 'static, ) -> FocusableActionDetector

Dart FocusableActionDetector(onFocusChange:).

Source

pub fn mouse_cursor( self, mouse_cursor: MouseCursorRef, ) -> FocusableActionDetector

Dart FocusableActionDetector(mouseCursor:).

Source

pub fn include_focus_semantics( self, include_focus_semantics: bool, ) -> FocusableActionDetector

Dart FocusableActionDetector(includeFocusSemantics:).

Trait Implementations§

Source§

impl Debug for FocusableActionDetector

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl StatefulWidget for FocusableActionDetector

Source§

type State = FocusableActionDetectorState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> FocusableActionDetectorState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn debug_check_constructor(&self)

Source§

fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for FocusableActionDetector

§

impl !Send for FocusableActionDetector

§

impl !Sync for FocusableActionDetector

§

impl !UnwindSafe for FocusableActionDetector

§

impl Forget for FocusableActionDetector

§

impl Freeze for FocusableActionDetector
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, NonZero<u32>: Freeze, &'static FocusNodeVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const u8 is !null: Freeze, PhantomData<(TypeId, Retained<AnyAction>)>: Freeze, PhantomData<(Rc<dyn ShortcutActivator>, Rc<dyn Intent>)>: Freeze, *const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze, *const RcInner<dyn MouseCursor> is !null: Freeze, PhantomData<RcInner<dyn MouseCursor>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for FocusableActionDetector

§

impl Unpin for FocusableActionDetector
where Rc<dyn Key>: Unpin, NonZero<u32>: Unpin, &'static FocusNodeVTable: Unpin, Rc<Keep>: Unpin, *const u8 is !null: Unpin, *const (): Unpin, &'static ActionVTable: Unpin, Rc<dyn ShortcutActivator>: Unpin, Rc<dyn Intent>: Unpin, Rc<dyn Fn(&mut App, bool)>: Unpin, Rc<dyn MouseCursor>: Unpin, Rc<dyn Widget>: Unpin,

§

impl UnsafeUnpin for FocusableActionDetector
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static FocusNodeVTable: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(TypeId, Retained<AnyAction>)>: UnsafeUnpin, PhantomData<(Rc<dyn ShortcutActivator>, Rc<dyn Intent>)>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin, *const RcInner<dyn MouseCursor> is !null: UnsafeUnpin, PhantomData<RcInner<dyn MouseCursor>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>