ControlManager

class ControlManager : Extension(source)

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
class DropInput
Link copied to clipboard
inner class KeyboardInput
Link copied to clipboard
inner class MouseInput

Properties

Link copied to clipboard
Link copied to clipboard

The color scheme that media queries like (prefers-color-scheme: dark) see, dark or light; the window size is what (min-width: 600px) sees

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

true while something is dragged in drag and drop

Link copied to clipboard

The distance in pixels the mouse has to move while a button is held before it counts as a drag. Smaller movements are ignored, so that a press that moves slightly still results in a click.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var enabled: Boolean
Link copied to clipboard
Link copied to clipboard

the edits that can be undone and redone, see History

Link copied to clipboard

the inspector, F12 shows it, see Inspector

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var mousePosition: Vector2
Link copied to clipboard

Draws only the areas of the elements that changed, when the layout did not change; false draws all elements in every redraw.

Link copied to clipboard

true while a color is picked from the window, see pickColor

Link copied to clipboard
lateinit var program: Program
Link copied to clipboard
var renderTarget: RenderTarget?
Link copied to clipboard

true when the styles of elements have to be computed again, see Element.invalidateStyle

Link copied to clipboard

the text of the elements, drawn from the outlines of glyphs, with its caches

Link copied to clipboard
lateinit var window: Window

Functions

Link copied to clipboard
open override fun afterDraw(drawer: Drawer, program: Program)
Link copied to clipboard
fun animate(element: Element, duration: Double, timing: TimingFunction = org.openrndr.extra.style.TimingFunction.EASE_OUT, key: String = "", step: (Double) -> Unit)

Animates element for duration seconds: step is called every frame with the progress from 0 to 1, eased by timing; an animation replaces the one of the same element and key

Link copied to clipboard
open fun beforeDraw(drawer: Drawer, program: Program)
Link copied to clipboard
Link copied to clipboard

Opens the command palette: a dialog with a field that searches the commands by their names, see Commands.search; up and down choose a command, enter runs it, escape closes the palette. Opened by mod+k.

Link copied to clipboard
suspend fun ControlManager.confirm(message: String, title: String? = null, confirmLabel: String = "OK", cancelLabel: String = "Cancel", destructive: Boolean = false): Boolean

Asks to confirm message like the confirm that takes a callback, and suspends until the dialog closes: true when it is confirmed, false when it is cancelled. Cancelling the coroutine closes the dialog. For use in a coroutine on the thread of the program, like one that launch starts.

fun ControlManager.confirm(message: String, title: String? = null, confirmLabel: String = "OK", cancelLabel: String = "Cancel", destructive: Boolean = false, onResult: (Boolean) -> Unit): Dialog

Asks to confirm message in a modal dialog, under title when it is set, with the buttons cancelLabel and confirmLabel. onResult is called once, when the dialog closes: with true when it is confirmed, false when it is cancelled, by its button, escape, a click on the backdrop or Dialog.close. Enter presses the button with the keyboard focus, which starts on the confirming button, or on the cancelling one when the action is destructive.

Link copied to clipboard
fun cssFile(path: String, watch: Boolean = true): CssFile

Adds the style sheets of the CSS file path to the document, after its style sheets; when watch is set, they are read again when the file changes, a few times per second while frames are drawn, and the elements are styled again. Rules that are not valid are left out, with a warning.

Link copied to clipboard
fun ControlManager.dialog(vararg classes: String, dismissable: Boolean = true, init: Div.() -> Unit): Dialog

Shows a modal dialog that init builds, over a backdrop that covers the window: the keyboard focus moves into the dialog and stays in it, escape closes it, and a click on the backdrop closes it when dismissable is set. The backdrop is a dialog-backdrop, the dialog a dialog with classes.

Link copied to clipboard
fun ControlManager.layout(init: Body.() -> Unit)
Link copied to clipboard
fun pickColor(onPick: (ColorRGBa) -> Unit)

Picks a color from the window: the color under the pointer is shown next to it, and a click takes it and calls onPick with it; escape cancels

Link copied to clipboard
fun ControlManager.popover(anchor: () -> Rectangle?, vararg classes: String, side: PopoverSide = PopoverSide.BELOW, dismissable: Boolean = true, group: String? = null, focus: Boolean = false, init: Div.() -> Unit): Popover

Shows a popover that init builds, next to the area of the window that anchor gives in every frame, on side of it, or on the other side when it does not fit there, and moved along the side to stay inside the window; while anchor gives null it is hidden. It is not modal: the rest of the panel keeps working. When it is dismissable a press outside it and outside the anchor, or escape, closes it. Opening a popover of a group closes the other one of that group. With focus, the keyboard focus moves to its first control; the focus leaves it when it closes.

fun ControlManager.popover(anchor: Vector2, vararg classes: String, side: PopoverSide = PopoverSide.BELOW, dismissable: Boolean = true, group: String? = null, focus: Boolean = false, init: Div.() -> Unit): Popover

a popover next to anchor, a point of the window, see the popover with an anchor that moves

fun ControlManager.popover(anchor: Element, vararg classes: String, side: PopoverSide = PopoverSide.BELOW, dismissable: Boolean = true, group: String? = null, focus: Boolean = false, init: Div.() -> Unit): Popover

a popover next to anchor, which it follows, and hidden while the element is not in the panel; see the popover with an anchor that moves

Link copied to clipboard
open override fun setup(program: Program)
Link copied to clipboard
open fun shutdown(program: Program)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun ControlManager.toast(text: String, duration: Double = 3.0, vararg classes: String): Div

Shows a notification with text at the bottom right of the window, for duration seconds, see the styles of toast; classes are added to it, like error