Scoop API

scoop:scoop.ui:0.1.0

src/text/menu/commands.scoop

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

1package scoop.ui.text
3import scoop.window.*
5internal fun textMenuSupports(command: TextEditCommand, editing: Boolean): Boolean =
6 when (command) {
7 case Copy -> true
8 case SelectAll -> true
9 case Undo -> editing
10 case Redo -> editing
11 case Cut -> editing
12 case Paste -> editing
13 case DeleteSelection -> editing
14 else -> false
15 }
17internal fun textMenuAvailable(value: TextCommandAvailability, command: TextEditCommand): Boolean =
18 when (command) {
19 case Undo -> value.undo
20 case Redo -> value.redo
21 case Cut -> value.cut
22 case Copy -> value.copy
23 case Paste -> value.paste
24 case DeleteSelection -> value.deleteSelection
25 case SelectAll -> value.selectAll
26 else -> false
27 }