pub trait Layout: Widget + Sized {
Show 24 methods
// Provided methods
fn size(self, w: i32, h: i32) -> Self { ... }
fn width(self, w: i32) -> Self { ... }
fn height(self, h: i32) -> Self { ... }
fn pos(self, x: i32, y: i32) -> Self { ... }
fn center(self) -> Self { ... }
fn align(self, a: u8, x_ofs: i32, y_ofs: i32) -> Self { ... }
fn hide(self) -> Self { ... }
fn show(self) -> Self { ... }
fn visible(self, v: bool) -> Self { ... }
fn add_flag(self, f: u32) -> Self { ... }
fn remove_flag(self, f: u32) -> Self { ... }
fn add_state(self, s: u32) -> Self { ... }
fn remove_state(self, s: u32) -> Self { ... }
fn clickable(self, on: bool) -> Self { ... }
fn grid_dsc(self, cols: &'static [i32], rows: &'static [i32]) -> Self { ... }
fn grid_cell(
self,
col_align: u32,
col_pos: i32,
col_span: i32,
row_align: u32,
row_pos: i32,
row_span: i32,
) -> Self { ... }
fn flex_flow(self, flow: FlexFlow) -> Self { ... }
fn flex_align(
self,
main: FlexAlign,
cross: FlexAlign,
track: FlexAlign,
) -> Self { ... }
fn flex_grow(self, grow: u8) -> Self { ... }
fn layout(self, kind: LayoutKind) -> Self { ... }
fn scroll_to_y(self, y: i32, anim: bool) -> Self { ... }
fn update_layout(self) -> Self { ... }
fn content_width(self) -> i32 { ... }
fn scroll_bottom(self) -> i32 { ... }
}Expand description
Fluent positioning, sizing, and flag manipulation.
Blanket-implemented for all Widget types.
Provided Methods§
Sourcefn pos(self, x: i32, y: i32) -> Self
fn pos(self, x: i32, y: i32) -> Self
Set the position of the widget relative to its parent’s top-left corner.
Sourcefn align(self, a: u8, x_ofs: i32, y_ofs: i32) -> Self
fn align(self, a: u8, x_ofs: i32, y_ofs: i32) -> Self
Align the widget using an LVGL alignment constant and pixel offsets.
a must be one of the ALIGN_* constants (e.g. ALIGN_CENTER).
Sourcefn add_flag(self, f: u32) -> Self
fn add_flag(self, f: u32) -> Self
Add one or more LVGL object flags (bitwise OR of LV_OBJ_FLAG_* values).
Sourcefn remove_flag(self, f: u32) -> Self
fn remove_flag(self, f: u32) -> Self
Remove one or more LVGL object flags.
Sourcefn add_state(self, s: u32) -> Self
fn add_state(self, s: u32) -> Self
Add one or more LVGL object state bits (e.g. LV_STATE_CHECKED).
Sourcefn remove_state(self, s: u32) -> Self
fn remove_state(self, s: u32) -> Self
Remove one or more LVGL object state bits.
Sourcefn grid_dsc(self, cols: &'static [i32], rows: &'static [i32]) -> Self
fn grid_dsc(self, cols: &'static [i32], rows: &'static [i32]) -> Self
Configure this widget as a grid container.
Both arrays must terminate with GRID_TEMPLATE_LAST. Track sizes
can be fixed pixel values, GRID_CONTENT, or grid_fr for
fractional units. Switches the widget’s layout to grid mode.
§Safety
The caller must ensure cols and rows outlive the widget, since
LVGL retains the pointer rather than copying. 'static slices are
the typical choice.
Sourcefn grid_cell(
self,
col_align: u32,
col_pos: i32,
col_span: i32,
row_align: u32,
row_pos: i32,
row_span: i32,
) -> Self
fn grid_cell( self, col_align: u32, col_pos: i32, col_span: i32, row_align: u32, row_pos: i32, row_span: i32, ) -> Self
Place this widget into a cell of its parent grid.
Sourcefn flex_flow(self, flow: FlexFlow) -> Self
fn flex_flow(self, flow: FlexFlow) -> Self
Configure this widget as a flex container with the given main-axis flow.
Sourcefn flex_align(self, main: FlexAlign, cross: FlexAlign, track: FlexAlign) -> Self
fn flex_align(self, main: FlexAlign, cross: FlexAlign, track: FlexAlign) -> Self
Set flex container alignment along the main, cross (per item), and
cross (per track) axes. Equivalent to lv_obj_set_flex_align.
Sourcefn layout(self, kind: LayoutKind) -> Self
fn layout(self, kind: LayoutKind) -> Self
Switch the widget’s layout engine (None / Flex / Grid).
Sourcefn scroll_to_y(self, y: i32, anim: bool) -> Self
fn scroll_to_y(self, y: i32, anim: bool) -> Self
Scroll the widget so the given Y coordinate is visible. anim enables animation.
Sourcefn update_layout(self) -> Self
fn update_layout(self) -> Self
Force layout recomputation immediately (for queries that need live values).
Sourcefn content_width(self) -> i32
fn content_width(self) -> i32
Width of the inner content area (excludes paddings/scrollbars).
Sourcefn scroll_bottom(self) -> i32
fn scroll_bottom(self) -> i32
Distance the widget can still scroll towards its bottom edge.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.