pub struct MultiSelect { /* private fields */ }Expand description
Rows show a check for on and a dash for mixed. Taking a row clears the query. The Create row sits first and is active while it shows. Escape in the manage pane returns to the list. The list shows twelve rows and scrolls past that.
Implementations§
Source§impl MultiSelect
impl MultiSelect
pub fn new(choices: Vec<Choice>, cx: &mut Context<'_, Self>) -> Self
Sourcepub fn with_create(
self,
normalize: impl Fn(&str) -> Option<SharedString> + 'static,
) -> Self
pub fn with_create( self, normalize: impl Fn(&str) -> Option<SharedString> + 'static, ) -> Self
Offer a “Create” row for a query that names no choice. normalize
turns the query into the name it would create, or None for one that
cannot be a name; the row shows, and MultiSelectEvent::Created
carries, what it answers. Choices are matched against it as given.
Sourcepub fn with_plain_rows(self) -> Self
pub fn with_plain_rows(self) -> Self
Paint each row’s name as text rather than as a chip, for choices that are not labels. The choices that are on stay chips over the query.
Sourcepub fn with_search(self) -> Self
pub fn with_search(self) -> Self
Let the host search: each change of the query is a
MultiSelectEvent::Searched, and the rows are the choices that are
off, in the order Self::set_choices answers them, unfiltered. The
choices that are on show only as chips. An empty query shows no rows.
Sourcepub fn with_placeholder(self, placeholder: impl Into<SharedString>) -> Self
pub fn with_placeholder(self, placeholder: impl Into<SharedString>) -> Self
What the empty query field says. Left out, it is “Search…”, or
“Search or create…” with Self::with_create.
Sourcepub fn with_manage(self) -> Self
pub fn with_manage(self) -> Self
Give each row a ··· opening a pane to rename or delete its choice.
Sourcepub fn with_tint(self, tint: impl Fn(&str, &Theme) -> Hsla + 'static) -> Self
pub fn with_tint(self, tint: impl Fn(&str, &Theme) -> Hsla + 'static) -> Self
Colour each name with tint instead of tint.
Sourcepub fn with_width(self, min: Pixels, max: Pixels) -> Self
pub fn with_width(self, min: Pixels, max: Pixels) -> Self
Size the card to its widest row, from min up to max. Equal bounds
fix the width. A name wider than max is cut at the card’s edge.
pub fn choices(&self) -> &[Choice]
Sourcepub fn set_choices(&mut self, choices: Vec<Choice>, cx: &mut Context<'_, Self>)
pub fn set_choices(&mut self, choices: Vec<Choice>, cx: &mut Context<'_, Self>)
Replace the choices — the host’s answer to an event. The query and the open pane stay; a pane whose choice is gone closes.
Trait Implementations§
impl EventEmitter<MultiSelectEvent> for MultiSelect
Source§impl Focusable for MultiSelect
impl Focusable for MultiSelect
Source§fn focus_handle(&self, _: &App) -> FocusHandle
fn focus_handle(&self, _: &App) -> FocusHandle
The context around the fields; one of them holds focus while it is
open — see MultiSelect::reset.
Source§impl Render for MultiSelect
impl Render for MultiSelect
Auto Trait Implementations§
impl !Freeze for MultiSelect
impl !RefUnwindSafe for MultiSelect
impl !Send for MultiSelect
impl !Sync for MultiSelect
impl !UnwindSafe for MultiSelect
impl Forget for MultiSelect
impl Move for MultiSelect
impl Unpin for MultiSelect
impl UnsafeUnpin for MultiSelect
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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