Display widgets: API
This page is generated from the willowui source. It lists each public class with its constructor, its setter-style methods and its callback fields. The guide page for this family explains how to use them. Methods the generator skips (internal handlers, layout and draw steps) are still reachable but are not part of the everyday surface.
- AnimatedImage
- Badge
- MeterBar
- ProgressBar
- LineFragment
- LinkRect
- RichText
- Spacer
- StatAxis
- StatWeb
- ToastEntry
- ToastManager
AnimatedImage
Source: src/widgets/display/animatedimage.tks. Extends Component.
ts
new AnimatedImage(name: string)Callback fields: onFrameChanged, onComplete.
| Method | Returns | Notes |
|---|---|---|
setAtlas(tex: Texture | null, fw: int, fh: int) | void | Slice an atlas texture into frames of fw by fh, left to right then top to bottom. |
setFrames(frames: TextureRegion[]) | void | An explicit list of regions as frames. |
loadGif(g: GifData | null) | void | Frames and per-frame delays from a decoded GIF; loop count 0 loops forever, otherwise once. |
loadGifBytes(bytes: Buffer) | void | Decode raw GIF file bytes (throws on a malformed file) and load them. |
setFPS(fps: float) | void | |
setPlayMode(mode: int) | void | |
play() | void | |
pause() | void | |
stop() | void | |
setFrame(n: int) | void | |
currentFrame() | int | |
isPlaying() | boolean | |
setScaleMode(mode: int) | void | |
setTint(c: Color) | void | |
setCornerRadius(r: float) | void | -1 is a full pill. |
setSize(w: float, h: float) | void |
Badge
Source: src/widgets/display/badge.tks. Extends Component.
ts
new Badge(name: string, family: string, displaySize: float)| Method | Returns | Notes |
|---|---|---|
text() | string | |
setText(t: string) | void | |
setCount(n: int) | void | The count as text, "N+" above maxCount (0 disables truncation). |
setMaxCount(n: int) | void | |
setDotMode(v: boolean) | void | |
setPadding(top: float, right: float, bottom: float, left: float) | void | Override the theme padding with per-instance values. |
setSize(w: float, h: float) | void | Override the auto-size dimensions. |
sizeToContent() | void | Fit the badge to its content plus padding (dot mode: the theme dot size, default 8). |
MeterBar
Source: src/widgets/display/progressbar.tks. Extends Component.
ts
new MeterBar(name: string)| Method | Returns | Notes |
|---|---|---|
value() | float | The current normalized fill value (0 to 1), regardless of range. |
setRange(min: float, max: float) | void | |
setValue(v: float) | void | Set the value in [min, max], mapped to 0..1 internally. |
setProgress(v: float) | void | Set the normalized 0..1 fill directly, bypassing the range (used by bindValue). |
setSize(w: float, h: float) | void | |
setShowLabel(show: boolean, family: string, displaySize: float) | void | Show or hide the percentage label overlay (created on first show). |
bindValue(ref: Ref<float>) | void | Follow a Ref<float> (0..1 normalized): applied now and at every later write. |
setFillColor(c: Color) | void | |
clearFillColor() | void |
ProgressBar
Source: src/widgets/display/progressbar.tks. Extends MeterBar.
ProgressBar is an alias for MeterBar (Go type alias).
ts
new ProgressBar(name: string)LineFragment
Source: src/widgets/display/richtext.tks.
A piece of text on a line, from a single span, with resolved styling and measured size.
ts
new LineFragment(color: Color)LinkRect
Source: src/widgets/display/richtext.tks.
A clickable region mapped during render.
ts
new LinkRect(rect: Rect, url: string)RichText
Source: src/widgets/display/richtext.tks. Extends Component.
ts
new RichText(name: string, family: string, displaySize: float)Callback fields: onLinkClick.
| Method | Returns | Notes |
|---|---|---|
setHeadingScale(h1: float, h2: float, h3: float) | void | |
addSpan(text: string) | RichText | |
addStyledSpan(text: string, family: string | null, color: Color, outline: Outline | null) | RichText | A span with explicit styling; the colour is always set. family and outline null inherit. |
addTextSpan(span: TextSpan) | RichText | |
addBoldSpan(text: string, color: Color) | RichText | |
addItalicSpan(text: string, color: Color) | RichText | |
addBoldItalicSpan(text: string, color: Color) | RichText | |
clearSpans() | RichText | |
setSpans(spans: TextSpan[]) | RichText | |
setWrapWidth(w: float) | void | |
setAlign(a: int) | void | |
setColor(c: Color) | void | |
setOutline(o: Outline | null) | void | |
setMarkup(markup: string) | void | Parse XML-like markup and replace all spans. Throws on an unknown tag. |
Spacer
Source: src/widgets/display/spacer.tks. Extends Component.
ts
new Spacer(name: string, w: float, h: float)| Method | Returns | Notes |
|---|---|---|
setSize(w: float, h: float) | void | Component.setSize also keeps an established hit shape in step; a spacer has none. |
StatAxis
Source: src/widgets/display/statweb.tks.
ts
new StatAxis(name: string, min: float, max: float, value: float)StatWeb
Source: src/widgets/display/statweb.tks. Extends Component.
ts
new StatWeb(name: string, family: string, fontSize: float)Callback fields: onValueChanged.
| Method | Returns | Notes |
|---|---|---|
setAxes(axes: StatAxis[]) | void | Define all spokes at once (at most eight; values are clamped into each axis's range). |
setValues(values: float[]) | void | Bulk-set values by index, parallel to the axes. |
values() | float[] | |
setValue(index: int, value: float) | void | |
value(index: int) | float | |
setFillEnabled(v: boolean) | void | Show or hide the semi-transparent polygon fill. |
setEditable(v: boolean) | void | |
isEditable() | boolean | |
setSize(w: float, h: float) | void |
ToastEntry
Source: src/widgets/display/toast.tks.
ts
new ToastEntry(root: Component, progressNode: Quad | null, progressMaxW: float, w: float, h: float, cfg: ToastOptions)| Method | Returns | Notes |
|---|---|---|
cancelAnim() | void | |
cancelTimers() | void | Drop the expiry and progress entries from the ticker. |
ToastManager
Source: src/widgets/display/toast.tks.
| Method | Returns | Notes |
|---|---|---|
setFont(family: string, size: float) | void | Font used to render messages; call once at startup. An empty family draws no message. |
setAnchor(corner: int) | void | |
setMaxStack(n: int) | void | Maximum toasts visible at once (default 4, minimum 1); the oldest is dropped when full. |
setMargin(x: float, y: float) | void | Pixel gap between the stack and the screen edge (default 16 by 16). |
show(message: string, variant: int, opts?: Function[]) | void | Show a toast; opts are option functions from withDuration and friends. |
dismissAll() | void | Remove every toast immediately, running each onDismiss. |
setScene(s: any) | void | Scene change: drop every entry and rebuild the overlay under the new root. |
dismissEntry(e: ToastEntry) | void | Begin the dismiss animation (click-to-dismiss). |