Skip to main content

Class: UserSettingToggleController<T, K>

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingToggleController.ts:8

A controller which binds a setting that can take one of several enumerated values to an ArrowToggle component.

Extends​

Type Parameters​

Type Parameter
T extends UserSettingRecord
K extends keyof T & string

Constructors​

Constructor​

new UserSettingToggleController<T, K>(settingManager, settingName, values): UserSettingToggleController<T, K>

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingToggleController.ts:27

Constructor.

Parameters​

ParameterTypeDescription
settingManagerUserSettingManager<T>This controller's settings manager.
settingNameKThe name of the setting associated with this controller.
valuesToNonNullable<PropertyTypeOf<T, K>>[]An array of values this controller can assign to its setting.

Returns​

UserSettingToggleController<T, K>

Overrides​

UserSettingController.constructor

Properties​

optionSelectedHandler()​

optionSelectedHandler: (index) => void

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingToggleController.ts:19

A function which handles value selected events from the ArrowToggle component which this controller controls. This handler should be passed to the ArrowToggle component via its onOptionSelected prop.

A callback which is called when an option is selected using the ArrowToggle component.

Parameters​

ParameterTypeDescription
indexnumberThe index of the selected option.

Returns​

void


selectedIndexSub​

readonly selectedIndexSub: Subject<number>

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingToggleController.ts:13

A subject which provides a selected index for the ArrowToggle component which this controller controls. This subject should be passed to the ArrowToggle component via its dataref prop.


setting​

readonly setting: UserSetting<ToNonNullable<PropertyTypeOf<T, K>>>

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingController.ts:8

The setting associated with this controller.

Inherited from​

UserSettingController.setting


settingManager​

readonly settingManager: UserSettingManager<T>

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingToggleController.ts:28

This controller's settings manager.

Inherited from​

UserSettingController.settingManager


settingName​

readonly settingName: K

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingToggleController.ts:29

The name of the setting associated with this controller.

Inherited from​

UserSettingController.settingName


values​

readonly values: ToNonNullable<PropertyTypeOf<T, K>>[]

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingToggleController.ts:30

An array of values this controller can assign to its setting.

Methods​

init()​

init(): void

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingController.ts:23

Initializes this controller. This will immediately change the state of this controller's control component to reflect the current value of this controller's setting. Furthermore, any future changes to the setting's value will be synced to the control component.

Returns​

void

Inherited from​

UserSettingController.init


onSettingChanged()​

protected onSettingChanged(value): void

Defined in: workingtitle-instruments-g1000/html_ui/Shared/UI/UserSettings/UserSettingToggleController.ts:36

A callback which is called when value of this control's setting is changed.

Parameters​

ParameterTypeDescription
valueToNonNullable<PropertyTypeOf<T, K>>The new value of the setting.

Returns​

void

Overrides​

UserSettingController.onSettingChanged