Macro pixels_graphics_lib::row_layout
source · macro_rules! row_layout { ($bounds:expr, $gravity:expr, $(padding: $padding:expr,)? $(spacing: $margin:expr,)? views: $($views:expr),+ $(,)?) => { ... }; }
Expand description
Update the position multiple views to be in a row
if gravity
is
- Top - then only the
top_left
ofbounds
is used - Center - then only the
center
ofbounds
is used - Bottom - then only the
bottom_right
ofbounds
is usedpadding
is used to offset views from the relevant positionspacing
is space between views
Usage
ⓘ
let button1 = Button::new("Button", ...);
let button2 = Button::new("Button", ...);
let button3 = Button::new("Button", ...);
row_layout!(Rect::new(16,16,16,16), RowGravity::Top, spacing: 8, views: button3, button1, button2);
// button3 top left will be (16,16)
// button1 top left will be (16 + 8 + button3.width, 16)
// button2 top left will be (16 + 8 + 8 + button3.width + button1.width, 16)