electron/docs/api/touch-bar-scrubber.md

60 lines
2.5 KiB
Markdown
Raw Normal View History

2017-03-13 00:00:25 +00:00
## Class: TouchBarScrubber
> Create a scrubber (a scrollablbe selector)
Process: [Main](../tutorial/quick-start.md#main-process)
### `new TouchBarScrubber(options)`
* `options` Object
* `items` [ScrubberItem[]](structures/scrubber-item.md) - An array of items to place in this scruber
* `onSelect` Function - Called when the user taps an item that was not the last tapped item
* `selectedIndex` - The index of the item the user selected
* `onHightlight` Function - Called when the user taps any item
* `highlightedIndex` - The index of the item the user touched
### Instance Properties
The following properties are available on instances of `TouchBarScrubber`:
#### `touchBarSegmentedControl.items`
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
#### `touchBarSegmentedControl.selectedStyle`
A `String` representing the style that selected items in the scrubber should have. Updating this value immediately
updates the control in the touch bar. Possible values:
* `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`
* `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`
* `null` - Actually null, not a string, removes all styles
#### `touchBarSegmentedControl.overlayStyle`
A `String` retpresenting 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
touch bar. Possible values:
* `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`
* `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`
* `null` - Actually null, not a string, removes all styles
#### `touchBarSegmentedControl.showArrowButtons`
A `Boolean` representing whether to show the left / right selection arrows in this scrubber. Updating this value
immediately updates the control in the touch bar.
#### `touchBarSegmentedControl.mode`
A `String` representing the mode of this scrubber. Updating this value immediately
updates the control in the touch bar. Possible values:
* `fixed` - Maps to `NSScrubberModeFixed`
* `free` - Maps to `NSScrubberModeFree`
#### `touchBarSegmentedControl.continuous`
A `Boolean` representing whether this scrubber is continous or not. Updating this value immediately
updates the control in the touch bar.