Skip to main content

Styleable

Trait Styleable 

Source
pub trait Styleable: Widget + Sized {
Show 35 methods // Provided methods fn bg_color(self, c: Color) -> Self { ... } fn bg_opa(self, opa: u8) -> Self { ... } fn border_color(self, c: Color) -> Self { ... } fn border_width(self, w: i32) -> Self { ... } fn radius(self, r: i32) -> Self { ... } fn pad_all(self, p: i32) -> Self { ... } fn pad_hor(self, p: i32) -> Self { ... } fn pad_ver(self, p: i32) -> Self { ... } fn pad_top(self, p: i32) -> Self { ... } fn pad_bottom(self, p: i32) -> Self { ... } fn pad_left(self, p: i32) -> Self { ... } fn pad_right(self, p: i32) -> Self { ... } fn pad_gap(self, g: i32) -> Self { ... } fn text_color(self, c: Color) -> Self { ... } fn text_font(self, f: *const lv_font_t) -> Self { ... } fn add_style(self, style: &Style, selector: u32) -> Self { ... } fn translate_y(self, v: i32, selector: u32) -> Self { ... } fn margin_top(self, v: i32, selector: u32) -> Self { ... } fn margin_bottom(self, v: i32, selector: u32) -> Self { ... } fn margin_left(self, v: i32, selector: u32) -> Self { ... } fn margin_right(self, v: i32, selector: u32) -> Self { ... } fn max_height(self, v: i32, selector: u32) -> Self { ... } fn arc_opa(self, opa: u8, selector: u32) -> Self { ... } fn arc_rounded(self, rounded: bool, selector: u32) -> Self { ... } fn opa_layered(self, opa: u8, selector: u32) -> Self { ... } fn text_align(self, align: u32, selector: u32) -> Self { ... } fn bg_color_sel(self, c: Color, selector: u32) -> Self { ... } fn bg_opa_sel(self, opa: u8, selector: u32) -> Self { ... } fn border_color_sel(self, c: Color, selector: u32) -> Self { ... } fn text_color_sel(self, c: Color, selector: u32) -> Self { ... } fn arc_color_sel(self, c: Color, selector: u32) -> Self { ... } fn arc_width(self, w: i32, selector: u32) -> Self { ... } fn pad_row(self, p: i32) -> Self { ... } fn pad_column(self, p: i32) -> Self { ... } fn set_opa(self, opa: u8) -> Self { ... }
}
Expand description

Fluent inline style setters. Applied to LV_PART_MAIN by default. Blanket-implemented for all Widget types.

Provided Methods§

Source

fn bg_color(self, c: Color) -> Self

Set the background color of the widget’s main part.

Source

fn bg_opa(self, opa: u8) -> Self

Set the background opacity of the widget’s main part (0 = transparent, 255 = opaque).

Source

fn border_color(self, c: Color) -> Self

Set the border color of the widget’s main part.

Source

fn border_width(self, w: i32) -> Self

Set the border width in pixels.

Source

fn radius(self, r: i32) -> Self

Set the corner radius in pixels (use LV_RADIUS_CIRCLE for a pill shape).

Source

fn pad_all(self, p: i32) -> Self

Set equal padding on all four sides.

Source

fn pad_hor(self, p: i32) -> Self

Set equal left and right (horizontal) padding.

Source

fn pad_ver(self, p: i32) -> Self

Set equal top and bottom (vertical) padding.

Source

fn pad_top(self, p: i32) -> Self

Set top padding.

Source

fn pad_bottom(self, p: i32) -> Self

Set bottom padding.

Source

fn pad_left(self, p: i32) -> Self

Set left padding.

Source

fn pad_right(self, p: i32) -> Self

Set right padding.

Source

fn pad_gap(self, g: i32) -> Self

Set the row and column gap between flex children.

Source

fn text_color(self, c: Color) -> Self

Set the text color for label-like widgets.

Source

fn text_font(self, f: *const lv_font_t) -> Self

Set the text font. Use font_montserrat_32 or font_montserrat_14 for built-ins.

Source

fn add_style(self, style: &Style, selector: u32) -> Self

Apply a reusable Style to the given style selector (part + state bitmask).

Takes &Style — LVGL reads the pointer but does not mutate the style once added. style must outlive the widget (typical use: store in a InitCell<Style> or &'static).

Source

fn translate_y(self, v: i32, selector: u32) -> Self

Apply a vertical translation (post-layout offset, in pixels).

Source

fn margin_top(self, v: i32, selector: u32) -> Self

Top margin in pixels.

Source

fn margin_bottom(self, v: i32, selector: u32) -> Self

Bottom margin in pixels.

Source

fn margin_left(self, v: i32, selector: u32) -> Self

Left margin in pixels.

Source

fn margin_right(self, v: i32, selector: u32) -> Self

Right margin in pixels.

Source

fn max_height(self, v: i32, selector: u32) -> Self

Maximum height in pixels (caps set_height/content sizing).

Source

fn arc_opa(self, opa: u8, selector: u32) -> Self

Arc opacity for arc-drawing widgets (0..=255).

Source

fn arc_rounded(self, rounded: bool, selector: u32) -> Self

Whether the arc has rounded ends.

Source

fn opa_layered(self, opa: u8, selector: u32) -> Self

Layered opacity (composites the whole subtree at the given alpha).

Source

fn text_align(self, align: u32, selector: u32) -> Self

Set the text alignment (TEXT_ALIGN_*) for the given selector.

Source

fn bg_color_sel(self, c: Color, selector: u32) -> Self

Background color with explicit selector (part + state bits).

Source

fn bg_opa_sel(self, opa: u8, selector: u32) -> Self

Background opacity with explicit selector.

Source

fn border_color_sel(self, c: Color, selector: u32) -> Self

Border color with explicit selector.

Source

fn text_color_sel(self, c: Color, selector: u32) -> Self

Text color with explicit selector.

Source

fn arc_color_sel(self, c: Color, selector: u32) -> Self

Arc track color with explicit selector.

Source

fn arc_width(self, w: i32, selector: u32) -> Self

Arc track width with explicit selector.

Source

fn pad_row(self, p: i32) -> Self

Row gap (flex layout).

Source

fn pad_column(self, p: i32) -> Self

Column gap (flex layout).

Source

fn set_opa(self, opa: u8) -> Self

Overall object opacity (0..=255).

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.

Implementors§

Source§

impl<T: Widget> Styleable for T