[][src]Struct imgui::ListBox

#[must_use]pub struct ListBox<'a> { /* fields omitted */ }

Builder for a list box widget

Implementations

impl<'a> ListBox<'a>[src]

pub fn new(label: &'a ImStr) -> ListBox<'a>[src]

Constructs a new list box builder.

pub fn calculate_size(self, items_count: i32, height_in_items: i32) -> Self[src]

Sets the list box size based on the number of items that you want to make visible Size default to hold ~7.25 items. We add +25% worth of item height to allow the user to see at a glance if there are more items up/down, without looking at the scrollbar. We don't add this extra bit if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size.

pub fn size(self, size: [f32; 2]) -> Self[src]

Sets the list box size based on the given width and height If width or height are 0 or smaller, a default value is calculated Helper to calculate the size of a listbox and display a label on the right. Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an non-visible label e.g. "##empty"

Default: [0.0, 0.0], in which case the combobox calculates a sensible width and height

#[must_use]pub fn begin(self, ui: &Ui<'_>) -> Option<ListBoxToken>[src]

Creates a list box and starts appending to it.

Returns Some(ListBoxToken) if the list box is open. After content has been rendered, the token must be ended by calling .end().

Returns None if the list box is not open and no content should be rendered.

pub fn build<F: FnOnce()>(self, ui: &Ui<'_>, f: F)[src]

Creates a list box and runs a closure to construct the list contents.

Note: the closure is not called if the list box is not open.

impl<'a> ListBox<'a>[src]

pub fn build_simple<T, L>(
    self,
    ui: &Ui<'_>,
    current_item: &mut usize,
    items: &[T],
    label_fn: &L
) -> bool where
    L: Fn(&'b T) -> Cow<'b, ImStr>, 
[src]

Builds a simple list box for choosing from a slice of values

Trait Implementations

impl<'a> Clone for ListBox<'a>[src]

impl<'a> Copy for ListBox<'a>[src]

impl<'a> Debug for ListBox<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for ListBox<'a>[src]

impl<'a> Send for ListBox<'a>[src]

impl<'a> Sync for ListBox<'a>[src]

impl<'a> Unpin for ListBox<'a>[src]

impl<'a> UnwindSafe for ListBox<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.