#[repr(C)]pub struct DropDown {
pub choices: StringVec,
pub selected: usize,
pub on_choice_change: OptionDropDownOnChoiceChange,
}Expand description
A drop-down / select widget that displays the currently selected item and opens a native menu popup when focused.
Fields§
§choices: StringVecThe list of choices presented in the popup menu.
selected: usizeZero-based index of the currently selected choice.
on_choice_change: OptionDropDownOnChoiceChangeOptional callback invoked when the user picks a different choice.
Implementations§
Source§impl DropDown
impl DropDown
Sourcepub fn new(choices: StringVec) -> Self
pub fn new(choices: StringVec) -> Self
Creates a new DropDown with the given choices and no callback.
Sourcepub fn set_on_choice_change<C: Into<DropDownOnChoiceChangeCallback>>(
&mut self,
data: RefAny,
callback: C,
)
pub fn set_on_choice_change<C: Into<DropDownOnChoiceChangeCallback>>( &mut self, data: RefAny, callback: C, )
Sets the callback invoked when the user selects a different choice.
Sourcepub fn with_on_choice_change<C: Into<DropDownOnChoiceChangeCallback>>(
self,
data: RefAny,
callback: C,
) -> Self
pub fn with_on_choice_change<C: Into<DropDownOnChoiceChangeCallback>>( self, data: RefAny, callback: C, ) -> Self
Builder variant of Self::set_on_choice_change.
Sourcepub fn swap_with_default(&mut self) -> Self
pub fn swap_with_default(&mut self) -> Self
Replaces self with the default value and returns the original.
Trait Implementations§
impl StructuralPartialEq for DropDown
Auto Trait Implementations§
impl Freeze for DropDown
impl RefUnwindSafe for DropDown
impl Send for DropDown
impl Sync for DropDown
impl Unpin for DropDown
impl UnsafeUnpin for DropDown
impl UnwindSafe for DropDown
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> 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