scoop:scoop.ui:0.1.0
src/text/menu/options.scoop
Selected production source · src/text/menu/options.scoop
1
package scoop.ui.text3
import scoop.window.TextContextMenuLabels5
public enum TextContextMenuMode {6
Disabled, StandardNative, PreferSystem7
}9
public enum TextContextMenuSelection {10
Platform, Preserve, PlaceCaret, SelectWord11
}13
/** Native menus use the same document, policy, selection and history as the host. */14
public struct TextContextMenuOptions(15
val mode: TextContextMenuMode = TextContextMenuMode.PreferSystem,16
val selection: TextContextMenuSelection = TextContextMenuSelection.Platform,17
val labels: TextContextMenuLabels? = None,18
val systemServices: Boolean = true19
)21
public class TextContextMenuOptionsBuilder internal constructor(value: TextContextMenuOptions) {22
public var mode: TextContextMenuMode = value.mode23
public var selection: TextContextMenuSelection = value.selection24
public var labels: TextContextMenuLabels? = value.labels25
public var systemServices: Boolean = value.systemServices26
internal fun snapshot(): TextContextMenuOptions =27
TextContextMenuOptions(mode, selection, labels, systemServices)28
}30
public fun textContextMenu(31
configure: TextContextMenuOptionsBuilder.() -> Unit = {}32
): TextContextMenuOptions = TextContextMenuOptions().copy(configure)34
public fun TextContextMenuOptions.copy(35
configure: TextContextMenuOptionsBuilder.() -> Unit36
): TextContextMenuOptions {37
val builder = TextContextMenuOptionsBuilder(this)38
builder.configure()39
return builder.snapshot()40
}