RuleDSL

class RuleDSL(val rule: Theme.Rule)

Part of the DSL (Domain Specific Language) for building Themes.

A theme contains top-level rules in the form :

SELECTOR { ... }

... is a block of code with RuleDSL as the receiver (i.e. this is RuleDSL)

Within the block, you can define property values :

"PROPERTY_NAME" ( PROPERTY_VALUE )

There are also convenience methods for common properties. e.g. :

textColor( color )

Which is equivalent to :

"textColor" ( color )

You can also define sub-rules :

child(SELECTOR) { ... }
descendant(SELECTOR) { ... }
SELECTOR { ... }

The new rule's selector will be either a ChildSelector, DescendantSelector or an AndSelector.

In the first two cases SELECTOR can be a String or a Selector. In the last case, it can also be an enum which implements WithPseudoStyle. e.g.

Orientation.HORIZONTAL { ... }

In this example, the rule matches a node if the Node's pseudoStyles contains the String ":horizontal". It is NOT checking the node's orientation property.

Constructors

Link copied to clipboard
constructor(rule: Theme.Rule)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun alignment(value: Alignment)
Link copied to clipboard
Link copied to clipboard
fun border(value: Border)
Link copied to clipboard
fun borderSize(size: Number)
fun borderSize(topBottom: Number, leftRight: Number)
fun borderSize(top: Number, right: Number, bottom: Number, left: Number)
Link copied to clipboard
fun buttonOrder(value: String)

Used by ButtonBar

Link copied to clipboard
fun caretColor(color: Color)
Link copied to clipboard
fun caretImage(value: Image)
fun caretImage(images: NamedImages, imageName: String)
Link copied to clipboard
fun child(child: String, block: RuleDSL.() -> Unit)

Example

fun child(child: Selector, block: RuleDSL.() -> Unit)
Link copied to clipboard
fun collapsable(value: Boolean)
Link copied to clipboard
Link copied to clipboard
fun descendant(child: String, block: RuleDSL.() -> Unit)

Example

fun descendant(child: Selector, block: RuleDSL.() -> Unit)
Link copied to clipboard
fun expanded(value: Boolean)
Link copied to clipboard
fun fill(value: Boolean = true)
Link copied to clipboard
fun fillHeight(value: Boolean = true)
Link copied to clipboard
fun fillWidth(value: Boolean = true)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun font(value: Font)
fun font(fontSize: Float, vararg families: String)
fun font(fontSize: Float, style: FontStyle, vararg families: String)
Link copied to clipboard
fun graphic(image: Image)
fun graphic(images: NamedImages, imageName: String): Unit?
Link copied to clipboard
Link copied to clipboard
fun highlightColor(value: Color)
Link copied to clipboard
Link copied to clipboard
fun image(image: Image)
fun image(name: String, value: Image)
fun image(images: NamedImages, imageName: String): Unit?
fun image(name: String, images: NamedImages, imageName: String)
Link copied to clipboard
operator fun String.invoke(value: Boolean)
operator fun String.invoke(value: Float)
operator fun String.invoke(block: RuleDSL.() -> Unit)
operator fun String.invoke(value: Int)
operator fun String.invoke(value: String)
operator fun String.invoke(value: ContentDisplay)
operator fun String.invoke(value: SpinnerArrowPositions)
operator fun String.invoke(value: Alignment)
operator fun String.invoke(value: Background)
operator fun String.invoke(value: Border)
operator fun String.invoke(value: Color)
operator fun String.invoke(value: Edges)
operator fun String.invoke(value: Image)
operator fun String.invoke(value: Orientation)
operator fun String.invoke(value: Font)
operator fun WithPseudoStyle.invoke(block: RuleDSL.() -> Unit)

operator fun Selector.invoke(block: RuleDSL.() -> Unit)

Example

Link copied to clipboard
fun labelPadding(size: Number)
fun labelPadding(value: Edges)
fun labelPadding(top: Number, right: Number, bottom: Number, left: Number)
Link copied to clipboard
fun lineHeight(value: Number)
Link copied to clipboard
fun maxHeight(value: Number)
Link copied to clipboard
fun maxWidth(value: Number)
Link copied to clipboard
fun minHeight(value: Number)
Link copied to clipboard
fun minWidth(value: Number)
Link copied to clipboard
fun ninePatchBackground(ninePatch: NinePatch?, tint: Color? = null)
Link copied to clipboard
fun ninePatchBorder(ninePatch: NinePatch?, tint: Color? = null)
Link copied to clipboard
Link copied to clipboard
fun noBorder()
Link copied to clipboard
Link copied to clipboard
fun padding(size: Number)
fun padding(value: Edges)
fun padding(y: Number, x: Number)
fun padding(top: Number, right: Number, bottom: Number, left: Number)
Link copied to clipboard
Link copied to clipboard
fun plainBorder(color: String)
fun plainBorder(color: Color)
Link copied to clipboard
fun prefHeight(value: Number)
Link copied to clipboard
fun prefWidth(value: Number)
Link copied to clipboard
Link copied to clipboard
fun raisedBorder(light: Color, dark: Color)
Link copied to clipboard
fun roundedBackground(color: String, radius: Number)
fun roundedBackground(color: Color, radius: Number)
fun roundedBackground(color: Color, radius: Number, side: Side?)
Link copied to clipboard
fun roundedBorder(color: String, radius: Number)
fun roundedBorder(color: Color, radius: Number)
Link copied to clipboard

For the 'root' selector.

Link copied to clipboard
fun spacing(value: Number)
Link copied to clipboard
Link copied to clipboard
fun textColor(value: String)
fun textColor(value: Color)
Link copied to clipboard
Link copied to clipboard
fun tint(value: String)
fun tint(value: Color)
Link copied to clipboard
fun underlineBackground(color: String, thickness: Float = 1.0f, ratio: Float = 0.9f)
fun underlineBackground(color: Color, thickness: Float = 1.0f, ratio: Float = 0.9f)
Link copied to clipboard
fun visible(value: Boolean)