Struct imgui::ComboBox

source ·
pub struct ComboBox<'ui, Label, Preview = &'static str> {
    pub label: Label,
    pub preview_value: Option<Preview>,
    pub flags: ComboBoxFlags,
    pub ui: &'ui Ui,
}
Expand description

Builder for a combo box widget

Fields§

§label: Label§preview_value: Option<Preview>§flags: ComboBoxFlags§ui: &'ui Ui

Implementations§

source§

impl<'ui, Label: AsRef<str>> ComboBox<'ui, Label>

source

pub fn new(ui: &'ui Ui, label: Label) -> Self

👎Deprecated since 0.9.0: Use ui.combo_box_config(...) instead

Constructs a new combo box builder.

source§

impl<'ui, T: AsRef<str>, Preview: AsRef<str>> ComboBox<'ui, T, Preview>

source

pub fn preview_value<Preview2: AsRef<str>>( self, preview_value: Preview2 ) -> ComboBox<'ui, T, Preview2>

source

pub fn flags(self, flags: ComboBoxFlags) -> Self

Replaces all current settings with the given flags.

source

pub fn popup_align_left(self, popup_align_left: bool) -> Self

Enables/disables aligning the combo box popup toward the left.

Disabled by default.

source

pub fn height(self, height: ComboBoxHeight) -> Self

Sets the combo box height.

Default: ComboBoxHeight::Regular

source

pub fn preview_mode(self, preview_mode: ComboBoxPreviewMode) -> Self

Sets the combo box preview mode.

Default: ComboBoxPreviewMode::Full

source

pub fn begin(self) -> Option<ComboBoxToken<'ui>>

Creates a combo box and starts appending to it.

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

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

source

pub fn build<R, F: FnOnce() -> R>(self, f: F) -> Option<R>

Creates a combo box and runs a closure to construct the popup contents. Returns the result of the closure, if it is called.

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

Trait Implementations§

source§

impl<'ui, Label: Clone, Preview: Clone> Clone for ComboBox<'ui, Label, Preview>

source§

fn clone(&self) -> ComboBox<'ui, Label, Preview>

Returns a copy 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<'ui, Label: Debug, Preview: Debug> Debug for ComboBox<'ui, Label, Preview>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'ui, Label: Copy, Preview: Copy> Copy for ComboBox<'ui, Label, Preview>

Auto Trait Implementations§

§

impl<'ui, Label, Preview = &'static str> !RefUnwindSafe for ComboBox<'ui, Label, Preview>

§

impl<'ui, Label, Preview = &'static str> !Send for ComboBox<'ui, Label, Preview>

§

impl<'ui, Label, Preview = &'static str> !Sync for ComboBox<'ui, Label, Preview>

§

impl<'ui, Label, Preview> Unpin for ComboBox<'ui, Label, Preview>where Label: Unpin, Preview: Unpin,

§

impl<'ui, Label, Preview = &'static str> !UnwindSafe for ComboBox<'ui, Label, Preview>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.