Skip to main content

VisualView

Struct VisualView 

Source
pub struct VisualView<S: Spec> { /* private fields */ }
Expand description

Read-only per-window truth of this frame, built at the start of the compose phase (design §5.2, read path a).

Owned, not borrowed: the compose phase mutates the input engine (registrations) while hooks hold the view, so the engine views cannot be lent out; the copied state is exactly what the engines reported at phase start, which is the same-tick truth the design asks the view to be. Clicks are the last evaluated frame’s (a release is evaluated by the EndFrame of the compose that saw it and read back from the next compose on — one frame of latency, like every retained-registration immediate-mode UI).

Implementations§

Source§

impl<S: Spec> VisualView<S>

Source

pub fn hovered(&self) -> Option<&WidgetId>

The widget under the pointer, if any.

Source

pub fn is_hovered(&self, id: &WidgetId) -> bool

id is under the pointer.

Source

pub fn pressed(&self) -> Option<&WidgetId>

The widget being pressed, if any.

Source

pub fn is_pressed(&self, id: &WidgetId) -> bool

id is being pressed.

Source

pub fn focused(&self) -> Option<&WidgetId>

The widget with keyboard focus, if any.

Source

pub fn is_focused(&self, id: &WidgetId) -> bool

id has keyboard focus.

Source

pub fn clicked(&self, id: &WidgetId) -> bool

id was clicked in the last evaluated frame (single, double or triple — see VisualView::click_count).

Source

pub fn click_count(&self, id: &WidgetId) -> u8

The click count id was last clicked with (0 = not clicked, 1 single, 2 double, 3 triple).

Source

pub fn clicks(&self) -> &[(WidgetId, u8)]

Every widget clicked in the last evaluated frame, with counts.

Source

pub fn scroll(&self) -> (f64, f64)

Scroll delta accumulated for this frame, in lines.

Source

pub fn captured(&self) -> bool

The pointer is captured by a widget or an engine.

Source

pub fn overlay_open(&self, id: S::Overlay) -> bool

This overlay is open in the window.

Source

pub fn open_overlays(&self) -> &[S::Overlay]

Every open overlay of the window, bottom to top.

Trait Implementations§

Source§

impl<S: Spec> Default for VisualView<S>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<S> Freeze for VisualView<S>
where Vec<<S as Spec>::Overlay>: Freeze,

§

impl<S> RefUnwindSafe for VisualView<S>
where Vec<<S as Spec>::Overlay>: RefUnwindSafe,

§

impl<S> Send for VisualView<S>
where Vec<<S as Spec>::Overlay>: Send,

§

impl<S> Sync for VisualView<S>
where Vec<<S as Spec>::Overlay>: Sync,

§

impl<S> Unpin for VisualView<S>
where Vec<<S as Spec>::Overlay>: Unpin,

§

impl<S> UnsafeUnpin for VisualView<S>
where Vec<<S as Spec>::Overlay>: UnsafeUnpin,

§

impl<S> UnwindSafe for VisualView<S>
where Vec<<S as Spec>::Overlay>: UnwindSafe,

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