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.

Construct a new instance with explicit direction

Construct a new instance with explicit view

Set the direction of contents

Construct a new instance with explicit direction and view

Access the stored data

Mutably access the stored data

It may be necessary to use ListView::update_view to update the view of this data.

Get a copy of the shared value at key

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

Get the direction of contents

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Type of message returned by this widget Read more

Generic handler: translate presses to activations Read more

Generic handler: focus rect on key navigation Read more

Handle an event and return a user-defined message Read more

Get size rules for the given axis Read more

Apply a given rect to self Read more

Navigation in spatial order Read more

Find a widget by coordinate Read more

Draw a widget and its children Read more

Get translation of a child Read more

Given size size, returns whether (horiz, vert) scrolling is required

Get the maximum scroll offset Read more

Get the current scroll offset Read more

Set the scroll offset Read more

Scroll by a delta Read more

Send an event Read more

Get the first identifier of self or any children Read more

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

Configure widget Read more

Configure self and children Read more

Is this widget navigable via Tab key? Read more

Does this widget have hover-state highlighting? Read more

Which cursor icon should be used on hover? Read more

Get self as type Any

Get self as type Any (mutable)

Get direct access to the CoreData providing property storage.

Get the name of the widget struct

Erase type

Erase type

Get the widget’s numeric identifier

Get whether the widget is disabled

Set the disabled state of a widget Read more

Set disabled state (chaining) Read more

Get the widget’s region, relative to its parent.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Cast from Self to T

Try converting from Self to T

Cast to integer, truncating Read more

Cast to the nearest integer Read more

Cast the floor to an integer Read more

Cast the ceiling to an integer Read more

Try converting to integer with truncation Read more

Try converting to the nearest integer Read more

Try converting the floor to an integer Read more

Try convert the ceiling to an integer Read more

Convert from T to Self

Try converting from T to Self

Returns true if the given item matches this filter

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.