Trait mooeye::ui::UiContainer
source · pub trait UiContainer<T: Copy + Eq + Hash>: UiContent<T> {
// Required methods
fn get_children(&self) -> &[UiElement<T>];
fn get_children_mut(&mut self) -> &mut [UiElement<T>];
fn add(&mut self, element: UiElement<T>);
fn remove_expired(&mut self);
fn remove_id(&mut self, id: u32);
// Provided methods
fn content_width_range(&self) -> (f32, f32) { ... }
fn content_height_range(&self) -> (f32, f32) { ... }
}
Expand description
This trait marks a special type of UiContent that contains other UiElements. Remember to overwrite the UiContent::container and UiContent::container_mut functions of UiContent.
Required Methods§
sourcefn get_children(&self) -> &[UiElement<T>]
fn get_children(&self) -> &[UiElement<T>]
Returns access to this elements children, if there are any. Returns None if this is a leaf node.
sourcefn get_children_mut(&mut self) -> &mut [UiElement<T>]
fn get_children_mut(&mut self) -> &mut [UiElement<T>]
Returns mutatble access to this elements children, if there are any. Returns None if this is a leaf node.
sourcefn add(&mut self, element: UiElement<T>)
fn add(&mut self, element: UiElement<T>)
Attempts to add a UiElement to this elements children.
sourcefn remove_expired(&mut self)
fn remove_expired(&mut self)
Removes all elements from this container whose UiContent::expired-function returns true.
Provided Methods§
sourcefn content_width_range(&self) -> (f32, f32)
fn content_width_range(&self) -> (f32, f32)
Returns any dynamic width restrictions induced by the content, not the layout. Usually, this refers to the layout of child elements of containers. Default implementation returns (0., infinty) (no restrictions).
sourcefn content_height_range(&self) -> (f32, f32)
fn content_height_range(&self) -> (f32, f32)
Returns any dynamic width restrictions induced by the content, not the layout. Usually, this refers to the layout of child elements of containers. Default implementation returns (0., infinty) (no restrictions).