Skip to main content

ViewProps

Struct ViewProps 

Source
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: PointerEvents

Which touches the view and its subtree receive.

§hit_slop: EdgeInsets

Extends 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: Accessibility

Accessibility.

§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: bool

A 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: KeyCapture

Keys 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: bool

The 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.

§selection_menu: Arc<[MenuItem]>

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: bool

The 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

Source

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.

Trait Implementations§

Source§

impl Clone for ViewProps

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ViewProps

Source§

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

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

impl Default for ViewProps

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ViewProps

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ViewProps

Auto Trait Implementations§

§

impl !RefUnwindSafe for ViewProps

§

impl !UnwindSafe for ViewProps

§

impl Forget for ViewProps

§

impl Freeze for ViewProps
where *const ArcInner<str> is !null: Freeze, PhantomData<ArcInner<str>>: Freeze, *const u8 is !null: Freeze, PhantomData<AccessibilityActionDef>: Freeze, *const ArcInner<[Keystroke]> is !null: Freeze, PhantomData<ArcInner<[Keystroke]>>: Freeze, *const ArcInner<[MenuItem]> is !null: Freeze, PhantomData<ArcInner<[MenuItem]>>: Freeze,

§

impl Move for ViewProps

§

impl Send for ViewProps
where Arc<str>: Send, RawVecInner: Send, Arc<[Keystroke]>: Send, Arc<[MenuItem]>: Send,

§

impl Sync for ViewProps
where Arc<str>: Sync, RawVecInner: Sync, Arc<[Keystroke]>: Sync, Arc<[MenuItem]>: Sync,

§

impl Unpin for ViewProps
where Arc<str>: Unpin, *const u8 is !null: Unpin, Arc<[Keystroke]>: Unpin, Arc<[MenuItem]>: Unpin,

§

impl UnsafeUnpin for ViewProps

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.