2017-03-13 00:00:25 +00:00
|
|
|
## Class: TouchBarScrubber
|
|
|
|
|
2017-03-14 21:02:48 +00:00
|
|
|
> Create a scrubber (a scrollable selector)
|
2017-03-13 00:00:25 +00:00
|
|
|
|
|
|
|
Process: [Main](../tutorial/quick-start.md#main-process)
|
|
|
|
|
2017-03-17 17:38:15 +00:00
|
|
|
### `new TouchBarScrubber(options)` _Experimental_
|
2017-03-13 00:00:25 +00:00
|
|
|
|
|
|
|
* `options` Object
|
2017-11-29 10:38:35 +00:00
|
|
|
* `items` [ScrubberItem[]](structures/scrubber-item.md) - An array of items to place in this scrubber.
|
|
|
|
* `select` Function - Called when the user taps an item that was not the last tapped item.
|
|
|
|
* `selectedIndex` Integer - The index of the item the user selected.
|
|
|
|
* `highlight` Function - Called when the user taps any item.
|
|
|
|
* `highlightedIndex` Integer - The index of the item the user touched.
|
2017-03-14 21:12:41 +00:00
|
|
|
* `selectedStyle` String - Selected item style. Defaults to `null`.
|
|
|
|
* `overlayStyle` String - Selected overlay item style. Defaults to `null`.
|
|
|
|
* `showArrowButtons` Boolean - Defaults to `false`.
|
|
|
|
* `mode` String - Defaults to `free`.
|
|
|
|
* `continuous` Boolean - Defaults to `true`.
|
2017-03-13 00:00:25 +00:00
|
|
|
|
|
|
|
### Instance Properties
|
|
|
|
|
|
|
|
The following properties are available on instances of `TouchBarScrubber`:
|
|
|
|
|
2017-07-27 05:51:19 +00:00
|
|
|
#### `touchBarScrubber.items`
|
2017-03-13 00:00:25 +00:00
|
|
|
|
2017-03-14 21:12:41 +00:00
|
|
|
A `ScrubberItem[]` array representing the items in this scrubber. Updating this value immediately
|
|
|
|
updates the control in the touch bar. Updating deep properties inside this array **does not update the touch bar**.
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-07-27 05:51:19 +00:00
|
|
|
#### `touchBarScrubber.selectedStyle`
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-03-14 21:12:41 +00:00
|
|
|
A `String` representing the style that selected items in the scrubber should have. Updating this value immediately
|
2017-11-29 10:58:24 +00:00
|
|
|
updates the control in the touch bar. Possible values:
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-11-29 10:38:35 +00:00
|
|
|
* `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
|
|
|
|
* `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
|
|
|
|
* `null` - Actually null, not a string, removes all styles.
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-07-27 05:51:19 +00:00
|
|
|
#### `touchBarScrubber.overlayStyle`
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-03-14 21:12:41 +00:00
|
|
|
A `String` representing the style that selected items in the scrubber should have. This style is overlayed on top
|
|
|
|
of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the
|
2017-11-29 10:58:24 +00:00
|
|
|
touch bar. Possible values:
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-11-29 10:38:35 +00:00
|
|
|
* `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
|
|
|
|
* `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
|
|
|
|
* `null` - Actually null, not a string, removes all styles.
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-07-27 05:51:19 +00:00
|
|
|
#### `touchBarScrubber.showArrowButtons`
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-03-14 21:12:41 +00:00
|
|
|
A `Boolean` representing whether to show the left / right selection arrows in this scrubber. Updating this value
|
2017-11-29 10:58:24 +00:00
|
|
|
immediately updates the control in the touch bar.
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-07-27 05:51:19 +00:00
|
|
|
#### `touchBarScrubber.mode`
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-03-14 21:12:41 +00:00
|
|
|
A `String` representing the mode of this scrubber. Updating this value immediately
|
|
|
|
updates the control in the touch bar. Possible values:
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-11-29 10:38:35 +00:00
|
|
|
* `fixed` - Maps to `NSScrubberModeFixed`.
|
|
|
|
* `free` - Maps to `NSScrubberModeFree`.
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-07-27 05:51:19 +00:00
|
|
|
#### `touchBarScrubber.continuous`
|
2017-03-14 07:57:57 +00:00
|
|
|
|
2017-03-14 21:12:41 +00:00
|
|
|
A `Boolean` representing whether this scrubber is continuous or not. Updating this value immediately
|
2017-03-14 21:02:48 +00:00
|
|
|
updates the control in the touch bar.
|