Skip to main content

SelectionToolbarRequest

Struct SelectionToolbarRequest 

Source
pub struct SelectionToolbarRequest {
    pub anchor: Rect,
    pub actions: SelectionToolbarActions,
    pub present_menu: bool,
}
Expand description

One focused field’s published “here is my selection, these verbs apply to it, and this is whether a menu is wanted over it right now”.

Published per paint pass by every focused field, with or without a selection; a pass without one means no field holds the focus. Two facts of different shapes travel together here: anchor and actions are a level — the state of the field as it stands this frame, which a platform responder chain must be able to read at any moment — while present_menu is the edge that asks for a menu to go up.

Fields§

§anchor: Rect

The selection’s bounding rect in absolute logical window space — the same space an OverlayEntry::window_rect uses, so a framework toolbar can be placed against it directly and a native menu can be anchored to it after the shell’s own scale conversion.

Falls back to the caret rect while the selection is collapsed, which is the right anchor for a paste-only menu.

§actions: SelectionToolbarActions

Which verbs apply. A level: computed from the field’s own state, not from whether any bar is up, so a hardware Cmd+C arriving with nothing on screen still finds an answer here.

§present_menu: bool

Whether the field wants a menu presented now — the one edge in an otherwise level-shaped request.

A field raises this when a gesture asks for the bar (a long press, a secondary press) and drops it again when the bar is dismissed, while it keeps republishing the same anchor and verbs either way. It is what RenderRoot::selection_toolbar_generation moves on, together with actions — an anchor that merely follows a growing selection must not ask a platform to re-present its menu.

Trait Implementations§

Source§

impl Clone for SelectionToolbarRequest

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 Copy for SelectionToolbarRequest

Source§

impl Debug for SelectionToolbarRequest

Source§

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

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

impl PartialEq for SelectionToolbarRequest

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 SelectionToolbarRequest

Auto Trait Implementations§

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> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
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.