pub struct Selector { /* private fields */ }Expand description
Shows at most one of its children.
You can change which node is selected as visible, or set no child to be visible. If you wish
to have multiple children visible at once, wrap all of them in Hiders and your choice of
container.
The minimum size of the selector is the minimum size of the selected child, or 0 if none is selected.
Implementations§
Source§impl Selector
impl Selector
Sourcepub fn with_child(self, index: NodeIndex) -> Self
pub fn with_child(self, index: NodeIndex) -> Self
Add a new child to the list. If there are no other children, the new child will be selected.
Sourcepub fn with_align(self, align: (Alignment, Alignment)) -> Self
pub fn with_align(self, align: (Alignment, Alignment)) -> Self
Set the horizontal and vertical alignment of the container, not the children.
Sourcepub fn remove_child(&mut self, index: usize, tree: &mut UiTree) -> bool
pub fn remove_child(&mut self, index: usize, tree: &mut UiTree) -> bool
Remove a child from the list. If the child is currently selected, the selection is removed.
Returns true if the child was removed.
Sourcepub fn set_child_position(&mut self, index: usize, position: usize) -> bool
pub fn set_child_position(&mut self, index: usize, position: usize) -> bool
Move a child to a new index. Lower indices are visited first.
Returns true if the child was moved.
Sourcepub fn get_child_index(&self, index: usize) -> Option<NodeIndex>
pub fn get_child_index(&self, index: usize) -> Option<NodeIndex>
Returns the tree index associated with a child at a given list index.
Sourcepub fn get_selected(&self) -> Option<NodeIndex>
pub fn get_selected(&self) -> Option<NodeIndex>
Returns the tree index of the currently-selected node.
Sourcepub fn get_selected_index(&self) -> Option<usize>
pub fn get_selected_index(&self) -> Option<usize>
Returns the list index of the currently-selected node.
Sourcepub fn set_selected(&mut self, child: NodeIndex)
pub fn set_selected(&mut self, child: NodeIndex)
Sets the selected node to the given tree index.
Sourcepub fn set_selected_index(&mut self, index: usize)
pub fn set_selected_index(&mut self, index: usize)
Sets the selected node to the given list index.
Trait Implementations§
Source§impl UiNode for Selector
impl UiNode for Selector
Source§fn get_align_mut(&mut self) -> (&mut Alignment, &mut Alignment)
fn get_align_mut(&mut self) -> (&mut Alignment, &mut Alignment)
Source§fn calculate_min_size(&self, tree: &UiTree) -> (f32, f32)
fn calculate_min_size(&self, tree: &UiTree) -> (f32, f32)
Source§fn calculate_rects(&self, cache: &NodeCache, tree: &UiTree) -> Vec<Rect>
fn calculate_rects(&self, cache: &NodeCache, tree: &UiTree) -> Vec<Rect>
get_visible_children. Read more