pub struct ViewProps {Show 24 fields
pub overlay_anchor: Option<PlacedAnchor>,
pub tab_after: Option<NodeId>,
pub screen_order: Option<Axis>,
pub pointer_events: PointerEvents,
pub hit_slop: EdgeInsets,
pub long_press_delay: Option<f32>,
pub ripple: Option<Ripple>,
pub accessibility: Accessibility,
pub test_id: Option<Arc<str>>,
pub native_id: Option<Arc<str>>,
pub web_element: Option<WebElement>,
pub href: Option<Arc<str>>,
pub pan_activation: Option<PanActivation>,
pub pan_scroll_handoff: bool,
pub window_drag: Option<bool>,
pub window_control: Option<WindowControl>,
pub window_resize: Option<ResizeEdge>,
pub focusable: Option<bool>,
pub key_capture: KeyCapture,
pub key_parent: Option<NodeId>,
pub selectable_view: bool,
pub selection_menu: Arc<[MenuItem]>,
pub continues_text: bool,
pub scroll_edge_element: Option<ScrollEdgeElement>,
/* private fields */
}Expand description
Non-style properties of a view that only the platform needs.
Fields§
§overlay_anchor: Option<PlacedAnchor>Resolved overlay placement for native grid projection; ordinary views have none.
tab_after: Option<NodeId>A shown overlay’s place in the Tab order: right after this view
and before its children, where the app put the overlay (a popover’s
content follows its trigger), not at the end of the root view its
native view is in. Set by the core; platforms that order Tab
themselves walk with crate::input::tab_order.
screen_order: Option<Axis>Tab and screen readers go through the view’s children as they are on screen, along this axis and then across it, instead of in tree order. The core sets it on a list in its parent’s viewport: a list recycles its cells, so in the tree they are not in their rows’ order. Scroll views read their content so without it.
pointer_events: PointerEventsWhich touches the view and its subtree receive.
hit_slop: EdgeInsetsExtends the touch area beyond the view’s bounds.
long_press_delay: Option<f32>Milliseconds before a press becomes a long press (platform default
when None).
ripple: Option<Ripple>Ripple while pressed (Android).
accessibility: AccessibilityAccessibility.
test_id: Option<Arc<str>>testID: an identifier for UI tests.
native_id: Option<Arc<str>>nativeID: names the view for the embedding app’s native code (a
watched scroll view, watchScroll), apart from testID, which is
for tests.
web_element: Option<WebElement>web={{ element }}: the HTML element the web draws the view as.
href: Option<Arc<str>>Where the view goes as a link (Link’s href): data for the
platform, never shown or read to accessibility clients. A terminal
draws the text inside the view as an OSC 8 hyperlink to it. A
span’s (TextView’s links) goes into its block’s text instead
(AttributedText::link_hrefs).
pan_activation: Option<PanActivation>panActivation: the view’s touch responder waits for a pan the
platform recognizes.
pan_scroll_handoff: boolA vertical pan cooperates with descendant scroll views on iOS.
window_drag: Option<bool>windowDrag (desktops): pressing the view drags the window; None
leaves it to the views around it.
window_control: Option<WindowControl>windowControl (desktops): the system window button the view acts
as.
window_resize: Option<ResizeEdge>windowResize (desktops): the edge or corner of a frameless window
pressing the view resizes it by.
focusable: Option<bool>focusable: whether the view is a stop of the keyboard focus (Tab):
Some(true) makes any view one, whether or not it takes presses (a
chart, a slider, a list that moves its selection with the arrow
keys); Some(false) keeps a view that takes presses out; None, the
default, leaves it to the presses (ViewProps::focus_stop).
key_capture: KeyCaptureKeys consumed by this view or a focused descendant before native
defaults run. Backends decide from the mounted rules without
waiting for a listener (Interactive::capture_keys).
key_parent: Option<NodeId>Where keyboard ancestry continues for a portaled view (an overlay
whose native parent is its root view while its logical parent is
the view it is in): the logical parent’s node id. Internal routing
only; native layout, focus and hit testing keep their parent. None
for ordinary views and for portals with no key listener or capture
rule on their logical ancestry.
selectable_view: boolThe view is a selectable view (View’s selectable): the
texts in its subtree that are not selectable={false} share one
selection, from text to text (crate::selection); an area inside
another is part of the outer one. Texts outside areas select alone.
The app’s items of a selectable view’s selection menu, after the
system’s (selectionMenu): plain items and separators, each
action’s id reported as the root’s Menu event when chosen. The
selection’s menu takes the items of the outermost selectable view
around it (crate::desktop::MenuItem::selection_menu).
continues_text: boolThe text continues the text before it in document order, as a long
line’s next wrapped part (Element::continues_text): in a
selectable view a copy joins the two with nothing between them,
and a double or triple click selects across them
(crate::selection::SelectionTexts::continues).
scroll_edge_element: Option<ScrollEdgeElement>ios={{ scrollEdgeElement }}: the scroll view the view floats
over and the edge of it the view sits at. Resolved by the core from
the element the app names; None when it names none or that element
is gone.
Implementations§
Source§impl ViewProps
impl ViewProps
Sourcepub fn focus_stop(&self, takes_presses: bool) -> bool
pub fn focus_stop(&self, takes_presses: bool) -> bool
Whether a view with these props is a stop of the keyboard focus
(Tab and Shift+Tab reach it; it hears onFocus / onBlur and takes
the focus: styles), given whether it takes_presses (listens for
onPress): focusable decides when it is set, else taking presses
does; a disabled view is never one.
Focus and presses are separate: a stop that takes no presses is not pressed by Return or Space (its keys reach it through the app’s keymap while it has the focus), and a view needs no press handler to be focusable, which would take the presses of a pressable around it (a chart in a card that opens a page). Backends use this decision for view focus stops; inputs that edit are stops by their own rule, and each platform adds what it knows of visibility.