Class Properties
-
- All Implemented Interfaces:
-
kotlin.Cloneable
public abstract class Properties implements Cloneable
Properties are PolyUI's take on styling through tokens, or shared states. They are used as default values for components, if component-specific values are not set. Every component will have an accompanying property.
They contain many values that style a component, such as palette, size, and even eventHandlers.
They are used to eliminate repeated code on components, and to make styling easier.
-
-
Field Summary
Fields Modifier and Type Field Description private transient Colorscolorsprivate transient FontFamilyfontsprivate final Colors.Palettepaletteprivate final Vec2<Unit>sizeprivate final transient HashMap<Event, Function2<Component, Event, Boolean>>eventHandlersprivate final Booleaninitialized
-
Constructor Summary
Constructors Constructor Description Properties()
-
Method Summary
Modifier and Type Method Description final ColorsgetColors()final UnitsetColors(Colors colors)final FontFamilygetFonts()final UnitsetFonts(FontFamily fonts)abstract Colors.PalettegetPalette()Vec2<Unit>getSize()use this to set a size for the target component. final HashMap<Event, Function2<Component, Event, Boolean>>getEventHandlers()final BooleangetInitialized()final <E extends Event> PropertiesaddEventHandler(E event, Function2<Component, E, Boolean> handler)Add a universal event handler to this component's property. final Unitinit(Colors colors, FontFamily fonts)-
-
Method Detail
-
getFonts
final FontFamily getFonts()
-
setFonts
final Unit setFonts(FontFamily fonts)
-
getPalette
abstract Colors.Palette getPalette()
-
getSize
Vec2<Unit> getSize()
use this to set a size for the target component.
This will not override the size of the component if it is already set. Else, if this is not null and the component's size is null, the component's size will be set to this.
-
getInitialized
final Boolean getInitialized()
-
addEventHandler
final <E extends Event> Properties addEventHandler(E event, Function2<Component, E, Boolean> handler)
Add a universal event handler to this component's property.
This means that every component using this property will have this event handler.
-
init
final Unit init(Colors colors, FontFamily fonts)
-
-
-
-