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§

source

fn get_children(&self) -> &[UiElement<T>]

Returns access to this elements children, if there are any. Returns None if this is a leaf node.

source

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.

source

fn add(&mut self, element: UiElement<T>)

Attempts to add a UiElement to this elements children.

source

fn remove_expired(&mut self)

Removes all elements from this container whose UiContent::expired-function returns true.

source

fn remove_id(&mut self, id: u32)

Removes all elements from this container whose ids match.

Provided Methods§

source

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).

source

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).

Implementors§

source§

impl<T: Copy + Eq + Hash> UiContainer<T> for DurationBox<T>

source§

impl<T: Copy + Eq + Hash> UiContainer<T> for GridBox<T>

source§

impl<T: Copy + Eq + Hash> UiContainer<T> for StackBox<T>

source§

impl<T: Copy + Eq + Hash> UiContainer<T> for VerticalBox<T>

source§

impl<T: Copy + Hash + Eq> UiContainer<T> for HorizontalBox<T>