From e6a66b6006103817ff4275df3b793344bb3b5d87 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 10 Mar 2017 17:50:23 +1100 Subject: [PATCH] Add docs for segmented control touch bar item --- .../structures/segmented-control-segment.md | 5 +++ docs/api/touch-bar-segmented-control.md | 41 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 docs/api/structures/segmented-control-segment.md create mode 100644 docs/api/touch-bar-segmented-control.md diff --git a/docs/api/structures/segmented-control-segment.md b/docs/api/structures/segmented-control-segment.md new file mode 100644 index 000000000000..ae01a07f32d2 --- /dev/null +++ b/docs/api/structures/segmented-control-segment.md @@ -0,0 +1,5 @@ +# SegmentedControlSegment Object + +* `label` String - (Optional) The text to appear in this segment +* `icon` NativeImage - (Optional) The image to appear in this segment +* `enabled` Boolean - (Optional) Whether this segment is selectable. Default: true diff --git a/docs/api/touch-bar-segmented-control.md b/docs/api/touch-bar-segmented-control.md new file mode 100644 index 000000000000..8f30f77169e8 --- /dev/null +++ b/docs/api/touch-bar-segmented-control.md @@ -0,0 +1,41 @@ +## Class: TouchBarSegmentedControl + +> Create a segmented control (a button group) where one button has a selected state + +Process: [Main](../tutorial/quick-start.md#main-process) + +### `new TouchBarSegmentedControl(options)` + +* `options` Object + * `segmentStyle` String - (Optional) Style of the segments: + * `automatic` - Default + * `rounded` + * `textured-rounded` + * `round-rect` + * `textured-square` + * `capsule` + * `small-square` + * `separated` + * `segments` [SegmentedControlSegment[]](structures/segmented-control-segment.md) - An array of segments to place in this control + * `selectedIndex` Integer (Optional) - The index of the currently selected segment, will update automatically with user interaction + * `change` Function - Called when the user selects a new segment + * `selectedIndex` - The index of the segment the user selected + +### Instance Properties + +The following properties are available on instances of `TouchBarSegmentedControl`: + +#### `touchBarSegmentedControl.segmentStyle` + +A `String` representing the controls current segment style. Updating this value immediately updates the control +in the touch bar. + +#### `touchBarSegmentedControl.segments` + +A `SegmentedControlSegment[]` array representing the segments in this control. Updating this value immediately +updates the control in the touch bar. Updating deep properties inside this array **does not update the touch bar**. + +#### `touchBarSegmentedControl.selectedIndex` + +An `Integer` representing the currently selected segment. Changing this value immediately updates the control +in the touch bar. User interaction with the touch bar will update this value automatically.