Trait rubrail::TScrubberData [] [src]

pub trait TScrubberData {
    fn count(&self, item: ItemId) -> u32;
fn text(&self, item: ItemId, idx: u32) -> String;
fn width(&self, item: ItemId, idx: u32) -> u32;
fn touch(&self, item: ItemId, idx: u32); }

The callback API for managing data in a Scrubber

The Touch Bar supports a UI element called a 'scrubber', which is a horizontally scrolling widget filled with items which can be dynamically changed, and selected. This is the primary interface for choosing from a list of (possibly dynamic) options.

Since the contents of a scrubber are dynamic, the scrubber fills in its data on request through a series of callbacks. A type that implements TScrubberData provides all of the callbacks that a scrubber needs to present its options.

See the examples for usage.

Required Methods

Returns the number of items in the scrubber

Arguments

  • item - The ItemId of the interacting scrubber

Returns the text of the given index in the scrubber

Arguments

  • item - The ItemId of the interacting scrubber
  • idx - The index of the relevant item in the scrubber

Returns the width (in pixels) of the given index in the scrubber

Arguments

  • item - The ItemId of the interacting scrubber
  • idx - The index of the relevant item in the scrubber

Called when the given index in the scrubber is selected

Arguments

  • item - The ItemId of the interacting scrubber
  • idx - The index of the relevant item in the scrubber

Implementors