Skip to main content

Module list

Module list 

Source
Expand description

A list of rows the application draws, virtualised.

Experimental: may change in any release (docs/stability.md).

The application gives the rows (ListRows): how many, each one’s key (the selection is kept by key, so it survives the rows being sorted, filtered or changed) and label (its accessible name and what type-ahead searches), and draws each row in view. The list does the selection (single or multiple, Ctrl, Shift), the keyboard (arrows, Page Up/Down, Home/End, Space, Ctrl+A, type-ahead) and scrolling; a selection runs the list.select step. Enter or a double click on a row activates it (Signal::Activate); built with ListView::drag_out, a drag from a row carries rows out (Signal::DragOut).

use egui_pop_views::list::{ListRows, ListState, ListView};
use egui_pop_views::Mode;

struct Recent(Vec<(u64, String)>);

impl ListRows<u64> for Recent {
    fn len(&self) -> usize { self.0.len() }
    fn key(&self, row: usize) -> u64 { self.0[row].0 }
    fn label(&self, row: usize) -> String { self.0[row].1.clone() }
}

fn ui(ui: &mut egui::Ui, state: &mut ListState<u64>, rows: &mut Recent) {
    let out = ListView::new("recent").mode(Mode::Multiple).show(ui, state, rows);
    let _ = out.signals;
}

Structs§

ListOutput
What ListView::show returns.
ListState
A list’s state between passes.
ListView
The list widget.

Enums§

Signal
What happened in a list (or a table) this pass.

Traits§

ListRows
The rows a list shows; the application owns them.