etui/widgets/scrollbar

Types

Scrollbar configuration.

pub type Scrollbar {
  Scrollbar(
    total: Int,
    visible: Int,
    offset: Int,
    track_char: String,
    thumb_char: String,
    arrow_start: String,
    arrow_end: String,
    fg: style.Color,
    bg: style.Color,
    thumb_fg: style.Color,
    thumb_bg: style.Color,
  )
}

Constructors

  • Scrollbar(
      total: Int,
      visible: Int,
      offset: Int,
      track_char: String,
      thumb_char: String,
      arrow_start: String,
      arrow_end: String,
      fg: style.Color,
      bg: style.Color,
      thumb_fg: style.Color,
      thumb_bg: style.Color,
    )

    Arguments

    total

    Total number of items in the list.

    visible

    Number of items visible at once (viewport height/width).

    offset

    Current scroll offset (index of first visible item).

    track_char

    Track character (unfilled area).

    thumb_char

    Thumb character (filled/active area).

    arrow_start

    Arrow characters at start and end. "" = no arrows.

Values

pub fn render_horizontal(
  buf: buffer.Buffer,
  area: geometry.Rect,
  s: Scrollbar,
) -> buffer.Buffer

Render a horizontal scrollbar into the first row of area. Arrow characters (if non-empty) occupy the leftmost and rightmost cells; the track fills the remaining width.

pub fn render_vertical(
  buf: buffer.Buffer,
  area: geometry.Rect,
  s: Scrollbar,
) -> buffer.Buffer

Render a vertical scrollbar into the first column of area. Arrow characters (if non-empty) occupy the top and bottom cells; the track fills the remaining height.

pub fn scrollbar_new(
  total: Int,
  visible: Int,
  offset: Int,
) -> Scrollbar

New scrollbar. total = total items, visible = viewport size, offset = first visible item index.

pub fn with_arrows(
  s: Scrollbar,
  start: String,
  end_ch: String,
) -> Scrollbar

Override arrow characters. Pass "" to hide arrows.

pub fn with_chars(
  s: Scrollbar,
  track: String,
  thumb: String,
) -> Scrollbar

Override track and thumb characters.

pub fn with_colors(
  s: Scrollbar,
  fg: style.Color,
  bg: style.Color,
) -> Scrollbar

Set colors for the track.

pub fn with_thumb_colors(
  s: Scrollbar,
  fg: style.Color,
  bg: style.Color,
) -> Scrollbar

Set colors for the thumb.

Search Document