etui/widgets/multi_select

Types

selected is kept sorted ascending and contains unique indices.

pub type MultiSelectState {
  MultiSelectState(cursor: Int, selected: List(Int), offset: Int)
}

Constructors

  • MultiSelectState(cursor: Int, selected: List(Int), offset: Int)
pub type MultiSelectWidget {
  MultiSelectWidget(
    items: List(String),
    cursor_style: style.Style,
    selected_style: style.Style,
    checked_mark: String,
    unchecked_mark: String,
    cursor_mark: String,
    max: Int,
    fg: style.Color,
    bg: style.Color,
  )
}

Constructors

Values

pub fn clear_selection(
  state: MultiSelectState,
) -> MultiSelectState
pub fn effective_offset(
  state: MultiSelectState,
  height: Int,
) -> Int

Effective scroll offset for a viewport of height rows.

pub fn is_selected(state: MultiSelectState, idx: Int) -> Bool
pub fn multi_select_new(items: List(String)) -> MultiSelectWidget
pub fn select_next(
  state: MultiSelectState,
  item_count: Int,
) -> MultiSelectState
pub fn selected_indices(state: MultiSelectState) -> List(Int)
pub fn selected_values(
  items: List(String),
  state: MultiSelectState,
) -> List(String)

Pull the selected item strings in original order.

pub fn state_new() -> MultiSelectState
pub fn toggle(
  state: MultiSelectState,
  max: Int,
) -> MultiSelectState

Toggle the cursor item. Respects max from the widget config.

pub fn with_cursor_mark(
  w: MultiSelectWidget,
  m: String,
) -> MultiSelectWidget
pub fn with_marks(
  w: MultiSelectWidget,
  checked: String,
  unchecked: String,
) -> MultiSelectWidget
pub fn with_max(
  w: MultiSelectWidget,
  m: Int,
) -> MultiSelectWidget

Cap the number of selected items. 0 = unlimited.

Search Document