Obj

Struct Obj 

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

Non-owning handle to an LVGL object (lv_obj_t *).

LVGL manages object lifetimes (parent owns children). No Drop. Copy enables fluent method chaining (self -> Self).

Implementations§

Source§

impl Obj

Source

pub unsafe fn from_raw(raw: *mut lv_obj_t) -> Self

Wrap a raw LVGL object pointer.

§Safety

The pointer must be valid and obtained from an LVGL function.

Source

pub fn as_raw(self) -> *mut lv_obj_t

Get the raw pointer (for passing to FFI).

Source

pub fn create(parent: Obj) -> Self

Create a plain container object.

Source

pub fn del(self)

Delete this object and all its children.

Source

pub fn clean(self)

Delete all children of this object.

Source

pub fn parent(self) -> Self

Get parent object.

Source

pub fn child_count(self) -> u32

Get number of children.

Source

pub fn get_width(self) -> i32

Get current width.

Source

pub fn get_height(self) -> i32

Get current height.

Source

pub fn set_user_data(self, data: *mut c_void) -> Self

Set user data pointer.

Source

pub fn get_user_data(self) -> *mut c_void

Get user data pointer.

Source

pub fn set_size(self, w: i32, h: i32)

Set the size of the widget (legacy, non-fluent variant).

Source

pub fn set_pos(self, x: i32, y: i32)

Set the position of the widget (legacy, non-fluent variant).

Source

pub fn set_style_bg_color(self, color: Color, selector: u32)

Set the background color for the given selector (legacy, non-fluent variant).

Source

pub fn set_style_text_color(self, color: Color, selector: u32)

Set the text color for the given selector (legacy, non-fluent variant).

Source

pub fn set_style_radius(self, radius: i32, selector: u32)

Set the corner radius for the given selector (legacy, non-fluent variant).

Source

pub fn set_style_text_font(self, font: *const lv_font_t, selector: u32)

Set the text font for the given selector (legacy, non-fluent variant).

Trait Implementations§

Source§

impl Clone for Obj

Source§

fn clone(&self) -> Obj

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 Widget for Obj

Source§

fn raw(self) -> *mut lv_obj_t

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

impl Copy for Obj

Source§

impl Send for Obj

Source§

impl Sync for Obj

Auto Trait Implementations§

§

impl Freeze for Obj

§

impl RefUnwindSafe for Obj

§

impl Unpin for Obj

§

impl UnwindSafe for Obj

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<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.