SelectorSetting

class SelectorSetting<T : Options, Enum<T>>(name: String, val default: T, val options: Array<out T>, visibility: Visibility = Visibility.VISIBLE, description: String? = null) : Setting<T>

A setting which allows for a selection out of a given set of options.

In most cases it is more convenient to use the factory function which acts as a constructor which omits the options parameter.

Author

Aton

Constructors

Link copied to clipboard
fun <T : Options, Enum<T>> SelectorSetting(name: String, default: T, options: Array<out T>, visibility: Visibility = Visibility.VISIBLE, description: String? = null)

Functions

Link copied to clipboard
open operator override fun getValue(thisRef: Module, property: KProperty<*>): T

This method acts as the getter for the property delegated to this class.

Link copied to clipboard
fun isSelected(option: Options): Boolean
Link copied to clipboard
open operator override fun provideDelegate(thisRef: Module, property: KProperty<*>): ReadWriteProperty<Module, T>

This operator provides the Delegate to the Setting.

Link copied to clipboard
open fun reset()

Sets value to default.

Link copied to clipboard
open operator override fun setValue(thisRef: Module, property: KProperty<*>, value: T)

This method acts as the setter for the property delegated to this class.

Properties

Link copied to clipboard
open override val default: T

The default for value.

Link copied to clipboard
Link copied to clipboard
var index: Int
Link copied to clipboard
Link copied to clipboard
val options: Array<out T>
Link copied to clipboard
var processInput: (T) -> T

Can be set to add a setting specific restraint / extra action when setting the new value.

Link copied to clipboard

displayName of the selected Enum. Can be used to set value based on the displayName of the Enum. This is required for loading data from the config. If possible value should be directly instead.

Link copied to clipboard

Returns whether this setting should be visible based on visibilityDependency. Is true by default. Use withDependency to change this behavior.

Link copied to clipboard
open override var value: T

This is the main field used to store the state of the setting. There can be additional properties for managing the state in the implementations.

Link copied to clipboard