pub struct HStack {
pub spacing: f32,
/* private fields */
}Expand description
A horizontal arrangement of UI nodes with configurable spacing.
Nodes can be reordered and added/removed at any time.
Nodes always appear at their minimum size horizontally, regardless of alignment. Vertical alignment still applies.
Fields§
§spacing: f32Implementations§
Source§impl HStack
impl HStack
pub fn new() -> Self
Sourcepub fn with_child(self, index: TdIndex) -> Self
pub fn with_child(self, index: TdIndex) -> Self
Add a new child to the stack.
Sourcepub fn with_align(self, align: (Alignment, Alignment)) -> Self
pub fn with_align(self, align: (Alignment, Alignment)) -> Self
Sourcepub fn with_spacing(self, spacing: f32) -> Self
pub fn with_spacing(self, spacing: f32) -> Self
Set the spacing between children. Defaults to 0.
No spacing appears before the first child or after the last child.
Sourcepub fn add_child(&mut self, index: TdIndex)
pub fn add_child(&mut self, index: TdIndex)
Add a child to the stack. The child will appear at the end.
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 stack.
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.
Returns true if the child was moved.
Sourcepub fn get_child_index(&self, index: usize) -> Option<TdIndex>
pub fn get_child_index(&self, index: usize) -> Option<TdIndex>
Returns the tree index associated with a child at a given stack index.
Trait Implementations§
Source§impl UiNode for HStack
impl UiNode for HStack
Source§fn get_align_mut(&mut self) -> (&mut Alignment, &mut Alignment)
fn get_align_mut(&mut self) -> (&mut Alignment, &mut Alignment)
Get a mutable reference to the alignment of the node.
Source§fn calculate_min_size(&self, tree: &UiTree) -> (f32, f32)
fn calculate_min_size(&self, tree: &UiTree) -> (f32, f32)
Calculate the minimum size of the node. Read more
Source§fn calculate_rects(&self, cache: &NodeCache, tree: &UiTree) -> Vec<Rect>
fn calculate_rects(&self, cache: &NodeCache, tree: &UiTree) -> Vec<Rect>
Recalculate the position and size of child nodes, in the same order and count as
get_visible_children. Read moreSource§fn get_children(&self) -> Vec<TdIndex>
fn get_children(&self) -> Vec<TdIndex>
Get all children of the node, if applicable.
Auto Trait Implementations§
impl Freeze for HStack
impl RefUnwindSafe for HStack
impl Send for HStack
impl Sync for HStack
impl Unpin for HStack
impl UnsafeUnpin for HStack
impl UnwindSafe for HStack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more