pub struct Manager<E: Extension> { /* private fields */ }
Expand description
Stores loaded nodes and manages the layout.
Implementations§
source§impl<E: Extension> Manager<E>
impl<E: Extension> Manager<E>
sourcepub fn add_layout_engine<F, L>(&mut self, creator: F)where
F: Fn() -> L + 'static,
L: LayoutEngine<E> + 'static,
pub fn add_layout_engine<F, L>(&mut self, creator: F)where
F: Fn() -> L + 'static,
L: LayoutEngine<E> + 'static,
Adds a new function that can be used to create a layout engine.
A layout engine is used to position elements within an element.
The layout engine can be selected by using the layout
attribute.
sourcepub fn add_func_raw<F>(&mut self, name: &'static str, func: F)where
F: for<'a> Fn(&mut (dyn Iterator<Item = FResult<'a, Value<E>>> + 'a)) -> FResult<'a, Value<E>> + 'static,
pub fn add_func_raw<F>(&mut self, name: &'static str, func: F)where
F: for<'a> Fn(&mut (dyn Iterator<Item = FResult<'a, Value<E>>> + 'a)) -> FResult<'a, Value<E>> + 'static,
Add a function that can be called by style rules
Arguments are only parsed when obtained from the iterator making unused parameters cheap.
sourcepub fn add_node_str<'a>(&mut self, node: &'a str) -> Result<(), PError<'a>>
pub fn add_node_str<'a>(&mut self, node: &'a str) -> Result<(), PError<'a>>
Adds the node to the root node of this manager.
The node is created from the passed string.
See from_str
sourcepub fn remove_node(&mut self, node: Node<E>)
pub fn remove_node(&mut self, node: Node<E>)
Removes the node from the root node of this manager
sourcepub fn query_at(&self, x: i32, y: i32) -> Query<'static, E>
pub fn query_at(&self, x: i32, y: i32) -> Query<'static, E>
Starts a query looking for elements at the target location.
sourcepub fn load_styles<'a>(
&mut self,
name: &str,
style_rules: &'a str
) -> Result<(), PError<'a>>
pub fn load_styles<'a>(
&mut self,
name: &str,
style_rules: &'a str
) -> Result<(), PError<'a>>
Loads a set of styles from the given string.
The name can be used to remove the loaded styles later
sourcepub fn remove_styles(&mut self, name: &str)
pub fn remove_styles(&mut self, name: &str)
Removes the set of styles with the given name
sourcepub fn layout(&mut self, width: i32, height: i32)
pub fn layout(&mut self, width: i32, height: i32)
Positions the nodes in this manager.
This will update nodes based on their properties and then position them based on their selected layout.
sourcepub fn render<V>(&mut self, visitor: &mut V)where
V: RenderVisitor<E>,
pub fn render<V>(&mut self, visitor: &mut V)where
V: RenderVisitor<E>,
Renders the nodes in this manager by passing the draw position/size and style properties to the visitor