Struct cursive_extras::AdvancedSelectView
source · 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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.