#[repr(C)]pub struct ComboBox {
pub combo_state: ComboBoxStateWrapper,
pub placeholder: AzString,
}Expand description
An editable filtered-select widget: a text field plus a click-toggled list of options.
Fields§
§combo_state: ComboBoxStateWrapperRuntime state (open/selected/text) plus the item list and the
optional select callback.
placeholder: AzStringGreyed text shown in the field when no value has been typed/selected.
Implementations§
Source§impl ComboBox
impl ComboBox
Sourcepub fn new(items: StringVec) -> Self
pub fn new(items: StringVec) -> Self
Creates a new combobox with the given options (no callback, nothing typed).
Sourcepub const fn set_selected(&mut self, selected: usize)
pub const fn set_selected(&mut self, selected: usize)
Sets the initially-selected option index.
Sourcepub const fn with_selected(self, selected: usize) -> Self
pub const fn with_selected(self, selected: usize) -> Self
Builder-style setter for the initially-selected index.
Sourcepub fn with_text(self, text: AzString) -> Self
pub fn with_text(self, text: AzString) -> Self
Builder-style setter for the initial field text.
Sourcepub fn set_placeholder(&mut self, placeholder: AzString)
pub fn set_placeholder(&mut self, placeholder: AzString)
Sets the greyed placeholder shown when the field is empty.
Sourcepub fn with_placeholder(self, placeholder: AzString) -> Self
pub fn with_placeholder(self, placeholder: AzString) -> Self
Builder-style setter for the placeholder.
Sourcepub fn set_on_select<C: Into<ComboBoxOnSelectCallback>>(
&mut self,
data: RefAny,
on_select: C,
)
pub fn set_on_select<C: Into<ComboBoxOnSelectCallback>>( &mut self, data: RefAny, on_select: C, )
Sets the callback invoked when an option is selected.
Sourcepub fn with_on_select<C: Into<ComboBoxOnSelectCallback>>(
self,
data: RefAny,
on_select: C,
) -> Self
pub fn with_on_select<C: Into<ComboBoxOnSelectCallback>>( self, data: RefAny, on_select: C, ) -> Self
Builder-style setter for the select callback.
Sourcepub fn swap_with_default(&mut self) -> Self
pub fn swap_with_default(&mut self) -> Self
Replaces self with a default (empty) combobox and returns the original.
Trait Implementations§
impl Eq for ComboBox
impl StructuralPartialEq for ComboBox
Auto Trait Implementations§
impl Freeze for ComboBox
impl RefUnwindSafe for ComboBox
impl Send for ComboBox
impl Sync for ComboBox
impl Unpin for ComboBox
impl UnsafeUnpin for ComboBox
impl UnwindSafe for ComboBox
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more