MiniGUI

open class MiniGUI(appearance: GUIAppearance = GUIAppearance(), defaultStyles: List<StyleSheet> = defaultStyles(), controlWidth: Int = 150) : GUI(source)

A compact version of GUI that shows a single horizontal bar at the bottom of the screen. A dropdown on the left selects the compartment to show, the controls of that compartment are laid out horizontally next to it, followed by the toolbar when showToolbar is set. When the controls do not fit, they scroll horizontally, with the wheel, a trackpad or the scrollbar, which shows while scrolling and fades out after it.

Objects are added and removed like with GUI, parameter values are persisted and saved in the same way.

Parameters

appearance

the base color of the bar; GUIAppearance.barWidth is not used

controlWidth

the width of every control in pixels

Constructors

Link copied to clipboard
constructor(appearance: GUIAppearance = GUIAppearance(), defaultStyles: List<StyleSheet> = defaultStyles(), controlWidth: Int = 150)

Properties

Link copied to clipboard
Link copied to clipboard

the bindings of the parameters of the objects that the GUI shows

Link copied to clipboard

The canvas created by GUILayoutScope.sideCanvas, see enableSideCanvas.

Link copied to clipboard
Link copied to clipboard

whether compartments start collapsed, also those that were added and were not collapsed or expanded since

Link copied to clipboard
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 history of the changes to the parameters, for undo and redo: command or control and z undoes, with shift or control and y redoes, unless undoShortcuts is false

Link copied to clipboard

The layout that builds the GUI's element tree, see GUILayout. Must be set before the GUI is installed with extend().

Link copied to clipboard
val loaded: Event<GUIEvent>

Represents an event that is triggered when the GUI state has been loaded or restored

Link copied to clipboard
Link copied to clipboard

Show a header above every compartment that collapses and expands it when clicked. Must be set before the GUI is installed with extend().

Link copied to clipboard
Link copied to clipboard

The style sheets for the GUI's elements, applied on top of defaultStyles. Must be set before the GUI is installed with extend().

Link copied to clipboard

true when the keys for undo and redo are used by the GUI

Link copied to clipboard

Functions

Link copied to clipboard
fun <T : Any> add(objectWithParameters: T, label: String? = objectWithParameters.title()): T

Add an object to the GUI

fun <T : Any> add(label: String? = null, builder: () -> T): T

Add an object to the GUI using a builder.

Link copied to clipboard
open override fun afterDraw(drawer: Drawer, program: Program)
Link copied to clipboard
open fun beforeDraw(drawer: Drawer, program: Program)
Link copied to clipboard
fun cssFile(path: String, watch: Boolean = true)

Adds the style sheets of the CSS file path, after styles, like a theme: :root { --gui-base: #223 }. When watch is set they are read again when the file changes, while the program runs. Must be called before the GUI is installed with extend().

Link copied to clipboard

Can be called by the user to update the gui using an object deserialized externally. Allows the user to load a larger json object, deserialize it, and use part of it to update the GUI. Complements .toObject().

Link copied to clipboard
fun loadParameters(file: File)
Link copied to clipboard

asks for a file of parameters and loads it

Link copied to clipboard
fun onChange(listener: (name: String, value: Any?) -> Unit)
Link copied to clipboard
fun randomize(strength: Double = 0.05)

Moves the values of the parameters towards random values by strength, see ParameterBindings.randomize

Link copied to clipboard
fun redo(): Boolean

redoes the last change to the parameters that was undone, true when there was one

Link copied to clipboard
fun <T : Any> remove(objectWithParameters: T)

Remove an object from the GUI.

Link copied to clipboard
fun saveParameters(file: File)
Link copied to clipboard

asks for a file to save the parameters to, in the folder of the parameters at first

Link copied to clipboard

Expand the compartment with label and collapse all other compartments.

Link copied to clipboard
open override fun setup(program: Program)
Link copied to clipboard
open override fun shutdown(program: Program)
Link copied to clipboard

Can be called by the user to obtain an object to be serialized externally. This allows the user to combine custom data with gui state and save it all to one file. Complements .fromObject().

Link copied to clipboard
fun undo(): Boolean

undoes the last change to the parameters, true when there was one