Skip to main content

Dropdown

Struct Dropdown 

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

LVGL dropdown — click opens a popup list of options (newline-separated).

Implementations§

Source§

impl Dropdown

Source

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

Create a new Dropdown widget as a child of parent.

Source

pub fn options(self, opts: &[u8]) -> Self

Fluent: set options from a newline-separated string (LVGL copies it).

Source

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

Fluent: set options from a persistent newline-separated string (no copy).

Source

pub fn add_option(self, opt: &[u8], pos: u32) -> Self

Fluent: insert a single option at pos.

Source

pub fn clear_options(self) -> Self

Fluent: clear the entire option list.

Source

pub fn selected(self, sel: u32) -> Self

Fluent: set the selected index.

Source

pub fn dir(self, d: lv_dir_t) -> Self

Fluent: set popup direction.

Source

pub fn get_selected(self) -> u32

Returns the currently selected index.

Source

pub fn get_option_count(self) -> u32

Returns the total option count.

Source

pub fn get_selected_str(self, buf: &mut [u8])

Fills buf with the currently selected option text.

Source

pub fn is_open(self) -> bool

Returns true if the popup list is currently expanded.

Source

pub fn open(self)

Expands the popup list.

Source

pub fn close(self)

Collapses the popup list.

Source

pub fn symbol(self, symbol: *const c_void) -> Self

Fluent: set the icon/symbol shown on the dropdown button (e.g. an LV_SYMBOL_* string or an image source).

Source

pub fn get_options(self) -> *const c_char

Returns the newline-separated option list as a raw C pointer owned by LVGL. The pointer is invalidated by any subsequent mutation.

Source§

impl Dropdown

Source

pub fn bind_value<T: Copy + Into<i32> + TryFrom<i32>>( self, state: &State<T>, ) -> Self

Bind this dropdown’s selected index to a reactive state.

Trait Implementations§

Source§

impl Clone for Dropdown

Source§

fn clone(&self) -> Dropdown

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 Dropdown

Source§

type Target = Obj

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Obj

Dereferences the value.
Source§

impl Widget for Dropdown

Source§

fn raw(self) -> *mut lv_obj_t

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

impl Copy for Dropdown

Source§

impl Send for Dropdown

Source§

impl Sync for Dropdown

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_fn(self, code: lv_event_code_t, handler: fn(EventCtx<'_>)) -> Self

Register a stateless safe handler for any LVGL event code.
Source§

fn on_clicked(self, handler: fn(EventCtx<'_>)) -> Self

Register a stateless safe handler for click events.
Source§

fn on_value_change(self, handler: fn(EventCtx<'_>)) -> Self

Register a stateless safe handler for value-changed events.
Source§

fn on_with<T: Send + Sync + 'static>( self, code: lv_event_code_t, handler: &'static EventHandler<T>, ) -> Self

Register a stateful safe handler — the handler receives the shared state from the bundled InitCell and an EventCtx.
Source§

fn on_clicked_with<T: Send + Sync + 'static>( self, handler: &'static EventHandler<T>, ) -> Self

Stateful click handler (see EventTarget::on_with).
Source§

fn on_value_change_with<T: Send + Sync + 'static>( self, handler: &'static EventHandler<T>, ) -> Self

Stateful value-change handler (see EventTarget::on_with).
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§

fn grid_dsc(self, cols: &'static [i32], rows: &'static [i32]) -> Self

Configure this widget as a grid container. Read more
Source§

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

fn flex_flow(self, flow: FlexFlow) -> Self

Configure this widget as a flex container with the given main-axis flow.
Source§

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

fn flex_grow(self, grow: u8) -> Self

Set this child’s flex grow factor (0 disables growing).
Source§

fn layout(self, kind: LayoutKind) -> Self

Switch the widget’s layout engine (None / Flex / Grid).
Source§

fn scroll_to_y(self, y: i32, anim: bool) -> Self

Scroll the widget so the given Y coordinate is visible. anim enables animation.
Source§

fn update_layout(self) -> Self

Force layout recomputation immediately (for queries that need live values).
Source§

fn content_width(self) -> i32

Width of the inner content area (excludes paddings/scrollbars).
Source§

fn scroll_bottom(self) -> i32

Distance the widget can still scroll towards its bottom edge.
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_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). Read more
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).
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.