PageSpec

The content of a plugin page. Immutable; every builder call returns a new PageSpec.

Ids (page and item) must match [A-Za-z0-9._-]{1,32} and item ids must be unique within a page, else IllegalArgumentException. Text is never rejected: the runtime truncates it to the MAX_* lengths. Adding entry MAX_ENTRIES + 1 throws IllegalStateException.

Input entries (api 5: choice, dropdown, slider, progress, an item with an icon, enabled) need "api": 5. Without UI_INPUTS the unit shows them as text lines ("Level: Mid", "Progress: 60%") and item icons only with UI_ICONS. Dropdown and slider rows are drawn after the list rows, in spec order. A slider shows its position, not its number. A slider's knob may lag a fast turn near its ends until the plugin's update arrives.

Types

Link copied to clipboard
class Entry
One row of a page.
Link copied to clipboard
enum Kind
The kind of a page row.

Properties

Link copied to clipboard
The largest item icon, in pixels, either way: the icon cell does not scale.
Link copied to clipboard
val MAX_ENTRIES: Int = 24
Link copied to clipboard
val MAX_INFO: Int = 80
Link copied to clipboard
The most DROPDOWN plus SLIDER rows on one page.
Link copied to clipboard
val MAX_LABEL: Int = 40
Link copied to clipboard
val MAX_OPTIONS: Int = 8
The most options of a choice or dropdown.
Link copied to clipboard
The most items of a ring page.
Link copied to clipboard
The most steps of a slider: (max - min) / step.
Link copied to clipboard
val MAX_TITLE: Int = 32
Link copied to clipboard
val MAX_VALUE: Int = 20

Functions

Link copied to clipboard
open fun choice(itemId: String, label: String, options: Array<String>, selected: Int): PageSpec
A list row "label ...
Link copied to clipboard
open fun dropdown(itemId: String, label: String, options: Array<String>, selected: Int): PageSpec
A drop-down row with the same arguments and rules as choice; the pick arrives as a value (the index).
Link copied to clipboard
open fun enabled(itemId: String, enabled: Boolean): PageSpec
This spec with the list row itemId (an ITEM, TOGGLE, LINK or CHOICE) shown greyed and not selectable, or back to normal.
Link copied to clipboard
Unmodifiable, in insertion order.
Link copied to clipboard
open fun id(): String
Link copied to clipboard
open fun info(text: String): PageSpec
Link copied to clipboard
open fun item(itemId: String, label: String, value: String): PageSpec
value may be null.
open fun item(itemId: String, label: String, value: String, icon: Icon): PageSpec
item with an icon in its first column; a null icon is item(itemId, label, value).
Link copied to clipboard
open fun link(itemId: String, label: String, target: Page): PageSpec

open fun link(itemId: String, label: String, target: Page, icon: Icon): PageSpec
link with an icon.
Link copied to clipboard
open fun of(id: String, title: String): PageSpec
Link copied to clipboard
open fun progress(itemId: String, label: String, percent: Int): PageSpec
A progress bar row; percent is clamped to 0..100.
Link copied to clipboard
open fun ring(): Boolean
True for a page made with ring.
open fun ring(id: String, title: String): PageSpec
A page drawn as a ring, like the car's main menu: its link and item rows are the ring's items, each carrying an Icon (a stockIcon name is the usual choice).
Link copied to clipboard
open fun slider(itemId: String, label: String, min: Int, max: Int, step: Int, value: Int, centred: Boolean): PageSpec
A slider row from min to max in steps of step; each knob step arrives as a value (the level).
Link copied to clipboard
open fun title(): String
Link copied to clipboard
open fun toggle(itemId: String, label: String, on: Boolean): PageSpec