Skip to main content

Mounted

Struct Mounted 

Source
pub struct Mounted { /* private fields */ }
Expand description

A widget tree mounted on a surface of a known size.

Implementations§

Source§

impl Mounted

Source

pub fn new(root: Box<dyn Widget>, width: f32, height: f32) -> Self

Mount root on a width x height surface. The tree is laid out at once, so the first event already hits the right bounds, and the first frame paints.

Source

pub fn dispatch(&mut self, event: &Event) -> bool

Give one input event to the tree. Any message a widget emits is queued for take_messages. Every event owes a repaint, because widgets change hover and pressed state without emitting a message. Returns whether a message was emitted.

Source

pub fn frame(&mut self) -> Frame

Run one frame tick. Every brick in the tree is verified before anything is painted; one failure anywhere blocks the whole frame (PROBAR-SPEC-009).

Source

pub fn set_animating(&mut self, animating: bool)

Repaint on every tick (a waveform, a video overlay) or only when dirty.

Source

pub fn request_repaint(&mut self)

Owe a repaint without an event (the app changed the tree).

Source

pub const fn needs_frame(&self) -> bool

Whether the next tick would paint.

Source

pub fn take_messages(&mut self) -> Vec<Box<dyn Any + Send>>

Messages emitted by widgets since the last call, oldest first.

Source

pub const fn frames_painted(&self) -> u64

Frames painted so far.

Source

pub fn root_mut(&mut self) -> &mut dyn Widget

The mounted tree, for the app to change between frames.

Source

pub fn set_root(&mut self, root: Box<dyn Widget>)

Replace the tree (the app rebuilt it from new state); lays it out and owes a repaint.

Source

pub const fn size(&self) -> Size

The surface size the tree is laid out for.

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