Struct kas_widgets::view::ListView [−][src]
pub struct ListView<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg> + 'static, V: Driver<T::Item> = Default> { /* fields omitted */ }
Expand description
List view widget
This widget supports a view over a list of shared data items.
The shared data type T
must support ListData
and
UpdatableAll
, the latter with key type T::Key
and message type
matching the widget’s message. One may use kas::updatable::SharedRc
or a custom shared data type.
The driver V
must implement Driver
, with data type
<T as ListData>::Item
. Several implementations are available in the
driver
module or a custom implementation may be used.
This widget is Scrollable
, supporting keyboard, wheel and drag
scrolling. You may wish to wrap this widget with ScrollBars
.
Implementations
Construct a new instance
This constructor is available where the direction is determined by the
type: for D: Directional + Default
. In other cases, use
ListView::new_with_direction
.
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item> + Default> ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item> + Default> ListView<D, T, V>
Construct a new instance with explicit direction
impl<D: Directional + Default, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> ListView<D, T, V>
impl<D: Directional + Default, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> ListView<D, T, V>
Construct a new instance with explicit view
Set the direction of contents
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> ListView<D, T, V>
Construct a new instance with explicit direction and view
Mutably access the stored data
It may be necessary to use ListView::update_view
to update the view of this data.
Set shared data
This method updates the shared data, if supported (see
ListData::update
). Other widgets sharing this data are notified
of the update, if data is changed.
Update shared data
This is purely a convenience method over ListView::set_value
.
It does nothing if no value is found at key
.
It notifies other widgets of updates to the shared data.
Get the current selection mode
Set the current selection mode
Set the selection mode (inline)
Read the list of selected entries
With mode SelectionMode::Single
this may contain zero or one entry;
use selected_iter().next()
to extract only the first (optional) entry.
Check whether an entry is selected
Clear all selected items
Does not send ChildMsg
responses.
Directly select an item
Returns true
if selected, false
if already selected.
Fails if selection mode does not permit selection or if the key is
invalid.
Does not send ChildMsg
responses.
Directly deselect an item
Returns true
if deselected, false
if not previously selected.
Also returns false
on invalid keys.
Does not send ChildMsg
responses.
Manually trigger an update to handle changed data
Set the preferred number of items visible (inline)
This affects the (ideal) size request and whether children are sized according to their ideal or minimum size but not the minimum size.
Trait Implementations
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg> + 'static, V: Driver<T::Item>> Handler for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg> + 'static, V: Driver<T::Item>> Handler for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> Layout for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> Layout for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> Scrollable for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> Scrollable for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> SendEvent for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> SendEvent for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> WidgetChildren for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> WidgetChildren for ListView<D, T, V>
Record first identifier Read more
Get the number of child widgets
Get a reference to a child widget by index, or None
if the index is
out of bounds. Read more
Mutable variant of get Read more
Check whether id
is a descendant Read more
Find the child which is an ancestor of this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Walk through all widgets, calling f
once on each. Read more
Walk through all widgets, calling f
once on each. Read more
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> WidgetConfig for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg>, V: Driver<T::Item>> WidgetConfig for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg> + 'static, V: Driver<T::Item>> WidgetCore for ListView<D, T, V>
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg> + 'static, V: Driver<T::Item>> WidgetCore for ListView<D, T, V>
Get self as type Any
(mutable)
Get the name of the widget struct
Erase type
Erase type
Get whether the widget is disabled
Set the disabled state of a widget Read more
Set disabled state (chaining) Read more
Construct InputState
Read more
impl<D: Directional, T: ListData + UpdatableAll<T::Key, V::Msg> + 'static, V: Driver<T::Item>> Widget for ListView<D, T, V>
Auto Trait Implementations
impl<D, T, V> RefUnwindSafe for ListView<D, T, V> where
D: RefUnwindSafe,
T: RefUnwindSafe,
V: RefUnwindSafe,
<T as ListData>::Key: RefUnwindSafe,
<V as Driver<<T as ListData>::Item>>::Widget: RefUnwindSafe,
impl<D, T, V> Send for ListView<D, T, V> where
D: Send,
T: Send,
V: Send,
<T as ListData>::Key: Send,
<V as Driver<<T as ListData>::Item>>::Widget: Send,
impl<D, T, V> Sync for ListView<D, T, V> where
D: Sync,
T: Sync,
V: Sync,
<T as ListData>::Key: Sync,
<V as Driver<<T as ListData>::Item>>::Widget: Sync,
impl<D, T, V> Unpin for ListView<D, T, V> where
D: Unpin,
T: Unpin,
V: Unpin,
<T as ListData>::Key: Unpin,
<V as Driver<<T as ListData>::Item>>::Widget: Unpin,
impl<D, T, V> UnwindSafe for ListView<D, T, V> where
D: UnwindSafe,
T: UnwindSafe,
V: UnwindSafe,
<T as ListData>::Key: UnwindSafe,
<V as Driver<<T as ListData>::Item>>::Widget: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more