scoop:scoop.ui.component:0.1.0
src/tree/drop_values.scoop
Selected production source · src/tree/drop_values.scoop
1
package scoop.ui.component3
import scoop.ui.*4
import scoop.window.*5
import scoop.time.Duration7
public enum TreeDropPosition {8
Before, Inside, After9
}11
/** A current logical insertion point. None for before means append, including unknown children. */12
public class TreeDrop<T> internal constructor(13
public val source: TreeNode<T>,14
public val target: TreeNode<T>,15
public val position: TreeDropPosition,16
public val parent: ViewKey?,17
public val before: ViewKey?18
)20
/** Tree resolves moves; the application commits data or performs its own IO in onDrop. */21
public class TreeDrag<T> public constructor(22
public val onDrop: (TreeDrop<T>) -> Boolean,23
public val allowDrop: (TreeDrop<T>) -> Boolean = { _ -> true },24
public val enabled: Boolean = true,25
public val expandDelay: Duration = Duration.milliseconds(650L),26
public val content: (TreeNode<T>) -> DragContent = { node -> DragContent.Text(node.label) },27
public val onStart: (TreeNode<T>, DragSourceStart) -> Unit = { _, _ -> },28
public val onEnter: (TreeDrop<T>) -> Unit = { _ -> },29
public val onOver: (TreeDrop<T>) -> Unit = { _ -> },30
public val onLeave: (TreeDrop<T>) -> Unit = { _ -> },31
public val onEnd: (TreeNode<T>, DragResult) -> Unit = { _, _ -> }32
) {33
init {34
requireComponent(expandDelay >= Duration.ZERO, "negative tree hover delay")35
}36
}38
internal class TreeDragPayload<T>(val state: TreeState<T>, val node: TreeNode<T>)