TextInput

open class TextInput(text: String = "", placeholder: String = "polyui.textinput.placeholder", font: Font? = null, fontSize: Float = 12.0f, at: Vec2? = null, val alignment: Align = AlignDefault, visibleSize: Vec2? = null, children: Drawable?) : Text

Constructors

Link copied to clipboard
constructor(text: String = "", placeholder: String = "polyui.textinput.placeholder", font: Font? = null, fontSize: Float = 12.0f, at: Vec2? = null, alignment: Align = AlignDefault, visibleSize: Vec2? = null, vararg children: Drawable?)

Properties

Link copied to clipboard
@ApiStatus.Internal
@get:JvmName(name = "getColorOrNull")
@set:JvmName(name = "setColorInternal")
var _color: PolyColor?

internal storage for the color.

Link copied to clipboard
@ApiStatus.Internal
@get:JvmName(name = "getFontOrNull")
@set:JvmName(name = "setFontInternal")
var _font: Font?
Link copied to clipboard
@ApiStatus.Internal
@get:JvmName(name = "getParentOrNull")
var _parent: Drawable?
Link copied to clipboard
@ApiStatus.Internal
@get:JvmName(name = "getXInternal")
@set:JvmName(name = "setXInternal")
var _x: Float

Internal x position of this drawable.

Link copied to clipboard
@ApiStatus.Internal
@get:JvmName(name = "getYInternal")
@set:JvmName(name = "setYInternal")
var _y: Float

Internal y position of this drawable.

Link copied to clipboard
@get:JvmName(name = "acceptsInput")
var acceptsInput: Boolean
Link copied to clipboard
Link copied to clipboard

The alpha value of this drawable.

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
@get:JvmName(name = "createdWithSetPosition")
val createdWithSetPosition: Boolean

Returns true if this drawable had a position specified at creation time.

Link copied to clipboard
@get:JvmName(name = "createdWithSetSize")
val createdWithSetSize: Boolean

Returns `true if this drawable had a size specified at creation time.

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

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

Link copied to clipboard
@get:JvmName(name = "isFocusable")
val focusable: Boolean = false
Link copied to clipboard
@get:JvmName(name = "isFocused")
var focused: Boolean

focused flag for this drawable. Only ever true if focusable is true.

Link copied to clipboard
var font: Font
Link copied to clipboard
@ApiStatus.Internal
var fontSize: Float

Internal, scaled font size. You probably should be using uFontSize instead, as this is an internal object.

Link copied to clipboard

The weight of the font.

Link copied to clipboard
Link copied to clipboard
@get:JvmName(name = "hasVisibleSize")
val hasVisibleSize: Boolean

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

true if font is italic

Link copied to clipboard
@get:JvmName(name = "isLayoutIgnored")
var layoutIgnored: Boolean

If true, this drawable will be ignored during the Positioner's routine of placing drawables. Use this if you want to specify it manually based on something else, for example.

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

true if this drawable has any operations.

Link copied to clipboard

Storage for the operations of this drawable. May be null if never used.

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
Link copied to clipboard
lateinit var polyUI: PolyUI
Link copied to clipboard
@get:JvmName(name = "isRawResize")
var rawResize: Boolean

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 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
@get:JvmName(name = "isScrolling")
val scrolling: Boolean
Link copied to clipboard
Link copied to clipboard
open override var shouldScroll: Boolean
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
@get:JvmName(name = "isSizeValid")
val sizeValid: Boolean

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
Link copied to clipboard
open var text: String
Link copied to clipboard

Tracker for the unscaled fontSize. You should set this instead of font size in most cases.

Link copied to clipboard
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
open override 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
fun back()
Link copied to clipboard
open override 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
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 override fun debugString(): String

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

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun forward()
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

Returns true if this drawable has a DrawableOp of the type T.

Link copied to clipboard
fun intersects(x: Float, y: Float, width: Float, height: Float): Boolean
Link copied to clipboard

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

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard
fun <S : Drawable> Drawable.locate(id: String): S?

Locate a drawable by its name.

Link copied to clipboard
fun mouseInput(mouseX: Float, mouseY: Float)
Link copied to clipboard
fun moveLine(down: Boolean)
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
@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
@Locking(when = "this.children != null")
fun repositionChildren()

Reposition all the children of this drawable.

Link copied to clipboard
open override fun rescale(scaleX: Float, scaleY: Float, position: Boolean)

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
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
open override fun setup(polyUI: PolyUI): Boolean

give this a PolyUI reference.

Link copied to clipboard
Link copied to clipboard
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()
Link copied to clipboard
open override fun updateTextBounds(renderer: Renderer)