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
impl Obj
Sourcepub unsafe fn from_raw(raw: *mut lv_obj_t) -> Self
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.
Sourcepub fn child_count(self) -> u32
pub fn child_count(self) -> u32
Get number of children.
Sourcepub fn get_height(self) -> i32
pub fn get_height(self) -> i32
Get current height.
Sourcepub fn set_user_data(self, data: *mut c_void) -> Self
pub fn set_user_data(self, data: *mut c_void) -> Self
Set user data pointer.
Sourcepub fn get_user_data(self) -> *mut c_void
pub fn get_user_data(self) -> *mut c_void
Get user data pointer.
Sourcepub fn set_pos(self, x: i32, y: i32)
pub fn set_pos(self, x: i32, y: i32)
Set the position of the widget (legacy, non-fluent variant).
Sourcepub fn set_style_bg_color(self, color: Color, selector: u32)
pub fn set_style_bg_color(self, color: Color, selector: u32)
Set the background color for the given selector (legacy, non-fluent variant).
Sourcepub fn set_style_text_color(self, color: Color, selector: u32)
pub fn set_style_text_color(self, color: Color, selector: u32)
Set the text color for the given selector (legacy, non-fluent variant).
Sourcepub fn set_style_radius(self, radius: i32, selector: u32)
pub fn set_style_radius(self, radius: i32, selector: u32)
Set the corner radius for the given selector (legacy, non-fluent variant).
Sourcepub fn set_style_text_font(self, font: *const lv_font_t, selector: u32)
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§
impl Copy for Obj
impl Send for Obj
impl Sync for Obj
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EventTarget for Twhere
T: Widget,
impl<T> EventTarget for Twhere
T: Widget,
Source§fn on(
self,
code: lv_event_code_t,
cb: lv_event_cb_t,
user_data: *mut c_void,
) -> Self
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
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
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> Layout for Twhere
T: Widget,
impl<T> Layout for Twhere
T: Widget,
Source§fn 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.
Source§fn 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. Read more
Source§fn 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).Source§fn remove_flag(self, f: u32) -> Self
fn remove_flag(self, f: u32) -> Self
Remove one or more LVGL object flags.
Source§fn 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).Source§fn remove_state(self, s: u32) -> Self
fn remove_state(self, s: u32) -> Self
Remove one or more LVGL object state bits.
Source§impl<T> Styleable for Twhere
T: Widget,
impl<T> Styleable for Twhere
T: Widget,
Source§fn bg_opa(self, opa: u8) -> Self
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
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
fn border_width(self, w: i32) -> Self
Set the border width in pixels.
Source§fn radius(self, r: i32) -> Self
fn radius(self, r: i32) -> Self
Set the corner radius in pixels (use
LV_RADIUS_CIRCLE for a pill shape).Source§fn text_color(self, c: Color) -> Self
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
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.