Struct Composed
pub struct Composed { /* private fields */ }Expand description
A widget’s composition: the element tree it rebuilds at every layout and lays out as the only child of its own node, plus the box it was given and whether the owner asked for a rebuild. The owning widget forwards its tree methods here.
Implementations§
§impl Composed
impl Composed
pub fn build_layout(
&mut self,
element: Box<dyn Widget>,
taffy: &mut TaffyTree,
theme: &Theme,
node_map: &mut HashMap<NodeId, *mut dyn Widget>,
) -> NodeId
pub fn build_layout( &mut self, element: Box<dyn Widget>, taffy: &mut TaffyTree, theme: &Theme, node_map: &mut HashMap<NodeId, *mut dyn Widget>, ) -> NodeId
Lay out a freshly built element, replacing the previous
composition. Returns its node, the only child of the owner’s.
pub fn replace(
&mut self,
element: Box<dyn Widget>,
) -> &mut (dyn Widget + 'static)
pub fn replace( &mut self, element: Box<dyn Widget>, ) -> &mut (dyn Widget + 'static)
Swap in element without laying it out.
pub fn take(&mut self) -> Option<Box<dyn Widget>>
pub fn take(&mut self) -> Option<Box<dyn Widget>>
Take the composition out, for an owner that keeps it across layouts
and lays it out again with Self::build_layout.
pub fn invalidate(&mut self)
pub fn invalidate(&mut self)
Rebuild the composition at the next layout: the owner’s state that it is built from changed. A fresh composition settles it.
pub fn clear(&mut self)
pub fn clear(&mut self)
Drop the composition until the next layout builds a fresh one.
pub fn apply_layout(&mut self, taffy: &TaffyTree, node: NodeId, origin: Point)
pub fn apply_layout(&mut self, taffy: &TaffyTree, node: NodeId, origin: Point)
Store the owner’s box and place the composition inside it.
pub fn element_mut(&mut self) -> Option<&mut (dyn Widget + 'static)>
pub fn element_mut(&mut self) -> Option<&mut (dyn Widget + 'static)>
The current composition, once built.
pub fn sync(&mut self, state: &(dyn Any + 'static), path: &(dyn Any + 'static))
pub fn draw( &mut self, scene: &mut Scene, transform: Affine, text_renderer: &mut TextRenderer, theme: &Theme, presence: &PresenceCtx, )
pub fn handle_event(&mut self, event: &WindowEvent, ctx: &mut EventCtx<'_>)
pub fn children(&self) -> Vec<&dyn Widget>
pub fn children_mut(&mut self) -> Vec<&mut dyn Widget>
pub fn take_structure_dirty(&mut self) -> bool
pub fn take_structure_dirty(&mut self) -> bool
Whether the owner invalidated the composition or the composition asked to be rebuilt. Reading clears both.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Composed
impl !RefUnwindSafe for Composed
impl !Send for Composed
impl !Sync for Composed
impl Unpin for Composed
impl UnsafeUnpin for Composed
impl !UnwindSafe for Composed
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more