Scoop API

scoop:scoop.ui:0.1.0

src/text/menu/options.scoop

Selected production source · src/text/menu/options.scoop

1package scoop.ui.text
3import scoop.window.TextContextMenuLabels
5public enum TextContextMenuMode {
6 Disabled, StandardNative, PreferSystem
7}
9public enum TextContextMenuSelection {
10 Platform, Preserve, PlaceCaret, SelectWord
13/** Native menus use the same document, policy, selection and history as the host. */
14public struct TextContextMenuOptions(
15 val mode: TextContextMenuMode = TextContextMenuMode.PreferSystem,
16 val selection: TextContextMenuSelection = TextContextMenuSelection.Platform,
17 val labels: TextContextMenuLabels? = None,
18 val systemServices: Boolean = true
21public class TextContextMenuOptionsBuilder internal constructor(value: TextContextMenuOptions) {
22 public var mode: TextContextMenuMode = value.mode
23 public var selection: TextContextMenuSelection = value.selection
24 public var labels: TextContextMenuLabels? = value.labels
25 public var systemServices: Boolean = value.systemServices
26 internal fun snapshot(): TextContextMenuOptions =
27 TextContextMenuOptions(mode, selection, labels, systemServices)
30public fun textContextMenu(
31 configure: TextContextMenuOptionsBuilder.() -> Unit = {}
32): TextContextMenuOptions = TextContextMenuOptions().copy(configure)
34public fun TextContextMenuOptions.copy(
35 configure: TextContextMenuOptionsBuilder.() -> Unit
36): TextContextMenuOptions {
37 val builder = TextContextMenuOptionsBuilder(this)
38 builder.configure()
39 return builder.snapshot()