[−][src]Trait rubrail::TScrubberData
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
fn count(&self, item: ItemId) -> u32
fn text(&self, item: ItemId, idx: u32) -> String
Returns the text of the given index in the scrubber
Arguments
item
- TheItemId
of the interacting scrubberidx
- The index of the relevant item in the scrubber
fn width(&self, item: ItemId, idx: u32) -> u32
Returns the width (in pixels) of the given index in the scrubber
Arguments
item
- TheItemId
of the interacting scrubberidx
- The index of the relevant item in the scrubber
fn touch(&self, item: ItemId, idx: u32)
Called when the given index in the scrubber is selected
Arguments
item
- TheItemId
of the interacting scrubberidx
- The index of the relevant item in the scrubber