pub struct AdvancedSelectView<T = String>where
T: 'static,{ /* private fields */ }
Expand description
A view that is a lot like a SelectView
but allows mutable access to the selection
and allows multiline items
Implementations§
Source§impl<T> AdvancedSelectView<T>where
T: 'static,
impl<T> AdvancedSelectView<T>where
T: 'static,
Source§impl AdvancedSelectView
impl AdvancedSelectView
Sourcepub fn add_item_str<S: Display>(&mut self, label: S)
pub fn add_item_str<S: Display>(&mut self, label: S)
Add an item with the label as the value
Sourcepub fn item_str<S: Display>(self, label: S) -> Self
pub fn item_str<S: Display>(self, label: S) -> Self
Add an item with the label as the value
Chainable variant
Sourcepub fn insert_item_str<S: Display>(&mut self, index: usize, label: S)
pub fn insert_item_str<S: Display>(&mut self, index: usize, label: S)
Insert an item with the label as the value
Sourcepub fn add_all_str<S, I>(&mut self, iter: I)where
S: Display,
I: IntoIterator<Item = S>,
pub fn add_all_str<S, I>(&mut self, iter: I)where
S: Display,
I: IntoIterator<Item = S>,
Add all the strings from a string iterator
Sourcepub fn with_all_str<S, I>(self, iter: I) -> Selfwhere
S: Display,
I: IntoIterator<Item = S>,
pub fn with_all_str<S, I>(self, iter: I) -> Selfwhere
S: Display,
I: IntoIterator<Item = S>,
Add all the strings from a string iterator
Chainable version
Source§impl<T: Ord + 'static> AdvancedSelectView<T>
impl<T: Ord + 'static> AdvancedSelectView<T>
Source§impl<T: Send + Sync + 'static> AdvancedSelectView<T>
impl<T: Send + Sync + 'static> AdvancedSelectView<T>
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable this view.
Sourcepub fn with_enabled(self, is_enabled: bool) -> Self
pub fn with_enabled(self, is_enabled: bool) -> Self
Enable or disable this view.
Chainable variant.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true
if this view is enabled.
Sourcepub fn new() -> AdvancedSelectView<T>
pub fn new() -> AdvancedSelectView<T>
Create a new AdvancedSelectView
Sourcepub fn set_on_select<F: Fn(&mut Cursive, &T) + Send + Sync + 'static>(
&mut self,
cb: F,
)
pub fn set_on_select<F: Fn(&mut Cursive, &T) + Send + Sync + 'static>( &mut self, cb: F, )
Set the select callback
Sourcepub fn on_select<F: Fn(&mut Cursive, &T) + Send + Sync + 'static>(
self,
cb: F,
) -> Self
pub fn on_select<F: Fn(&mut Cursive, &T) + Send + Sync + 'static>( self, cb: F, ) -> Self
Set the select callback
Chainable variant
Sourcepub fn set_on_submit<F: Fn(&mut Cursive, &T) + Send + Sync + 'static>(
&mut self,
cb: F,
)
pub fn set_on_submit<F: Fn(&mut Cursive, &T) + Send + Sync + 'static>( &mut self, cb: F, )
Set the callback when Enter is pressed
Sourcepub fn on_submit<F: Fn(&mut Cursive, &T) + Send + Sync + 'static>(
self,
cb: F,
) -> Self
pub fn on_submit<F: Fn(&mut Cursive, &T) + Send + Sync + 'static>( self, cb: F, ) -> Self
Set the callback when Enter is pressed
Chainable variant
Sourcepub fn selection_mut(&mut self) -> Option<&mut T>
pub fn selection_mut(&mut self) -> Option<&mut T>
The current selection as a mutable reference
Returns None
if the view is empty
Sourcepub fn selected_index(&self) -> usize
pub fn selected_index(&self) -> usize
The index of the current selection
Sourcepub fn selected_label(&self) -> Option<&StyledString>
pub fn selected_label(&self) -> Option<&StyledString>
The label of the current selected item
Sourcepub fn selected_label_mut(&mut self) -> Option<&mut StyledString>
pub fn selected_label_mut(&mut self) -> Option<&mut StyledString>
The label of the current selected item
Sourcepub fn set_selection(&mut self, index: usize)
pub fn set_selection(&mut self, index: usize)
Set the selected item index
Sourcepub fn add_item<L: Into<StyledString>>(&mut self, label: L, item: T)
pub fn add_item<L: Into<StyledString>>(&mut self, label: L, item: T)
Add an item to this view
Sourcepub fn item<L: Into<StyledString>>(self, label: L, item: T) -> Self
pub fn item<L: Into<StyledString>>(self, label: L, item: T) -> Self
Add an item to this view
Chainable variant
Sourcepub fn get_item_mut(
&mut self,
index: usize,
) -> Option<(&mut StyledString, &mut T)>
pub fn get_item_mut( &mut self, index: usize, ) -> Option<(&mut StyledString, &mut T)>
Get an item (mutable reference) at the index
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (&StyledString, &T)> + DoubleEndedIterator + ExactSizeIterator
pub fn iter( &self, ) -> impl Iterator<Item = (&StyledString, &T)> + DoubleEndedIterator + ExactSizeIterator
Iterate over all the items
Sourcepub fn iter_mut(
&mut self,
) -> impl Iterator<Item = (&mut StyledString, &mut T)> + DoubleEndedIterator + ExactSizeIteratorwhere
T: Clone,
pub fn iter_mut(
&mut self,
) -> impl Iterator<Item = (&mut StyledString, &mut T)> + DoubleEndedIterator + ExactSizeIteratorwhere
T: Clone,
Iterate over all the items with mutability
Sourcepub fn remove_item(&mut self, index: usize)
pub fn remove_item(&mut self, index: usize)
Remove an item at a specific index
Sourcepub fn insert_item<L: Into<StyledString>>(
&mut self,
index: usize,
label: L,
item: T,
)
pub fn insert_item<L: Into<StyledString>>( &mut self, index: usize, label: L, item: T, )
Insert an item at a specific index
Sourcepub fn label_sort(&mut self)
pub fn label_sort(&mut self)
Sort the view by label
Sourcepub fn sort_by_key<K, F>(&mut self, key_of: F)
pub fn sort_by_key<K, F>(&mut self, key_of: F)
Sort the view with a key extraction function
Sourcepub fn move_item_up(&mut self, index: usize)
pub fn move_item_up(&mut self, index: usize)
Move an item up in the view
Sourcepub fn move_item_down(&mut self, index: usize)
pub fn move_item_down(&mut self, index: usize)
Move an item down in the view
Trait Implementations§
Source§impl<T> Clone for AdvancedSelectView<T>where
T: 'static + Clone,
impl<T> Clone for AdvancedSelectView<T>where
T: 'static + Clone,
Source§fn clone(&self) -> AdvancedSelectView<T>
fn clone(&self) -> AdvancedSelectView<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: Send + Sync + 'static> View for AdvancedSelectView<T>
impl<T: Send + Sync + 'static> View for AdvancedSelectView<T>
Source§fn draw(&self, printer: &Printer<'_, '_>)
fn draw(&self, printer: &Printer<'_, '_>)
Source§fn required_size(&mut self, bound: Vec2) -> Vec2
fn required_size(&mut self, bound: Vec2) -> Vec2
Source§fn layout(&mut self, size: Vec2)
fn layout(&mut self, size: Vec2)
Source§fn take_focus(&mut self, dir: Direction) -> Result<EventResult, CannotFocus>
fn take_focus(&mut self, dir: Direction) -> Result<EventResult, CannotFocus>
Source§fn on_event(&mut self, event: Event) -> EventResult
fn on_event(&mut self, event: Event) -> EventResult
Source§fn important_area(&self, size: Vec2) -> Rect
fn important_area(&self, size: Vec2) -> Rect
Source§fn needs_relayout(&self) -> bool
fn needs_relayout(&self) -> bool
Source§fn call_on_any(
&mut self,
_: &Selector<'_>,
_: &mut dyn FnMut(&mut (dyn View + 'static)),
)
fn call_on_any( &mut self, _: &Selector<'_>, _: &mut dyn FnMut(&mut (dyn View + 'static)), )
Source§fn focus_view(&mut self, _: &Selector<'_>) -> Result<EventResult, ViewNotFound>
fn focus_view(&mut self, _: &Selector<'_>) -> Result<EventResult, ViewNotFound>
Auto Trait Implementations§
impl<T> Freeze for AdvancedSelectView<T>
impl<T = String> !RefUnwindSafe for AdvancedSelectView<T>
impl<T> Send for AdvancedSelectView<T>
impl<T> Sync for AdvancedSelectView<T>
impl<T> Unpin for AdvancedSelectView<T>
impl<T = String> !UnwindSafe for AdvancedSelectView<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Finder for Twhere
T: View,
impl<T> Finder for Twhere
T: View,
Source§fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
sel
. Read moreSource§fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
sel
. Read moreSource§fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
call_on
with a view::Selector::Name
.Source§impl<T> IntoBoxedView for Twhere
T: View,
impl<T> IntoBoxedView for Twhere
T: View,
Source§fn into_boxed_view(self) -> Box<dyn View>
fn into_boxed_view(self) -> Box<dyn View>
Box<View>
.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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.Source§impl<T> Resizable for Twhere
T: View,
impl<T> Resizable for Twhere
T: View,
Source§fn resized(
self,
width: SizeConstraint,
height: SizeConstraint,
) -> ResizedView<Self>
fn resized( self, width: SizeConstraint, height: SizeConstraint, ) -> ResizedView<Self>
self
in a ResizedView
with the given size constraints.Source§fn fixed_size<S>(self, size: S) -> ResizedView<Self>
fn fixed_size<S>(self, size: S) -> ResizedView<Self>
self
into a fixed-size ResizedView
.Source§fn fixed_width(self, width: usize) -> ResizedView<Self>
fn fixed_width(self, width: usize) -> ResizedView<Self>
self
into a fixed-width ResizedView
.Source§fn fixed_height(self, height: usize) -> ResizedView<Self>
fn fixed_height(self, height: usize) -> ResizedView<Self>
self
into a fixed-width ResizedView
.Source§fn full_screen(self) -> ResizedView<Self>
fn full_screen(self) -> ResizedView<Self>
self
into a full-screen ResizedView
.Source§fn full_width(self) -> ResizedView<Self>
fn full_width(self) -> ResizedView<Self>
self
into a full-width ResizedView
.Source§fn full_height(self) -> ResizedView<Self>
fn full_height(self) -> ResizedView<Self>
self
into a full-height ResizedView
.Source§fn max_size<S>(self, size: S) -> ResizedView<Self>
fn max_size<S>(self, size: S) -> ResizedView<Self>
self
into a limited-size ResizedView
.Source§fn max_width(self, max_width: usize) -> ResizedView<Self>
fn max_width(self, max_width: usize) -> ResizedView<Self>
self
into a limited-width ResizedView
.Source§fn max_height(self, max_height: usize) -> ResizedView<Self>
fn max_height(self, max_height: usize) -> ResizedView<Self>
self
into a limited-height ResizedView
.Source§fn min_size<S>(self, size: S) -> ResizedView<Self>
fn min_size<S>(self, size: S) -> ResizedView<Self>
self
into a ResizedView
at least sized size
.Source§fn min_width(self, min_width: usize) -> ResizedView<Self>
fn min_width(self, min_width: usize) -> ResizedView<Self>
self
in a ResizedView
at least min_width
wide.Source§fn min_height(self, min_height: usize) -> ResizedView<Self>
fn min_height(self, min_height: usize) -> ResizedView<Self>
self
in a ResizedView
at least min_height
tall.Source§impl<T> Scrollable for Twhere
T: View,
impl<T> Scrollable for Twhere
T: View,
Source§fn scrollable(self) -> ScrollView<Self>
fn scrollable(self) -> ScrollView<Self>
self
in a ScrollView
.