pub struct Ui { /* private fields */ }
Expand description
The main access point for manipulating the UI.
Implementations
sourceimpl Ui
impl Ui
sourcepub fn poke<A: Any>(&mut self, node: Id, payload: &mut A) -> bool
pub fn poke<A: Any>(&mut self, node: Id, payload: &mut A) -> bool
Send an arbitrary payload to a widget. The type and interpretation of the payload depends on the specific target widget.
sourcepub fn add<W>(&mut self, widget: W, children: &[Id]) -> Idwhere
W: Widget + 'static,
pub fn add<W>(&mut self, widget: W, children: &[Id]) -> Idwhere
W: Widget + 'static,
Put a widget in the graph and add its children. Returns newly allocated id for the node.
pub fn set_root(&mut self, root: Id)
sourcepub fn add_listener<A, F>(&mut self, node: Id, f: F)where
A: Any,
F: FnMut(&mut A, ListenerCtx<'_>) + 'static,
pub fn add_listener<A, F>(&mut self, node: Id, f: F)where
A: Any,
F: FnMut(&mut A, ListenerCtx<'_>) + 'static,
Add a listener that expects a specific type.
sourcepub fn append_child(&mut self, node: Id, child: Id)
pub fn append_child(&mut self, node: Id, child: Id)
Add a child dynamically, in the last position.
sourcepub fn add_before(&mut self, node: Id, sibling: Id, child: Id)
pub fn add_before(&mut self, node: Id, sibling: Id, child: Id)
Add a child dynamically, before the given sibling.
sourcepub fn remove_child(&mut self, node: Id, child: Id)
pub fn remove_child(&mut self, node: Id, child: Id)
Remove a child.
Can panic if child is not a valid child. The child is not deleted, but can be added again later. The listeners for the child are not cleared.
sourcepub fn delete_child(&mut self, node: Id, child: Id)
pub fn delete_child(&mut self, node: Id, child: Id)
Delete a child.
Can panic if child is not a valid child. Deletes the subtree rooted at the child, drops those widgets, and clears all listeners. The id of the child may be reused; callers should take care not to use the child id in any way afterwards.