Label

Struct Label 

Source
pub struct Label { /* private fields */ }
Expand description

LVGL label widget.

Implementations§

Source§

impl Label

Source

pub fn create(parent: impl Widget) -> Self

Create a new label as a child of parent.

Source

pub fn set_text(self, text: &[u8])

Set text from a null-terminated byte slice.

Source

pub fn text(self, txt: &[u8]) -> Self

Fluent: set text (copies string).

Source

pub fn text_static(self, txt: &'static [u8]) -> Self

Fluent: set static text (pointer must remain valid).

Source

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

Fluent: set font shorthand.

Source

pub fn color(self, c: Color) -> Self

Fluent: set text color shorthand.

Trait Implementations§

Source§

impl Clone for Label

Source§

fn clone(&self) -> Label

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for Label

Source§

type Target = Obj

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Obj

Dereferences the value.
Source§

impl Widget for Label

Source§

fn raw(self) -> *mut lv_obj_t

Return the raw lv_obj_t pointer for this widget. Read more
Source§

impl Copy for Label

Source§

impl Send for Label

Source§

impl Sync for Label

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> EventTarget for T
where T: Widget,

Source§

fn on( self, code: lv_event_code_t, cb: lv_event_cb_t, user_data: *mut c_void, ) -> Self

Register a callback for an arbitrary LVGL event code. Read more
Source§

fn on_click(self, cb: lv_event_cb_t, user_data: *mut c_void) -> Self

Register a callback for click (LV_EVENT_CLICKED) events.
Source§

fn on_value_changed(self, cb: lv_event_cb_t, user_data: *mut c_void) -> Self

Register a callback for value-changed (LV_EVENT_VALUE_CHANGED) events.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Layout for T
where T: Widget,

Source§

fn size(self, w: i32, h: i32) -> Self

Set both width and height of the widget in pixels.
Source§

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

Set the width of the widget in pixels.
Source§

fn height(self, h: i32) -> Self

Set the height of the widget in pixels.
Source§

fn pos(self, x: i32, y: i32) -> Self

Set the position of the widget relative to its parent’s top-left corner.
Source§

fn center(self) -> Self

Center the widget within its parent.
Source§

fn align(self, a: u8, x_ofs: i32, y_ofs: i32) -> Self

Align the widget using an LVGL alignment constant and pixel offsets. Read more
Source§

fn hide(self) -> Self

Hide the widget by setting LV_OBJ_FLAG_HIDDEN.
Source§

fn show(self) -> Self

Make the widget visible by removing LV_OBJ_FLAG_HIDDEN.
Source§

fn visible(self, v: bool) -> Self

Show or hide the widget. Equivalent to calling show or hide.
Source§

fn add_flag(self, f: u32) -> Self

Add one or more LVGL object flags (bitwise OR of LV_OBJ_FLAG_* values).
Source§

fn remove_flag(self, f: u32) -> Self

Remove one or more LVGL object flags.
Source§

fn add_state(self, s: u32) -> Self

Add one or more LVGL object state bits (e.g. LV_STATE_CHECKED).
Source§

fn remove_state(self, s: u32) -> Self

Remove one or more LVGL object state bits.
Source§

fn clickable(self, on: bool) -> Self

Enable or disable click events on the widget.
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Styleable for T
where T: Widget,

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_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: &mut Style, selector: u32) -> Self

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.