Package-level declarations

Functions

Link copied to clipboard
fun <S : Drawable> S.add3dEffect(xIntensity: Double = 0.05, yIntensity: Double = 0.05): S

Add a 3D hover effect to the specified drawable which slightly skews the object as the mouse moves across it, giving the appearance of it popping off the screen.

Link copied to clipboard
@JvmName(name = "addHoverInfo")
fun <S : Inputtable> S.addHoverInfo(vararg drawables: Drawable?, size: Vec2 = Vec2.ZERO, align: Align = AlignDefault, position: Point = Point.Above): S

Add some text that is shown when the mouse is left still over this drawable for 1 second or more.

Link copied to clipboard
fun <T : Inputtable> T.addRescalingListeners(withChildren: Boolean = true): T

Use this method on your component if you plan on it being removed from the component tree and re-added later, to guard against the rescaling system not updating the component's size (and optionally its children) as it was not referenced anywhere when the size was changed.

Link copied to clipboard

Use this method on your component if you plan on it being removed from the component tree and re-added later, to guard against the theming system not updating the component's palette as it was not referenced when the colors were changed.

Link copied to clipboard
Link copied to clipboard
fun <S : Inputtable> S.afterParentInit(depth: Int = 1, handler: S.() -> Unit): S

Add an event handler to this drawable's parent, and (optionally) it's parent's parent (depth).

Link copied to clipboard
@JvmName(name = "animateBy")
fun Drawable.animateBy(at: Vec2 = Vec2.ZERO, size: Vec2 = Vec2.ZERO, rotation: Double = 0.0, scaleX: Float = 0.0f, scaleY: Float = 0.0f, skewX: Double = 0.0, skewY: Double = 0.0, color: PolyColor? = null, animation: Animation? = null)

Bulk add method for all the builtin drawable operations in PolyUI.

Link copied to clipboard
@JvmName(name = "animateTo")
fun Drawable.animateTo(at: Vec2 = this.at, size: Vec2 = this.size, rotation: Double = this.rotation, skewX: Double = this.skewX, skewY: Double = this.skewY, scaleX: Float = this.scaleX, scaleY: Float = this.scaleY, color: PolyColor = this.color, animation: Animation? = null)

Bulk add method for all the builtin drawable operations in PolyUI.

Link copied to clipboard
infix inline fun <T : Component> T.childOf(parent: Component): T

Register this component to be a child of parent.

Link copied to clipboard

Returns a count of this component's children, including children of children.

Link copied to clipboard
fun <S : Drawable> S.disable(state: Boolean = true): S
fun <S : Inputtable> S.disable(state: Boolean = true): S
Link copied to clipboard

Instruct this component to refuse scrolling even if it is deemed necessary.

Link copied to clipboard
fun <S : Inputtable> S.draggable(withX: Boolean = true, withY: Boolean = true, free: Boolean = false): S

Make this component draggable by the user with their mouse.

Link copied to clipboard
@JvmName(name = "ensureLargerThan")
fun <S : Component> S.ensureLargerThan(vec: Vec2)
Link copied to clipboard
inline fun <S : Inputtable> S.events(dsl: EventDSL<S>.() -> Unit): S
Link copied to clipboard
fun <S : Drawable> S.fade(in: Boolean, durationNanos: Long = 0.1.seconds): S

Fade this drawable in or out, with a given duration.

Link copied to clipboard
fun <S : Drawable> S.fadeIn(durationNanos: Long = 0.1.seconds): S

Alias for fade.

Link copied to clipboard
fun <S : Drawable> S.fadeOut(durationNanos: Long = 0.1.seconds): S

Alias for fade.

Link copied to clipboard
fun <S : Component> S.fix(): S
Link copied to clipboard

Returns the index of this component in its parent's children list.

Link copied to clipboard
inline fun <S : ComponentOp, T> Component.getOperationValueOrElse(orElse: T, getter: (S) -> T): T

Attempts to get a value using getter from the operation of type S which is currently applied to this component. If no such operation is found, it returns the provided orElse value.

Link copied to clipboard

Return the position that this component is currently moving to, or its current position if it is not moving.

Link copied to clipboard

Return the scale that this drawable is currently scaling to, or its current scale if it is not scaling.

Link copied to clipboard

Return the size that this component is currently resizing to, or its current size if it is not resizing.

Link copied to clipboard
fun Component.hasChildIn(x: Float, y: Float, width: Float, height: Float): Boolean
Link copied to clipboard
fun <S : Component> S.hide(state: Boolean = true): S
Link copied to clipboard
fun <S : Component> S.ignoreLayout(state: Boolean = true): S

Specify that this component should be ignored during the layout stage.

Link copied to clipboard

Returns true if this component is a child of the specified component.

Link copied to clipboard

Returns true if this component is a child of the specified component, or if the component is a child of this.

Link copied to clipboard

Locate a component by its name.

Link copied to clipboard

Turn this component into a 'rearrangeable grid', meaning that the children in it can be dragged around and rearranged in any order by the user. It will automatically adapt and insert the children in the correct order.

Link copied to clipboard
@JvmName(name = "minimumSize")
fun <S : Scrollable> S.minimumSize(size: Vec2): S

Specify a minimum size for this component. Note that this will also disable scrolling due to optimizations.

Link copied to clipboard
fun <S : Component> S.named(name: String): S
Link copied to clipboard
fun <S : Component> S.namedId(name: String): S
Link copied to clipboard
fun <S : TextInput> S.numeric(min: Float = 0.0f, max: Float = 100.0f, integral: Boolean = false, acceptor: Inputtable = this): S

Make this TextInput only accept numbers between min and max. It will then dispatch a Event.Change.Number event.

Link copied to clipboard
inline fun <T : Component> Component.onAll(noinline action: (T) -> Unit)

Perform a function on all matching components (itself and its children) of the given type.

fun <T : Component> Component.onAll(cls: Class<T>, action: (T) -> Unit)

Perform a function on all matching components (itself and its children) of the given class.

Link copied to clipboard
@JvmName(name = "onChangeStateZ")
fun <S : Inputtable> S.onChange(func: S.(Boolean) -> Boolean): S
@JvmName(name = "onChangeState")
fun <S : Inputtable> S.onChange(func: S.(Boolean) -> Unit): S

Add a listener for changes to the given Boolean-type property.

@JvmName(name = "onChangeNumberZ")
fun <S : Inputtable> S.onChange(func: S.(Float) -> Boolean): S
@JvmName(name = "onChangeNumber")
fun <S : Inputtable> S.onChange(func: S.(Float) -> Unit): S

Add a listener for changes to the given Float-type property.

@JvmName(name = "onChangeIndexZ")
fun <S : Inputtable> S.onChange(func: S.(Int) -> Boolean): S
@JvmName(name = "onChangeIndex")
fun <S : Inputtable> S.onChange(func: S.(Int) -> Unit): S

Add a listener for changes to the given Int-type property.

@JvmName(name = "onChangeStringZ")
fun <S : Inputtable> S.onChange(func: S.(String) -> Boolean): S
@JvmName(name = "onChangeString")
fun <S : Inputtable> S.onChange(func: S.(String) -> Unit): S

Add a listener for changes to the given String-type property.

Link copied to clipboard
@JvmName(name = "onClickZ")
fun <S : Inputtable> S.onClick(func: S.(Event.Mouse.Clicked) -> Boolean): S
Link copied to clipboard
fun <S : Inputtable> S.onDrag(func: S.(Event.Mouse.Drag) -> Unit): S
Link copied to clipboard
@JvmName(name = "onDragEndZ")
fun <S : Inputtable> S.onDragEnd(func: S.(Event.Mouse.Drag.Ended) -> Boolean): S
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <S : Inputtable> S.onInit(function: S.(Event.Lifetime.Init) -> Unit): S
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <S : Inputtable> S.onToggle(func: S.(Boolean) -> Unit): S

Use this to add a simple listener for the Event.Change.State event.

Link copied to clipboard
fun <S : Component> S.padded(padding: Vec4): S
fun <S : Component> S.padded(xPad: Float, yPad: Float): S
fun <S : Component> S.padded(left: Float, top: Float, right: Float, bottom: Float): S
Link copied to clipboard
@ApiStatus.Experimental
fun <S : Component> S.prioritize(): S

Prioritize this component, meaning it will, in relation to its siblings:

Link copied to clipboard
fun <S : Block> S.radii(radii: FloatArray): S
fun <S : Block> S.radii(topLeftRadius: Float, topRightRadius: Float, bottomLeftRadius: Float, bottomRightRadius: Float): S
Link copied to clipboard
fun <S : Block> S.radius(radius: Float): S
Link copied to clipboard

Perform a refont operation on this component, changing its font from the old FontFamily to the new FontFamily, and all its children.

Link copied to clipboard
@ApiStatus.Experimental
fun <S : Component> S.relegate(): S

Relegate this component, meaning it will, in relation to its siblings:

Link copied to clipboard
fun Component.retheme(old: Colors, new: Colors, animate: Boolean = false): Component

Perform a retheme operation on this component, changing its palette from the old Colors to the new Colors, and all its children.

Link copied to clipboard
fun <S : Text> S.secondary(): S
Link copied to clipboard
fun <S : Drawable> S.setAlpha(alpha: Float): S
Link copied to clipboard
Link copied to clipboard
fun <S : Text> S.setFont(font: FontFamily.() -> Font): S

Set the font of this text component during initialization, using the PolyUI fonts instance.

Link copied to clipboard
fun <S : Drawable> S.setPalette(palette: Colors.() -> Colors.Palette): S

Set the color palette of this drawable during initialization, using the PolyUI colors instance.

fun <S : Drawable> S.setPalette(palette: Colors.Palette, animation: Boolean = false): S
Link copied to clipboard

Set the currently selected entry of this radiobutton to index (input is coerced into the range of the radiobutton).

Link copied to clipboard
fun <S : Inputtable> S.setSliderValue(value: Float, min: Float = 0.0f, max: Float = 100.0f, dispatch: Boolean = true): S

Set the value on this slider. Unfortunately due to current limitations you must provide the min and max values that were used for this slider.

Link copied to clipboard
fun <S : Drawable> S.setState(state: Byte): S

Set the palette of this drawable according to one of the three possible component states in PolyUI.

Link copied to clipboard
fun <S : Component> S.shake(): S
Link copied to clipboard
fun <S : Drawable> S.toggle(state: Boolean): S

Toggle any element to the given state provided it was made with the toggleable method.

Link copied to clipboard
fun <S : Drawable> S.toggleable(default: Boolean): S

Make this drawable toggleable, meaning that, when clicked:

Link copied to clipboard
fun <S : Block> S.withBorder(width: Float = 1.0f, color: Colors.() -> PolyColor = { page.border5 }): S
fun <S : Block> S.withBorder(color: PolyColor, width: Float = 1.0f): S
Link copied to clipboard
fun <S : Drawable> S.withCursor(cursor: Cursor = Cursor.Clicker): S
Link copied to clipboard
fun <S : Drawable> S.withHoverStates(consume: Boolean = false, showClicker: Boolean = true, animation: () -> Animation? = { Animations.Default.create(0.08.seconds) }): S