pub struct Mounted { /* private fields */ }Expand description
A widget tree mounted on a surface of a known size.
Implementations§
Source§impl Mounted
impl Mounted
Sourcepub fn new(root: Box<dyn Widget>, width: f32, height: f32) -> Self
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.
Sourcepub fn dispatch(&mut self, event: &Event) -> bool
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.
Sourcepub fn frame(&mut self) -> Frame
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).
Sourcepub fn set_animating(&mut self, animating: bool)
pub fn set_animating(&mut self, animating: bool)
Repaint on every tick (a waveform, a video overlay) or only when dirty.
Sourcepub fn request_repaint(&mut self)
pub fn request_repaint(&mut self)
Owe a repaint without an event (the app changed the tree).
Sourcepub const fn needs_frame(&self) -> bool
pub const fn needs_frame(&self) -> bool
Whether the next tick would paint.
Sourcepub fn take_messages(&mut self) -> Vec<Box<dyn Any + Send>>
pub fn take_messages(&mut self) -> Vec<Box<dyn Any + Send>>
Messages emitted by widgets since the last call, oldest first.
Sourcepub const fn frames_painted(&self) -> u64
pub const fn frames_painted(&self) -> u64
Frames painted so far.
Sourcepub fn root_mut(&mut self) -> &mut dyn Widget
pub fn root_mut(&mut self) -> &mut dyn Widget
The mounted tree, for the app to change between frames.