Group

class Group(children: Drawable?, at: Vec2? = null, val alignment: Align = AlignDefault, size: Vec2? = null, visibleSize: Vec2? = null) : Drawable

A drawable that contains other drawables, and does not render anything itself.

Constructors

Link copied to clipboard
constructor(vararg children: Drawable?, at: Vec2? = null, alignment: Align = AlignDefault, size: Vec2? = null, visibleSize: Vec2? = null)

Properties

Link copied to clipboard
@ApiStatus.Internal
var _color: PolyColor?

internal storage for the color.

Link copied to clipboard
@ApiStatus.Internal
var _parent: Drawable?
Link copied to clipboard
@ApiStatus.Internal
var _x: Float

Internal x position of this drawable.

Link copied to clipboard
@ApiStatus.Internal
var _y: Float

Internal y position of this drawable.

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

The alpha value of this drawable.

Link copied to clipboard

returns true if the position of this drawable is valid (has been set)

Link copied to clipboard
Link copied to clipboard
@set:ApiStatus.Internal
var color: PolyColor

The color of this drawable. can be any of the subtypes of this class depending on the current situation.

Link copied to clipboard
@SideEffects(values = ["inputState"])
var enabled: Boolean

Disabled flag for this component. Dispatches the Event.Lifetime.Disabled and Event.Lifetime.Enabled events.

Link copied to clipboard
val focusable: Boolean = false
Link copied to clipboard
Link copied to clipboard

Returns true if this drawable has a visible size set.

Link copied to clipboard
Link copied to clipboard
@get:JvmName(name = "isInitialized")
val initialized: Boolean
Link copied to clipboard
@Dispatches(event = "Lifetime.Disabled", when = "value == INPUT_DISABLED")
@Dispatches(event = "Lifetime.Enabled", when = "value != INPUT_DISABLED")
@Dispatches(event = "Mouse.Entered", when = "value > INPUT_NONE")
@Dispatches(event = "Mouse.Exited", when = "value == INPUT_NONE")
@set:ApiStatus.Internal
var inputState: Byte

The current input state of this drawable. Note that this value is not responsible for dispatching events such as Event.Mouse.Exited or Event.Mouse.Pressed. It is just here for tracking purposes and for your benefit.

Link copied to clipboard
@SideEffects(values = ["_parent.needsRedraw"], when = "field != value")
var needsRedraw: Boolean
Link copied to clipboard

true if this drawable has any operations.

Link copied to clipboard

Padding for this drawable. This is used by the positioner to ensure that there is adequate space around each object in the UI.

Link copied to clipboard
@SideEffects(values = ["color", "palette"])
var palette: Colors.Palette
Link copied to clipboard
@SideEffects(values = ["_parent"])
var parent: Drawable
Link copied to clipboard
lateinit var polyUI: PolyUI
Link copied to clipboard

This property controls weather this drawable resizes "raw", meaning it will not respect the aspect ratio.

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

Whether this drawable should be rendered.

Link copied to clipboard
@Locking(when = "value == 0.0")
var rotation: Double

current rotation of this drawable (radians).

Link copied to clipboard

current scale in x dimension of this drawable.

Link copied to clipboard

current scale in y dimension of this drawable.

Link copied to clipboard
Link copied to clipboard
open var simpleName: String

This is the name of this drawable, and it will be consistent over reboots of the program, so you can use it to get drawables from a layout by ID, e.g:

Link copied to clipboard
val size: Vec2
Link copied to clipboard

returns true if the size of this drawable is valid (not zero)

Link copied to clipboard
@Locking(when = "value == 0.0")
var skewX: Double

current skew in x dimension of this drawable (radians).

Link copied to clipboard
@Locking(when = "value == 0.0")
var skewY: Double

current skew in y dimension of this drawable (radians).

Link copied to clipboard

The visible size of this drawable. This is used for clipping and scrolling.

Link copied to clipboard
Link copied to clipboard
@SideEffects(values = ["x", "_x", "atValid", "this.children::x"], when = "value != x")
var x: Float
Link copied to clipboard
@SideEffects(values = ["y", "_y", "atValid", "this.children::y"], when = "value != y")
var y: Float

Functions

Link copied to clipboard
@MustBeInvokedByOverriders
open fun accept(event: Event): Boolean

called when this drawable receives an event.

Link copied to clipboard
@Locking(when = "children.size != 0")
fun addChild(vararg children: Drawable)

fun addChild(child: Drawable, recalculate: Boolean = true)

the runtime equivalent of adding children to this drawable during the constructor.

Link copied to clipboard
fun addOperation(vararg drawableOps: DrawableOp)

@Locking(when = "drawableOp.verify() == true")
fun addOperation(drawableOp: DrawableOp): Boolean

Add a DrawableOp to this drawable.

Link copied to clipboard
fun Drawable.animateBy(at: Vec2? = null, size: Vec2? = null, 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
fun Drawable.animateTo(tx: Float = this.x, ty: Float = this.y, 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
fun at(index: Int): Float

Return the position of this drawable as if it were a Vec2.

fun at(index: Int, value: Float)

Set the position of this drawable as if it were a Vec2.

Link copied to clipboard
open fun calculateSize(): Vec2?

Use this function to calculate the size of this drawable. DO NOT include children in this calculation!

Link copied to clipboard
open fun canBeRemoved(): Boolean

function that should return true if it is ready to be removed from its parent.

Link copied to clipboard
@ApiStatus.Experimental
inline fun Drawable.children(block: DrawableDSL.() -> Unit): DrawableDSL
Link copied to clipboard
Link copied to clipboard
open override fun clone(): Drawable

Implement this function to enable cloning of your Drawable.

Link copied to clipboard

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

Link copied to clipboard
fun debugDraw()
Link copied to clipboard
open fun debugString(): String?

Override this function to add things to the debug display of this drawable.

Link copied to clipboard
Link copied to clipboard
operator fun get(index: Int): Drawable
operator fun get(id: String): Drawable
operator fun get(x: Float, y: Float): Drawable
Link copied to clipboard
fun Drawable.hasChildIn(x: Float, y: Float, width: Float, height: Float): Boolean
Link copied to clipboard

returns true if this drawable has any non-specific event handlers registered for it.

returns true if this drawable has any specific event handlers registered for it.

Link copied to clipboard
fun intersects(x: Float, y: Float, width: Float, height: Float): Boolean
Link copied to clipboard
Link copied to clipboard
fun <S : Drawable> Drawable.locate(id: String): S?

Locate a drawable by its name.

Link copied to clipboard
fun <E : Event, S : Drawable> S.on(event: E, handler: S.(E) -> Boolean): S
@JvmName(name = "addEventhandler")
inline fun <E : Event, S : Drawable> S.on(event: E, crossinline handler: S.(E) -> Unit): S
Link copied to clipboard
@ApiStatus.Experimental
@Locking(when = "this.children != null")
fun recalculate()

Fully recalculate this drawable's size, and any of its children's positions.

Link copied to clipboard
fun removeChild(index: Int, recalculate: Boolean = true)
fun removeChild(child: Drawable, recalculate: Boolean = true)
Link copied to clipboard
@Locking(when = "operations != null")
fun removeOperation(drawableOp: DrawableOp)

Remove an operation from this drawable.

Link copied to clipboard
@ApiStatus.Experimental
@Locking(when = "this.children != null")
fun repositionChildren()

Reposition all the children of this drawable.

Link copied to clipboard
@MustBeInvokedByOverriders
open fun rescale(scaleX: Float, scaleY: Float, position: Boolean = true)

Method that is called when the physical size of the total window area changes.

Link copied to clipboard

reset the initial scroll position to the current position.

Link copied to clipboard
operator fun set(old: Int, new: Drawable)

operator fun set(old: Drawable, new: Drawable?)

Replace a child of this drawable with another drawable.

Link copied to clipboard
@MustBeInvokedByOverriders
open fun setup(polyUI: PolyUI): Boolean

give this a PolyUI reference.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
@Locking(when = "this.shouldScroll && this.hasVisibleSize && this.visibleSize > this.size")
fun tryMakeScrolling()