pub struct DropdownPanelView<State: 'static> { /* private fields */ }Expand description
A declarative dropdown option panel. See dropdown_panel.
Implementations§
Source§impl<State: 'static> DropdownPanelView<State>
impl<State: 'static> DropdownPanelView<State>
Sourcepub fn anchor(self, anchor: &OverlayAnchor) -> Self
pub fn anchor(self, anchor: &OverlayAnchor) -> Self
Point the panel at the trigger’s captured rect — what width-matches it to the field (see the module docs).
Sourcepub fn selected(self, selected: Vec<String>) -> Self
pub fn selected(self, selected: Vec<String>) -> Self
Hand the panel the app-confirmed selection (option values).
Sourcepub fn max_selections(self, max: usize) -> Self
pub fn max_selections(self, max: usize) -> Self
Cap a multi-select at max options; 0 is unlimited.
Sourcepub fn query(self, query: impl Into<String>) -> Self
pub fn query(self, query: impl Into<String>) -> Self
Hand the panel the app-confirmed filter query.
Sourcepub fn searchable(self, searchable: bool) -> Self
pub fn searchable(self, searchable: bool) -> Self
Show the search field above the option list.
Sourcepub fn error(self, error: Option<String>) -> Self
pub fn error(self, error: Option<String>) -> Self
Show a load failure instead of the option list.
Sourcepub fn empty_text(self, text: impl Into<String>) -> Self
pub fn empty_text(self, text: impl Into<String>) -> Self
Replace the empty-state message.
Sourcepub fn max_height(self, max_height: f64) -> Self
pub fn max_height(self, max_height: f64) -> Self
Cap the panel’s height, past which the option list scrolls.
Sourcepub fn open(self, open: bool) -> Self
pub fn open(self, open: bool) -> Self
Tell the panel whether its host is open. false clears the keyboard
highlight and the press machine on the spot; the default is true.
Sourcepub fn on_open<F: Fn(&mut State, bool) + 'static>(self, on_open: F) -> Self
pub fn on_open<F: Fn(&mut State, bool) + 'static>(self, on_open: F) -> Self
Set the open callback — fired with false after a single-select pick.
Sourcepub fn on_query<F: Fn(&mut State, String) + 'static>(self, on_query: F) -> Self
pub fn on_query<F: Fn(&mut State, String) + 'static>(self, on_query: F) -> Self
Set the query callback: each edit of the search field reports the text it requests.
Trait Implementations§
Source§impl<State: 'static> View<State> for DropdownPanelView<State>
impl<State: 'static> View<State> for DropdownPanelView<State>
Source§type Element = DropdownPanelWidget
type Element = DropdownPanelWidget
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> DropdownPanelWidget
fn build(&self, ctx: &mut BuildCtx<'_>) -> DropdownPanelWidget
Source§fn rebuild(
&self,
prev: &Self,
element: &mut DropdownPanelWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &Self, element: &mut DropdownPanelWidget, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State> !RefUnwindSafe for DropdownPanelView<State>
impl<State> !Send for DropdownPanelView<State>
impl<State> !Sync for DropdownPanelView<State>
impl<State> !UnwindSafe for DropdownPanelView<State>
impl<State> Freeze for DropdownPanelView<State>
impl<State> Unpin for DropdownPanelView<State>
impl<State> UnsafeUnpin for DropdownPanelView<State>where
Rc<dyn Fn(&mut State, Vec<String>)>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State, bool)>>: UnsafeUnpin,
Option<Rc<dyn Fn(&mut State, String)>>: UnsafeUnpin,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Source§impl<State, V> ViewSeq<State, One> for Vwhere
State: 'static,
V: View<State>,
impl<State, V> ViewSeq<State, One> for Vwhere
State: 'static,
V: View<State>,
Source§fn extend_views(self, out: &mut Vec<AnyView<State>>)
fn extend_views(self, out: &mut Vec<AnyView<State>>)
out — erasing each
with AnyView::new (a no-op for an element already an AnyView).