const CHART_LINE
pub const CHART_LINE = 0Purpose
Constant CHART_LINE, defining protocol or algorithm parameters.
#ui/widgetsButton, Checkbox, Progress, Scroll, Input / TextArea and retained View. Styles provides fonts, density, palettes, geometry and combined-state rules; StyledLabel caches layout. Local themes are complete snapshots. Register measurement with set_style_measure, call mark_measure after text changes, then layout_styled, place_editor and present_styled. Callbacks borrow themes, use node-local coordinates and must not mutate View or topology.
Switch, Radio, Slider, Stepper, Tabs, Select, Badge, Divider, Card and ListBox share Styles, combined-state paint rules, shadows and icon placement. Create widgets.style_switcher() to select dark, light or contrast presets. Use use_preset, set_text_scale and set_density, then apply to the retained View; cycle advances and applies a preset. These methods can fail, so handle their errors. Each View receives a complete style snapshot; explicit control overrides remain in effect.
Release examples (complete projects and source downloads): widgets · editor_workbench · style_gallery · controls_gallery
Apply shared styles to a retained View:
@main
#ui/widgets
fn configure(view $&widgets.View) int {
$themes := widgets.style_switcher()
themes.use_preset(widgets.THEME_LIGHT) or >>
themes.set_text_scale(1.2) or >>
themes.set_density(0.85) or >>
themes.apply(view) or >>
// Call this from a theme-switch action to advance and apply the preset.
themes.cycle(view) or >>
<< 0
}
fn main() int { << 0 }The complete component_workshop project and source provide 46 entries with themes, density, 100%/140%/200% text, disabled, read-only and invalid states. Use the matching Xu 0.10.11 SDK. A successful Windows/Linux cross build does not establish target-machine GUI acceptance.
Screen.button_with_icon() creates an icon-and-text button; icon_button() creates an icon-only button. Each button owns its style snapshot. Set its own icon_size and ICON_LEADING/TRAILING/ABOVE/BELOW, then use measure_button() to place it at its content size. Embed resources with --www; the code below requires www/logo.png.
Tooltips default to top/center. set_tooltip_placement() selects a side with edge flipping. Ordinary pointer hover shows help after about 500 ms; keyboard or explicit focus shows it immediately. Leaving, clicking or scrolling dismisses it. Escape suppresses the current interaction until re-entry or refocus. Anchors fully outside their scroll clip do not show a tooltip.
password_input() enables a real single-line password Input, with one bullet per Unicode grapheme. set_password_visible() preserves value and selection. Paste works; copy and cut remain blocked when revealed. Native surrounding-text queries and XACP node text do not return the password. text_value() still returns the application value, so applications must manage storage and logging; masking does not encrypt memory.
@main
#ui/widgets
fn configure(screen $&widgets.Screen, styles &widgets.Styles) int {
button := screen.button_with_icon("logo.png", "Build project") or >>
$appearance := styles.button_variant(widgets.BUTTON_PRIMARY) or >>
appearance.icon_placement = widgets.ICON_ABOVE
appearance.icon_size = 32.0 * styles.text_scale
screen.set_control_style(button, &appearance) or >>
size := screen.measure_button(button) or >>
screen.place(button, 24.0, 24.0, size.width, size.height) or >>
tip := screen.tooltip(button, "Build project") or >>
$placement := widgets.overlay_placement()
placement.side = widgets.OVERLAY_RIGHT
placement.align = widgets.OVERLAY_CENTER
screen.set_tooltip_placement(tip, &placement) or >>
password := screen.password_input("") or >>
screen.place(password, 24.0, 160.0, 320.0, 48.0) or >>
<< 0
}
fn main() int { << 0 }
These sources come from the official examples repository and can be copied or downloaded. Run them with a local Xu SDK in the complete project; network, database, and desktop examples require the corresponding services or assets.
16_ui_webview/editor_workbench/xuui_tokens/mod.xu@xuui_tokens
// XUUI 0.1.1-dev.1; generated from tokens/tokens.json.
// Regenerate with npm run build; retain this provenance when vendoring.
#ui/draw
#ui/widgets
pub fn canvas(dark bool) draw.Color {
if dark { << draw.rgb(16,14,18) }
<< draw.rgb(246,243,239)
}
pub fn surface(dark bool) draw.Color {
if dark { << draw.rgb(25,22,28) }
<< draw.rgb(255,253,251)
}
pub fn elevated(dark bool) draw.Color {
if dark { << draw.rgb(35,31,39) }
<< draw.rgb(238,235,231)
}
pub fn subtle(dark bool) draw.Color {
if dark { << draw.rgb(44,39,49) }
<< draw.rgb(232,227,223)
}
pub fn text(dark bool) draw.Color {
if dark { << draw.rgb(245,240,237) }
<< draw.rgb(40,35,41)
}
pub fn muted(dark bool) draw.Color {
if dark { << draw.rgb(179,170,182) }
<< draw.rgb(109,98,110)
}
pub fn brand(dark bool) draw.Color {
if dark { << draw.rgb(255,82,116) }
<< draw.rgb(190,18,60)
}
pub fn focus(dark bool) draw.Color {
if dark { << draw.rgb(168,217,255) }
<< draw.rgb(0,95,158)
}
pub fn control_border(dark bool) draw.Color {
if dark { << draw.rgb(138,126,144) }
<< draw.rgb(133,121,135)
}
pub fn on_brand(dark bool) draw.Color {
if dark { << draw.rgb(25,12,18) }
<< draw.rgb(255,248,250)
}
pub fn danger(dark bool) draw.Color {
if dark { << draw.rgb(255,142,157) }
<< draw.rgb(184,33,56)
}
pub fn danger_soft(dark bool) draw.Color {
if dark { << draw.rgb(60,32,40) }
<< draw.rgb(251,230,233)
}
// Editor appearance for XU SDK 0.10.11. Other controls retain SDK defaults.
pub fn editor_styles(dark bool) widgets.Styles {
$styles := widgets.light_styles()
if dark { styles = widgets.dark_styles() }
styles.background = canvas(dark)
$input := styles.input.clone()
input.radius = 8.0
input.min_height = 40.0
input.padding.left = 12.0
input.padding.right = 12.0
input.padding.top = 8.0
input.padding.bottom = 8.0
input.border_width = 1.0
input.focus_width = 2.0
input.font.size = 16.0
input.inherit_font = false
input.palette.normal = surface(dark)
input.palette.hovered = surface(dark)
input.palette.pressed = subtle(dark)
input.palette.disabled = surface(dark)
input.palette.foreground = text(dark)
input.palette.muted = muted(dark)
input.palette.placeholder = muted(dark)
input.palette.accent = brand(dark)
input.palette.on_accent = on_brand(dark)
input.palette.focus = focus(dark)
input.palette.border = control_border(dark)
input.palette.invalid = danger(dark)
input.palette.invalid_fill = danger_soft(dark)
input.palette.read_only = subtle(dark)
input.palette.selection = brand(dark)
input.palette.selection_text = on_brand(dark)
$hover := widgets.state_paint(widgets.STATE_HOVERED)
hover.unless = widgets.STATE_DISABLED | widgets.STATE_INVALID | widgets.STATE_READ_ONLY
hover.fields = widgets.PAINT_BORDER
hover.border = brand(dark)
$focused := widgets.state_paint(widgets.STATE_FOCUSED)
focused.unless = widgets.STATE_DISABLED | widgets.STATE_INVALID
focused.fields = widgets.PAINT_BORDER
focused.border = focus(dark)
input.states = [hover,focused]
styles.input = input.clone()
styles.text_area = input.clone()
styles.text_area.align_y = 0.0
<< styles
}16_ui_webview/webview_component/main.xu@main
#ui
#ui/widgets
#ui/webview
#math
demo #"github.com/xulang-org/examples/ui_demo"
fn document(title string, tone string) string {
<< "<!doctype html><html><head><meta charset='utf-8'><title>" + title + "</title><style>body{margin:0;padding:28px;font:15px -apple-system,system-ui;color:#252521;background:#faf9f6}small{letter-spacing:.14em;color:#797970}h1{font-size:28px;font-weight:600;letter-spacing:-.04em;margin:16px 0}p{line-height:1.65;color:#6b6b63}input,button{box-sizing:border-box;font:inherit;border-radius:8px;padding:12px;width:100%;margin:8px 0}input{border:1px solid #d8d8cf;background:white;outline-color:" + tone + "}button{border:0;background:" + tone + ";color:white;cursor:pointer}output{display:block;min-height:42px;padding:12px 0;line-height:1.5;color:" + tone + "}</style></head><body><small>EMBEDDED WEBVIEW</small><h1>" + title + "</h1><p>This document has its own viewport, focus and request identity.</p><input aria-label='Message' value='Hello from " + title + "'><button onclick='send()'>Ask native Xu</button><output aria-live='polite'>Ready for an independent native request.</output><p>Tab moves inside this document.<br>Ctrl + Tab returns to the native controls.</p><script>async function send(){let out=document.querySelector('output');out.textContent='Waiting…';try{out.textContent=await window.__XU__.invoke('echo',document.querySelector('input').value)}catch(e){out.textContent=e.message}}</script></body></html>"
}
fn route(request webview.InvokeRequest) string {
target := request.target() or(err) { << "Target closed: " + err.msg()}
script := "document.title"
options := ui.RequestOptions{timeout_ms: 3000}
result := ui.webview_request_wait(&target, ui.REQUEST_WEBVIEW_EVAL, &script, &options) or(err) { << err.msg()}
<< result.value + " · " + request.payload + " · view " + str(target.canvas_id)
}
fn ipc(events chan ui.Event, emits chan string) {
webview.bind_ipc_requests_www(":mem:", route, emits, events) or(err) {eprintln(err.msg())
<< }
}
fn scene(events chan ui.Event) int {
ready := demo.ready(events) or >>
if ready.kind == ui.EV_EXIT{ << 0}
$screen := widgets.screen(&ready) or >>
screen.resize(1020.0, 720.0) or >>
screen.set_min_size(760, 580) or >>
title := screen.label("Web content. Native composition.", 26.0, false) or >>
subtitle := screen.label("Two independent WebViews inside a Canvas window", 13.0, true) or >>
hide := screen.button("Hide left") or >>
reload := screen.button("Reload right") or >>
close := screen.button("Dispose left") or >>
modal_button := screen.button("Open modal") or >>
left := screen.webview() or >>
right := screen.webview() or >>
status := screen.label("Resize the window, edit both pages, or test their native requests.", 13.0, true) or >>
modal := screen.modal("Native overlay", "The WebViews resume when this dialog closes.") or >>
dismiss := screen.button("Close dialog") or >>
screen.set_parent(dismiss, modal) or >>
screen.place(dismiss, 24.0, 175.0, 180.0, 38.0) or >>
screen.load_web_html(left, document("Editor preview", "#b64c3c")) or >>
screen.load_web_html(right, document("Reference panel", "#386f6b")) or >>
$model := Model{left: left, right: right, hide: hide, close: close, status: status, modal: modal, hidden: false, disposed: false}
$dispatcher := widgets.action_dispatcher(&model, &screen)
dispatcher.on(hide, widgets.ACTION_ACTIVATE, toggle_left) or >>
dispatcher.on(reload, widgets.ACTION_ACTIVATE, reload_right) or >>
dispatcher.on(close, widgets.ACTION_ACTIVATE, dispose_left) or >>
dispatcher.on(modal_button, widgets.ACTION_ACTIVATE, open_modal) or >>
dispatcher.on(dismiss, widgets.ACTION_ACTIVATE, close_modal) or >>
for id in[left, right] {
dispatcher.on(id, widgets.ACTION_WEB_LOADED, web_loaded) or >>
dispatcher.on(id, widgets.ACTION_WEB_FAILED, web_failed) or >>
}
while screen.is_open() {
width := screen.width()
height := screen.height()
half :=(width - 76.0) * 0.5
screen.place(title, 28.0, 25.0, width - 56.0, 38.0) or >>
screen.place(subtitle, 28.0, 69.0, width - 56.0, 25.0) or >>
screen.place(hide, 28.0, 112.0, 136.0, 38.0) or >>
screen.place(reload, 174.0, 112.0, 146.0, 38.0) or >>
screen.place(close, 330.0, 112.0, 136.0, 38.0) or >>
screen.place(modal_button, 476.0, 112.0, 136.0, 38.0) or >>
screen.place(left, 28.0, 174.0, half, math.max(300.0, height - 245.0)) or >>
screen.place(right, 48.0 + half, 174.0, half, math.max(300.0, height - 245.0)) or >>
screen.place(status, 28.0, height - 49.0, width - 56.0, 28.0) or >>
_ := screen.render() or >>
for action in screen.next(events) or >> {
_ := dispatcher.dispatch(&action, $&model, $&screen) or >>
}
}
screen.dispose()
<< 0
}
fn worker(events chan ui.Event) {scene(events) or(err) {demo.fail(err.msg())
<< }}
fn launch() int {
$app := demo.app("XUUI / WebView Components", 1020, 720) or >>
_ := ui.register_content_plugin(ui.content_plugin_webview())
emits := chan string {cap: 64}
xu ipc(app.event_ch, emits)
xu worker(app.event_ch)
<< app.run() or >>
}
fn main() int { << launch() or(err) {eprintln(err.msg())
<< 1}}@main
#ui
#ui/widgets
struct Model{left int
right int
hide int
close int
status int
modal int
hidden bool
disposed bool}
fn toggle_left(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
if m.disposed{ << ""}
m.hidden = !m.hidden
screen.set_visible(m.left, !m.hidden) or(err) { << err.msg()}
if m.hidden{screen.set_text(m.hide, "Show left") or(err) { << err.msg()}} else {screen.set_text(m.hide, "Hide left") or(err) { << err.msg()}}
<< ""
}
fn reload_right(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.webview_command(m.right, "reload") or(err) { << err.msg()}
<< ""
}
fn dispose_left(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
if m.disposed{ << ""}
screen.close_webview(m.left) or(err) { << err.msg()}
m.disposed = true
screen.set_enabled(m.hide, false) or(err) { << err.msg()}
screen.set_enabled(m.close, false) or(err) { << err.msg()}
<< ""
}
fn open_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.open(m.modal) or(err) { << err.msg()}
<< ""
}
fn close_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.close_overlay(m.modal) or(err) { << err.msg()}
<< ""
}
fn web_loaded(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.set_text(m.status, "WebView " + str(action.id) + " loaded independently") or(err) { << err.msg()}
<< ""
}
fn web_failed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.set_text(m.status, "WebView " + str(action.id) + " failed to load") or(err) { << err.msg()}
<< ""
}16_ui_webview/xacp_screen/main.xu@main
#ui
#ui/widgets
#xacp
#errors
demo #"github.com/xulang-org/examples/ui_demo"
struct Model{
label_id int
count int
}
fn (m $&Model) layout(s $&widgets.Screen) int {
s.place(m.label_id, 32.0, 36.0, 540.0, 44.0) or >>
<< 0
}
fn inspect_screen(s $&widgets.Screen) int {
$session := xacp.open_session()
// The in-process adapter follows the current session lifecycle too.
// This token belongs only to this local demonstration; no listener is opened.
permissions := xacp.PERM_UI_READ | xacp.PERM_UI_MUTATE
limits := xacp.default_limits()
$nonces := xacp.new_nonce_registry(8, true)
hello := xacp.parse_frame("id: !i 1\nop: xacp.hello\nargs:\n ver: !ver 1.0.0\n nonce: local-screen-demo\n token: local-screen-demo\n permissions: !i " + str(permissions) + "\n") or(err) {
xacp.close_session($&session)
>> err
}
opened := xacp.dispatch_with_token($&session, &hello, &limits, "local-screen-demo", $&nonces)
if !opened.ok{
xacp.close_session($&session)
>> errors.new("xacp_screen: " + opened.err_msg)
}
tree := xacp.ui_tree(& * s, $&session, 2, false, 0, 32, &limits) or(err) {
xacp.close_session($&session)
>> err
}
println("XACP ui.tree: " + str(tree.nodes.len) + " visible nodes")
for node in tree.nodes{
println(" #" + str(node.id) + " kind=" + str(node.kind) + " " + node.text)
}
$snapshot := xacp.ui_screenshot(& * s, $&session, 3, 1.0, &limits) or(err) {
xacp.close_session($&session)
>> err
}
println("XACP ui.screenshot: " + str(snapshot.pixel_width) + "x" + str(snapshot.pixel_height) + " pixels")
snapshot.dispose() or(err) {
xacp.close_session($&session)
>> err
}
_ := xacp.ui_act(& * s, $&session, 2, 4, "focus", "", false, &limits) or(err) {
xacp.close_session($&session)
>> err
}
xacp.close_session($&session)
<< 0
}
fn scene(events chan ui.Event) int {
ready := demo.ready(events) or >>
if ready.kind == ui.EV_EXIT{ << 0}
$screen := widgets.screen(&ready) or >>
screen.resize(640.0, 180.0) or >>
label_id := screen.label("XACP Screen adapter", 22.0, false) or >>
button_id := screen.button("Activate locally or through ui.act") or >>
screen.place(label_id, 32.0, 36.0, 540.0, 44.0) or >>
screen.place(button_id, 32.0, 96.0, 360.0, 40.0) or >>
inspect_screen($&screen) or(err) {
screen.dispose()
>> err
}
$model := Model{label_id: label_id, count: 0}
$actions := widgets.action_dispatcher(&model, &screen)
actions.on(button_id, widgets.ACTION_ACTIVATE, activate) or >>
actions.set_fallback(global_key)
<< widgets.run_screen_actions($&screen, events, $&model, layout_action, &actions) or >>
}
fn worker(events chan ui.Event) {
scene(events) or(err) {demo.fail(err.msg())
<< }
}
fn launch() int {
$app := demo.app("Xu / XACP Screen adapter", 640, 180) or >>
xu worker(app.event_ch)
<< app.run() or >>
}
fn main() int {
<< launch() or(err) {eprintln(err.msg())
<< 1}
}@main
#ui
#ui/widgets
fn activate(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.count += 1
screen.set_text(m.label_id, "Button actions: " + str(m.count)) or(err) { << err.msg()}
<< ""
}
fn global_key(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
if action.kind == widgets.ACTION_KEY && int(action.value) == ui.KEY_ESCAPE{screen.close() or(err) { << err.msg()}}
<< ""
}
fn layout_action(m $&Model, screen $&widgets.Screen) string {
m.layout(screen) or(err) { << err.msg()}
<< ""
}16_ui_webview/controls_gallery/main.xu@main
#ui
#ui/draw
#ui/layout
#ui/widgets
demo #"github.com/xulang-org/examples/ui_demo"
fn rect(x f64, y f64, width f64, height f64) layout.Rect{
<< layout.Rect{x: x, y: y, width: width, height: height}
}
// One worker owns the controls and their canvas resources. Every recorded
// label remains alive until the complete frame has been accepted.
fn scene(ech chan ui.Event) int {
ready := demo.ready(ech) or >>
if ready.kind == ui.EV_EXIT{ << 0}
identity := ui.canvas_of(&ready) or >>
context := draw.context_of(&ready) or >>
$switcher := widgets.style_switcher()
switcher.use_preset(widgets.THEME_LIGHT) or >>
$toggle := widgets.switch_control(&identity, 1, &rect(48.0, 116.0, 280.0, 48.0), true) or >>
$radio := widgets.radio(&identity, 2, &rect(48.0, 180.0, 280.0, 48.0), 1, false) or >>
$slider := widgets.slider(&identity, 3, &rect(48.0, 260.0, 280.0, 36.0), 0.0, 100.0, 50.0) or >>
slider.set_step(5.0) or >>
$stepper := widgets.stepper(&identity, 4, &rect(48.0, 324.0, 280.0, 48.0), 0.0, 20.0, 1.0, 5.0) or >>
$tabs := widgets.tabs(&identity, 5, &rect(376.0, 116.0, 348.0, 48.0), 3, 0) or >>
$dropdown := widgets.select_box(&identity, 6, &rect(376.0, 196.0, 348.0, 48.0), 3, 0) or >>
$list := widgets.list_box(&identity, 7, &rect(376.0, 284.0, 348.0, 132.0), 3, 0) or >>
panel := widgets.card(&rect(24.0, 92.0, 724.0, 352.0)) or >>
badge := widgets.badge(&rect(48.0, 392.0, 280.0, 32.0)) or >>
divider := widgets.divider(&rect(48.0, 244.0, 280.0, 2.0), widgets.AXIS_HORIZONTAL) or >>
$label0 := widgets.styled_label(&context, &"Enabled")
$label1 := widgets.styled_label(&context, &"Choose this option")
$label2 := widgets.styled_label(&context, &"Stepper")
$label3 := widgets.styled_label(&context, &"One")
$label4 := widgets.styled_label(&context, &"Two")
$label5 := widgets.styled_label(&context, &"Three")
$label6 := widgets.styled_label(&context, &"Select an option")
$label7 := widgets.styled_label(&context, &"Xu 0.10.2")
$label8 := widgets.styled_label(&context, &"One")
$label9 := widgets.styled_label(&context, &"Two")
$label10 := widgets.styled_label(&context, &"Three")
$frame := context.new_frame(16384)
$state := Model{dirty: true, focus: 0}
$dispatcher := widgets.action_dispatcher(&state, &switcher)
for id in 1:8 {dispatcher.on_any(id, control_action) or >> }
while true {
if state.dirty{
styles := switcher.styles()
frame.begin() or >>
frame.set_bg(styles.background) or >>
panel.paint_styled($&frame, &styles) or >>
ink := styles.button.palette.foreground
title := "Extended controls / " + switcher.name()
frame.text(32.0, 28.0, 22.0, ink, &title) or >>
toggle.paint_styled($&frame, $&label0, &styles) or >>
radio.paint_styled($&frame, $&label1, &styles) or >>
divider.paint_styled($&frame, &styles) or >>
slider.paint_styled($&frame, &styles) or >>
stepper.paint_styled($&frame, $&label2, &styles) or >>
tabs.paint_box_styled($&frame, &styles) or >>
list.paint_box_styled($&frame, &styles) or >>
tabs.paint_tab_styled($&frame, 0, $&label3, &styles) or >>
list.paint_item_styled($&frame, 0, $&label8, &styles) or >>
tabs.paint_tab_styled($&frame, 1, $&label4, &styles) or >>
list.paint_item_styled($&frame, 1, $&label9, &styles) or >>
tabs.paint_tab_styled($&frame, 2, $&label5, &styles) or >>
list.paint_item_styled($&frame, 2, $&label10, &styles) or >>
dropdown.paint_styled($&frame, $&label6, &styles) or >>
badge.paint_styled($&frame, $&label7, &styles) or >>
frame.text(32.0, 464.0, 15.0, ink, &"T: theme / S: text size / D: density / Tab: focus / Esc: quit") or >>
status := "Slider " + str(int(slider.value())) + " / Stepper " + str(int(stepper.value())) + " / Select " + str(dropdown.selected() + 1)
frame.text(32.0, 494.0, 15.0, ink, &status) or >>
// A Select popup overlays the scene; this basic painter repeats
// its label. The selected option index is shown in the status.
dropdown.paint_popup_styled($&frame, $&label6, &styles) or >>
// This worker can repaint for a burst of control and appearance actions.
frame.present_wait() or >>
toggle.painted()
radio.painted()
slider.painted()
stepper.painted()
tabs.painted()
dropdown.painted()
list.painted()
state.dirty = false
}
event := demo.next(ech)
if event.kind == ui.EV_EXIT{ <- }
if event.window_id != identity.window_id{ -> }
if event.kind == ui.EV_CANVAS_CLOSED{ <- }
if event.kind == ui.EV_CANVAS_METRICS{state.dirty = true}
if ui.is_input_event(event.kind) {
input := ui.input_of(&event) or >>
if input.generation != identity.generation{ -> }
if input.kind == ui.EV_KEY_DOWN && input.repeat == 0 {
if input.key == ui.KEY_ESCAPE{
// App shutdown revokes canvas resources. Do not enqueue
// another frame while the native host is closing.
demo.quit() or >>
<< 0
}
if appearance_key($&switcher, &input) or >> {state.dirty = true}
if input.key == ui.KEY_TAB{state.focus = state.focus % 7 + 1
state.dirty = true}
}
}
// Route the popup first. A modal option click must not also focus
// or activate the ListBox underneath it.
popup_open := dropdown.is_open()
first := dropdown.event(&event) or >>
$actions :=[first]
if !popup_open && !first.consumed{
actions.push(toggle.event(&event) or >>)
actions.push(radio.event(&event) or >>)
actions.push(slider.event(&event) or >>)
actions.push(stepper.event(&event) or >>)
actions.push(tabs.event(&event) or >>)
actions.push(list.event(&event) or >>)
}
for action in actions{
if !(dispatcher.dispatch(&action, $&state, $&switcher) or >>) {
// ACTION_NONE may carry focus/repaint metadata without a semantic event.
action_state($&state, &action)
}
}
toggle.set_focus(state.focus == 1)
radio.set_focus(state.focus == 2)
slider.set_focus(state.focus == 3)
stepper.set_focus(state.focus == 4)
tabs.set_focus(state.focus == 5)
dropdown.set_focus(state.focus == 6)
list.set_focus(state.focus == 7)
}
frame.dispose()
if demo.alive(&identity) {
label0.dispose()
label1.dispose()
label2.dispose()
label3.dispose()
label4.dispose()
label5.dispose()
label6.dispose()
label7.dispose()
label8.dispose()
label9.dispose()
label10.dispose()
}
<< 0
}
fn worker(ech chan ui.Event) {
scene(ech) or(err) {demo.fail(err.msg())
<< }
}
fn launch() int {
$app := demo.app("Xu UI / Extended Controls", 780, 552) or >>
xu worker(app.event_ch)
<< app.run() or >>
}
fn main() int {
<< launch() or(err) {eprintln(err.msg())
<< 1}
}@main
#ui
#ui/widgets
struct Model{dirty bool
focus int}
fn action_state(m $&Model, action &widgets.Action) {
if action.request_focus{m.focus = action.id}
if action.needs_paint{m.dirty = true}
}
fn control_action(m $&Model, switcher $&widgets.StyleSwitcher, action &widgets.Action) string {
action_state(m, action)
<< ""
}@main
#ui
#ui/widgets
fn appearance_key(switcher $&widgets.StyleSwitcher, input &ui.InputEvent) bool {
if input.key == 84 || input.key == 116 {switcher.next() or >>
<< true}
if input.key == 83 || input.key == 115 {
$scale := 1.4
if switcher.text_scale() > 1.0 {scale = 1.0}
switcher.set_text_scale(scale) or >>
<< true
}
if input.key == 68 || input.key == 100 {
$density := 0.85
if switcher.density() < 1.0 {density = 1.0}
switcher.set_density(density) or >>
<< true
}
<< false
}16_ui_webview/component_catalog/main.xu@main
#ui
#ui/widgets
#ui/draw
#time
#math
demo #"github.com/xulang-org/examples/ui_demo"
// The model contains business choices and screen-local handles only.
struct Model{
page int
theme int
text_scale f64
density f64
appearance_dirty bool
nav []int
settings []int
pages []int
headings []int
captions []int
table int
tree int
pager int
crumbs int
combo int
multi int
color int
spinner int
overlay_buttons []int
popover int
modal int
modal_actions []int
value_label int
note int
}
fn (m &Model) fill_table(screen $&widgets.Screen) int {
names :=["Compiler", "Widgets", "Runtime", "Desktop", "Examples", "Tooling"]
states :=["Ready", "Review", "Ready", "Draft", "Ready", "Review"]
clocks :=["10:30", "11:15", "09:40", "12:00", "10:05", "08:50"]
$order :=[0, 1, 2, 3, 4, 5]
col := screen.sort_column(m.table) or >>
if col == 0 {order =[0, 3, 4, 2, 5, 1]}
if col == 1 {order =[3, 0, 2, 4, 1, 5]}
if col == 2 {order =[5, 2, 4, 0, 1, 3]}
desc := screen.sort_descending(m.table) or >>
page :=(screen.selected(m.pager) or >>) + 1
for row in 0:6 {
$slot := row
if desc{slot = 5 - row}
i := order[slot]
screen.set_cell(m.table, row, 0, names[i] + " / " + str(page)) or >>
screen.set_cell(m.table, row, 1, states[i]) or >>
screen.set_cell(m.table, row, 2, clocks[i]) or >>
}
<< 0
}
fn (m $&Model) layout(screen $&widgets.Screen) int {
width := screen.width()
height := screen.height()
row := screen.row_height()
for i in 0:3 {
screen.place(m.nav[i], 28.0 + f64(i) * 124.0, 142.0, 112.0, row) or >>
screen.set_selected_button(m.nav[i], m.page == i) or >>
screen.set_visible(m.pages[i], m.page == i) or >>
screen.place(m.settings[i], width - 420.0 + f64(i) * 132.0, 142.0, 120.0, row) or >>
}
screen.place(m.headings[0], 28.0, 26.0, width - 56.0, 24.0) or >>
screen.place(m.headings[1], 28.0, 61.0, width - 56.0, 46.0) or >>
screen.place(m.headings[2], 28.0, 108.0, width - 56.0, 30.0) or >>
screen.place(m.crumbs, 28.0, 204.0, width - 56.0, row) or >>
screen.place(m.note, 28.0, height - 48.0, width - 56.0, 30.0) or >>
content := math.max(160.0, height - 420.0)
screen.place(m.captions[0], 28.0, 253.0, width * 0.62 - 40.0, 30.0) or >>
screen.place(m.captions[1], width * 0.62 + 12.0, 253.0, width * 0.38 - 40.0, 30.0) or >>
screen.place(m.table, 28.0, 280.0, width * 0.62 - 40.0, content) or >>
screen.place(m.tree, width * 0.62 + 12.0, 280.0, width * 0.38 - 40.0, content) or >>
screen.place(m.pager, 28.0, height - 118.0, 380.0, row) or >>
screen.place(m.captions[2], 28.0, 253.0, 400.0, 30.0) or >>
screen.place(m.captions[3], 28.0, 363.0, 400.0, 30.0) or >>
screen.place(m.captions[4], 450.0, 253.0, width - 478.0, 30.0) or >>
screen.place(m.combo, 28.0, 280.0, 370.0, row) or >>
screen.place(m.multi, 28.0, 390.0, 370.0, row) or >>
screen.place(m.color, 450.0, 280.0, width - 478.0, 240.0) or >>
screen.place(m.spinner, 28.0, 562.0, 28.0, 28.0) or >>
screen.place(m.captions[5], 70.0, 568.0, width - 98.0, 30.0) or >>
screen.place(m.value_label, 28.0, 620.0, width - 56.0, 36.0) or >>
screen.place(m.captions[6], 28.0, 253.0, width - 56.0, 30.0) or >>
for i in 0:4 {screen.place(m.overlay_buttons[i], 28.0 + f64(i) * 208.0, 280.0, 190.0, row) or >>
screen.place(m.captions[i + 7], 28.0, 365.0 + f64(i) * 40.0, width - 56.0, 32.0) or >> }
screen.place(m.modal_actions[0], 24.0, 210.0, 194.0, row) or >>
screen.place(m.modal_actions[1], 234.0, 210.0, 194.0, row) or >>
<< 0
}
fn new_model(screen $&widgets.Screen) Model{
$nav :=[]int {}
for text in["Data", "Inputs", "Overlays"] {nav.push(screen.button(text) or >>)}
$settings :=[]int {}
for text in["Theme", "Text size", "Density"] {settings.push(screen.button(text) or >>)}
$pages :=[]int {}
for i in 0:3 {pages.push(screen.group() or >>)}
headings :=[screen.label("XUUI / COMPONENT CATALOG", 12.0, true) or >>,
screen.label("Native components, working together.", 26.0, false) or >>,
screen.label("Keyboard, pointer, themes, typography and density — managed by Screen.", 13.0, true) or >>]
crumbs := screen.breadcrumbs(&["Workspace", "UI", "Component catalog"]) or >>
note := screen.label("Choose a category · Tab / Shift+Tab · Escape", 13.0, true) or >>
table := screen.table(&["Module", "State", "Updated"], 6, 0) or >>
tree := screen.tree() or >>
pager := screen.pagination(3, 0) or >>
combo := screen.combo_box(&["Compiler", "Widgets", "Runtime", "Desktop", "Examples", "工具链"], "") or >>
multi := screen.multi_select(&["Native", "Keyboard", "IME", "Theming", "Motion"]) or >>
screen.set_checked(multi, 0, true) or >>
color := screen.color_picker(draw.rgba(59, 130, 246, 220)) or >>
spinner := screen.spinner() or >>
value_label := screen.label("Value: Selected tags: 1", 14.0, false) or >>
$overlay_buttons :=[]int {}
for text in["Open popover", "Open modal", "Show toast", "Hover / focus me"] {overlay_buttons.push(screen.button(text) or >>)}
popover := screen.popover(overlay_buttons[0], "An anchored panel for related actions.") or >>
modal := screen.modal("Keep focus where it belongs", "Screen owns focus, input isolation and restoration.") or >>
_ := screen.tooltip(overlay_buttons[3], "Pointer and keyboard share this hint.") or >>
modal_actions :=[screen.button("Complete action") or >>, screen.button("Close") or >>]
for id in modal_actions{screen.set_parent(id, modal) or >> }
$captions :=[]int {}
for text in["TABLE / sort columns · select rows · scroll", "TREE / expand · navigate",
"COMBO BOX / type to filter · native IME", "MULTI SELECT / independent choices",
"COLOR PICKER / red · green · blue · alpha", "Loading indicator · respects reduced motion",
"OVERLAYS / anchor placement · focus ownership · timed feedback",
"Popover: anchored to its trigger and constrained to the canvas.",
"Modal: Tab stays inside; Escape closes; focus returns to the trigger.",
"Toast: closes automatically; hover or focus pauses its lifetime.",
"Tooltip: hover or keyboard focus reveals a delayed explanation."] {captions.push(screen.label(text, 13.0, true) or >>)}
for id in[table, tree, pager, captions[0], captions[1]] {screen.set_parent(id, pages[0]) or >> }
for id in[combo, multi, color, spinner, value_label, captions[2], captions[3], captions[4], captions[5]] {screen.set_parent(id, pages[1]) or >> }
for id in overlay_buttons{screen.set_parent(id, pages[2]) or >> }
screen.set_parent(popover, pages[2]) or >>
for i in 6:11 {screen.set_parent(captions[i], pages[2]) or >> }
root := screen.tree_add(tree, - 1, "XU Workspace") or >>
compiler := screen.tree_add(tree, root, "Compiler") or >>
_ := screen.tree_add(tree, compiler, "Frontend") or >>
_ := screen.tree_add(tree, compiler, "Native backend") or >>
ui_root := screen.tree_add(tree, root, "UI") or >>
_ := screen.tree_add(tree, ui_root, "Widgets") or >>
_ := screen.tree_add(tree, ui_root, "Drawing") or >>
_ := screen.tree_add(tree, root, "Examples") or >>
for node in[root, compiler, ui_root] {screen.set_expanded(tree, node, true) or >> }
m := Model{page: 0, theme: 1, text_scale: 1.0, density: 1.0, appearance_dirty: true, nav: nav, settings: settings, pages: pages, headings: headings, captions: captions,
table: table, tree: tree, pager: pager, crumbs: crumbs, combo: combo, multi: multi, color: color, spinner: spinner,
overlay_buttons: overlay_buttons, popover: popover, modal: modal, modal_actions: modal_actions, value_label: value_label, note: note}
m.fill_table(screen) or >>
<< m
}
fn scene(events chan ui.Event) int {
ready := demo.ready(events) or >>
if ready.kind == ui.EV_EXIT{ << 0}
$screen := widgets.screen(&ready) or >>
screen.resize(1040.0, 820.0) or >>
screen.set_min_size(1040, 760) or >>
$model := new_model($&screen) or(err) {screen.dispose()
>> err}
actions := register_actions(&model, &screen) or >>
<< widgets.run_screen_actions($&screen, events, $&model, layout_action, &actions) or >>
}
fn worker(events chan ui.Event) {scene(events) or(err) {demo.fail(err.msg())
<< }}
fn launch() int {$app := demo.app("Xu UI / Component Catalog", 1040, 820) or >>
xu worker(app.event_ch)
<< app.run() or >> }
fn main() int { << launch() or(err) {eprintln(err.msg())
<< 1}}@main
#ui
#ui/widgets
fn page_0(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.page = 0
<< ""
}
fn page_1(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.page = 1
<< ""
}
fn page_2(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.page = 2
<< ""
}
fn choose_theme(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.theme =(m.theme + 1) % 3
m.appearance_dirty = true
<< ""
}
fn choose_scale(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
if m.text_scale == 1.0 {m.text_scale = 1.4} else {m.text_scale = 1.0}
m.appearance_dirty = true
<< ""
}
fn choose_density(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
if m.density == 1.0 {m.density = 0.8} else {m.density = 1.0}
m.appearance_dirty = true
<< ""
}
fn refresh_table(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.fill_table(screen) or(err) { << err.msg()}
<< ""
}
fn open_popover(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.open(m.popover) or(err) { << err.msg()}
<< ""
}
fn open_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.open(m.modal) or(err) { << err.msg()}
<< ""
}
fn notify_theme(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
_ := screen.notify("All components share the same theme.") or(err) { << err.msg()}
<< ""
}
fn complete_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.close_overlay(m.modal) or(err) { << err.msg()}
_ := screen.notify("Action completed.") or(err) { << err.msg()}
<< ""
}
fn close_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.close_overlay(m.modal) or(err) { << err.msg()}
<< ""
}
fn changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.set_text(m.note, "Value changed · Tab / Shift+Tab · Escape") or(err) { << err.msg()}
<< ""
}
fn page_changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.fill_table(screen) or(err) { << err.msg()}
<< changed(m, screen, action)
}
fn inputs_changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
value := screen.text_value(m.combo) or(err) { << err.msg()}
count :=(screen.values(m.multi) or(err) { << err.msg()}).len
screen.set_text(m.value_label, "Value: " + value + " Selected tags: " + str(count)) or(err) { << err.msg()}
<< changed(m, screen, action)
}
fn global_key(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
if action.kind == widgets.ACTION_KEY && int(action.value) == ui.KEY_ESCAPE{screen.close() or(err) { << err.msg()}}
<< ""
}
fn register_actions(m &Model, screen &widgets.Screen) widgets.ActionDispatcher#Model, widgets.Screen, widgets.Action{
$d := widgets.action_dispatcher(m, screen)
d.on(m.nav[0], widgets.ACTION_ACTIVATE, page_0) or >>
d.on(m.nav[1], widgets.ACTION_ACTIVATE, page_1) or >>
d.on(m.nav[2], widgets.ACTION_ACTIVATE, page_2) or >>
d.on(m.settings[0], widgets.ACTION_ACTIVATE, choose_theme) or >>
d.on(m.settings[1], widgets.ACTION_ACTIVATE, choose_scale) or >>
d.on(m.settings[2], widgets.ACTION_ACTIVATE, choose_density) or >>
d.on(m.table, widgets.ACTION_ACTIVATE, refresh_table) or >>
d.on(m.overlay_buttons[0], widgets.ACTION_ACTIVATE, open_popover) or >>
d.on(m.overlay_buttons[1], widgets.ACTION_ACTIVATE, open_modal) or >>
d.on(m.overlay_buttons[2], widgets.ACTION_ACTIVATE, notify_theme) or >>
d.on(m.modal_actions[0], widgets.ACTION_ACTIVATE, complete_modal) or >>
d.on(m.modal_actions[1], widgets.ACTION_ACTIVATE, close_modal) or >>
for id in[m.table, m.tree, m.crumbs, m.color] {d.on(id, widgets.ACTION_CHANGE, changed) or >> }
d.on(m.pager, widgets.ACTION_CHANGE, page_changed) or >>
d.on(m.combo, widgets.ACTION_CHANGE, inputs_changed) or >>
d.on(m.multi, widgets.ACTION_CHANGE, inputs_changed) or >>
// Screen-wide keys have id 0, outside the by-id control namespace.
d.set_fallback(global_key)
<< d
}@main
#ui
#ui/widgets
fn layout_action(m $&Model, screen $&widgets.Screen) string {
apply_appearance(m, screen) or(err) { << err.msg()}
m.layout(screen) or(err) { << err.msg()}
<< ""
}
fn apply_appearance(m $&Model, screen $&widgets.Screen) int {
if !m.appearance_dirty{ << 0}
$styles := widgets.preset_styles(m.theme) or >>
styles.text_scale = m.text_scale
styles.density = m.density
appearance := widgets.screen_appearance(&styles, screen.reduced_motion()) or >>
screen.apply_appearance(&appearance) or >>
m.appearance_dirty = false
<< 0
}16_ui_webview/widgets/main.xu@main
#ui
#ui/draw
#ui/layout
#ui/widgets
demo #"github.com/xulang-org/examples/ui_demo"
struct Model{
button widgets.Button
checkbox widgets.Checkbox
progress widgets.Progress
scroll widgets.Scroll
button_label draw.TextLayout
checkbox_label draw.TextLayout
theme widgets.Theme
context draw.Context
count int
header_id int
button_id int
check_id int
progress_id int
scroll_id int
row_ids []int
}
fn (model $&Model) button_input(kind int, input &ui.InputEvent) widgets.Action{
button := $&model.button
<< button.route(kind, input) or >>
}
fn (model $&Model) checkbox_input(kind int, input &ui.InputEvent) widgets.Action{
checkbox := $&model.checkbox
<< checkbox.route(kind, input) or >>
}
fn (model $&Model) scroll_input(kind int, input &ui.InputEvent) widgets.Action{
scroll := $&model.scroll
<< scroll.route(kind, input) or >>
}
fn (model $&Model) input(id int, kind int, input &ui.InputEvent) widgets.Action{
if id == model.button_id{ << model.button_input(kind, input) or >> }
if id == model.check_id{ << model.checkbox_input(kind, input) or >> }
if id == model.scroll_id{ << model.scroll_input(kind, input) or >> }
<< widgets.Action{kind: widgets.ACTION_NONE, id: id, needs_paint: false, request_focus: false, consumed: false, value: 0.0}
}
fn (model $&Model) place_button(bounds &layout.Rect) int {
button := $&model.button
<< button.set_bounds(bounds) or >>
}
fn (model $&Model) place_checkbox(bounds &layout.Rect) int {
checkbox := $&model.checkbox
<< checkbox.set_bounds(bounds) or >>
}
fn (model $&Model) place_progress(bounds &layout.Rect) int {
progress := $&model.progress
<< progress.set_bounds(bounds) or >>
}
fn (model $&Model) paint(id int, bounds &layout.Rect, frame $&draw.Frame) bool {
model.draw_node(id, bounds, frame) or(err) {eprintln(err.msg())
<< false}
<< true
}
fn (model $&Model) draw_node(id int, bounds &layout.Rect, frame $&draw.Frame) int {
if id == model.header_id{
demo.text(&model.context, frame, 0.0, 0.0, 14.0, demo.accent(), "03 / RETAINED LAYOUT + CONTROLS") or >>
demo.text(&model.context, frame, 0.0, 28.0, 24.0, demo.ink(), "Actions completed: " + str(model.count)) or >>
} else if id == model.button_id{
model.place_button(bounds) or >>
model.button.paint(frame, &model.button_label, &model.theme) or >>
} else if id == model.check_id{
model.place_checkbox(bounds) or >>
model.checkbox.paint(frame, &model.checkbox_label, &model.theme) or >>
} else if id == model.progress_id{
model.place_progress(bounds) or >>
model.progress.paint(frame, &model.theme) or >>
} else if id == model.scroll_id{
scroll := $&model.scroll
scroll.set_bounds(bounds) or >>
frame.fill_rect(0.0, 0.0, bounds.width, bounds.height, draw.rgb(26, 37, 50)) or >>
} else {
for i in 0:model.row_ids.len{
if id == model.row_ids[i] {demo.text(&model.context, frame, 12.0, 5.0, 15.0, demo.muted(), "Retained row " + str(i + 1) + " / scroll, Tab, PageDown, Home") or >> }
}
}
<< 0
}
fn (model $&Model) advance() int {
model.count = model.count + 1
println("Action count: " + str(model.count))
value := f64(model.count % 11) / 10.0
progress := $&model.progress
<< progress.set_value(value) or >>
}
fn (model $&Model) enable_button(enabled bool) {
button := $&model.button
button.set_enabled(enabled)
}
fn (model $&Model) acknowledge_button() {
control := $&model.button
control.painted()
}
fn (model $&Model) acknowledge_checkbox() {
control := $&model.checkbox
control.painted()
}
fn (model $&Model) acknowledge_progress() {
control := $&model.progress
control.painted()
}
fn (model $&Model) acknowledge_scroll() {
control := $&model.scroll
control.painted()
}
fn (model $&Model) acknowledge() {
model.acknowledge_button()
model.acknowledge_checkbox()
model.acknowledge_progress()
model.acknowledge_scroll()
}
fn scene(ech chan ui.Event) int {
ready := demo.ready(ech) or >>
if ready.kind == ui.EV_EXIT{ << 0}
identity := ui.canvas_of(&ready) or >>
context := draw.context_of(&ready) or >>
host := widgets.Host{context: context, identity: identity}
$column := layout.box_style(layout.BOX_COLUMN)
column.padding = layout.insets(28.0) or >>
column.gap = 14.0
column.cross_alignment = layout.CROSS_STRETCH
$view := host.view(&column, demo.background()) or >>
leaf := layout.box_style(layout.BOX_LEAF)
header := view.add(view.root(), &leaf, &layout.Size{width: 400.0, height: 72.0}) or >>
button_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 44.0}) or >>
check_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 40.0}) or >>
progress_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 12.0}) or >>
$viewport := layout.box_style(layout.BOX_COLUMN)
viewport.height = 220.0
viewport.clip = true
viewport.cross_alignment = layout.CROSS_STRETCH
viewport.gap = 6.0
scroll_id := view.add(view.root(), &viewport, &layout.Size{width: 400.0, height: 220.0}) or >>
$rows :=[]int {}
for _ in 0:20 {
row := view.add(scroll_id, &leaf, &layout.Size{width: 400.0, height: 32.0}) or >>
rows.push(row)
view.set_boundary(row, true) or >>
}
for id in[header, button_id, check_id, progress_id, scroll_id] {view.set_boundary(id, true) or >> }
for id in[button_id, check_id, scroll_id] {view.set_input(id, true, true) or >> }
empty := layout.Rect{x: 0.0, y: 0.0, width: 0.0, height: 0.0}
options := draw.text_options(15.0)
first := "Complete one action"
second := "Enable action button"
$model := Model{button: widgets.button(&identity, button_id, &empty) or >>,
checkbox: widgets.checkbox(&identity, check_id, &empty, true) or >>,
progress: widgets.progress(&empty, 0.0) or >>,
scroll: widgets.scroll(&identity, scroll_id, &empty, widgets.AXIS_VERTICAL, 760.0) or >>,
button_label: context.layout_text(&first, &options) or >>,
checkbox_label: context.layout_text(&second, &options) or >>,
theme: widgets.default_theme(), context: context, count: 0, header_id: header, button_id: button_id, check_id: check_id, progress_id: progress_id, scroll_id: scroll_id, row_ids: rows}
dispatcher := register_actions(&model, &view) or >>
$width := 700.0
$height := 600.0
while true {
constraints := layout.tight(width, height) or >>
submitted := widgets.present($&view, &constraints, $&model) or >>
if submitted{model.acknowledge()}
event := demo.next(ech)
if event.kind == ui.EV_EXIT{ <- }
if event.window_id != identity.window_id{ -> }
if event.kind == ui.EV_CANVAS_METRICS{
metrics := ui.metrics_of(&event) or >>
if metrics.width > 0.0 && metrics.height > 0.0 {width = metrics.width
height = metrics.height}
}
actions := widgets.dispatch_event($&view, &event, $&model) or >>
for action in actions{_ := dispatcher.dispatch(&action, $&model, $&view) or >> }
if event.kind == ui.EV_CANVAS_CLOSED{ <- }
if ui.is_input_event(event.kind) {
input := ui.input_of(&event) or >>
if input.kind == ui.EV_KEY_DOWN && input.key == ui.KEY_ESCAPE{demo.quit() or >> }
}
stats := view.stats()
if stats.recorded_boundaries > 0 || stats.reused_boundaries > 0 {
println("View: " + str(stats.recorded_boundaries) + " recorded / " + str(stats.reused_boundaries) + " reused boundaries")
}
}
view.dispose()
// Native close revokes resources; only release user handles while live.
if demo.alive(&identity) {
label := $&model.button_label
label.dispose() or >>
check_label := $&model.checkbox_label
check_label.dispose() or >>
}
<< 0
}
fn worker(ech chan ui.Event) {scene(ech) or(err) {demo.fail(err.msg())
<< }}
fn launch() int {
$app := demo.app("Xu UI / Retained Controls", 700, 600) or >>
xu worker(app.event_ch)
<< app.run() or >>
}
fn main() int { << launch() or(err) {eprintln(err.msg())
<< 1}}@main
#ui
#ui/widgets
fn activate(m $&Model, screen $&widgets.View, action &widgets.Action) string {
m.advance() or(err) { << err.msg()}
screen.mark_paint(m.header_id) or(err) { << err.msg()}
screen.mark_paint(m.progress_id) or(err) { << err.msg()}
<< ""
}
fn enable(m $&Model, screen $&widgets.View, action &widgets.Action) string {
enabled := m.checkbox.value()
m.enable_button(enabled)
screen.set_input(m.button_id, enabled, enabled) or(err) { << err.msg()}
screen.mark_paint(m.button_id) or(err) { << err.msg()}
<< ""
}
fn scroll(m $&Model, screen $&widgets.View, action &widgets.Action) string {
screen.set_scroll(m.scroll_id, 0.0, action.value) or(err) { << err.msg()}
<< ""
}
fn register_actions(m &Model, screen &widgets.View) widgets.ActionDispatcher#Model, widgets.View, widgets.Action{
$d := widgets.action_dispatcher(m, screen)
d.on(m.button_id, widgets.ACTION_ACTIVATE, activate) or >>
d.on(m.check_id, widgets.ACTION_CHANGE, enable) or >>
d.on(m.scroll_id, widgets.ACTION_SCROLL, scroll) or >>
<< d
}16_ui_webview/interaction_gallery/main.xu@main
#ui
#ui/widgets
#ui/layout
#time
#math
#errors
demo #"github.com/xulang-org/examples/ui_demo"
struct Model{
tree int
name int
search int
task int
cancel int
table int
theme int
guides int
density int
effects int
failure int
message int
headings []int
controls_page int
work_group int
basic_group int
extras []int
show_controls bool
theme_index int
guided bool
compact bool
reduced bool
fail_next bool
appearance_dirty bool
task_id int
completed int
running bool
checksum int
next_work time.Instant
}
fn make_model(screen $&widgets.Screen) Model{
$name_decoration := widgets.field_decoration(&"Output name")
name_decoration.helper = "A persistent label, native text selection and IME"
name_decoration.error = "Enter an output name before building."
name_decoration.clearable = true
name := screen.field("", &name_decoration) or >>
$search_decoration := widgets.field_decoration(&"Find a component")
search_decoration.helper = "Matching nodes keep their ancestor path"
search_decoration.clearable = true
search := screen.field("", &search_decoration) or >>
tree := screen.tree() or >>
root := screen.tree_add(tree, - 1, "xu-workbench") or >>
src := screen.tree_add(tree, root, "src") or >>
entry := screen.tree_add(tree, src, "main.xu") or >>
controls := screen.tree_add(tree, src, "widgets") or >>
for label in["tree_view.xu", "task_button.xu", "field.xu", "table.xu"] {
node := screen.tree_add(tree, controls, label) or >>
screen.set_tree_action(tree, node, true) or >>
}
manifest := screen.tree_add(tree, root, "xu.xun") or >>
screen.set_tree_metadata(tree, entry, "entry") or >>
screen.set_tree_metadata(tree, manifest, "module") or >>
for node in[root, src, controls] {screen.set_expanded(tree, node, true) or >> }
task := screen.task_button("Build project") or >>
screen.set_task_labels(task, "Building", "Built · run again", "Retry build", "Build again") or >>
table := screen.table(&["Component", "Experience", "Status"], 18, 0) or >>
screen.set_table_column(table, 0, 144.0, 0.0) or >>
screen.set_table_column(table, 1, 340.0, 0.0) or >>
screen.set_table_column(table, 2, 128.0, 0.0) or >>
names :=["TreeView", "TaskButton", "Field", "Table", "Select", "Popover"]
details :=["Find and reveal", "Real task progress", "Floating label / native IME", "Resizable columns", "Keyboard choices", "Anchored feedback"]
for row in 0:18 {
index := row % 6
screen.set_cell(table, row, 0, names[index]) or >>
screen.set_cell(table, row, 1, details[index]) or >>
screen.set_cell(table, row, 2, "Ready") or >>
}
headings :=[screen.label("XUUI / INTERACTION LAB", 12.0, true) or >>,
screen.label("Precision in every interaction.", 25.0, false) or >>,
screen.label("WORKSPACE", 12.0, true) or >>, screen.label("BUILD CONFIGURATION", 12.0, true) or >>,
screen.label("COMPONENTS / scroll, select and sort", 12.0, true) or >>]
work_group := screen.group() or >>
basic_group := screen.group() or >>
for id in[tree, name, search, task, table, headings[2], headings[3], headings[4]] {screen.set_parent(id, work_group) or >> }
extras := extra_controls(screen) or >>
for id in extras{screen.set_parent(id, basic_group) or >> }
cancel := screen.button("Cancel task") or >>
screen.set_parent(cancel, work_group) or >>
controls_page := screen.button("All controls") or >>
styles := screen.styles()
primary_style := styles.button_variant(widgets.BUTTON_PRIMARY) or >>
screen.set_control_style(task, &primary_style) or >>
<< Model{tree: tree, name: name, search: search, task: task, cancel: cancel,
table: table, theme: screen.button("Theme") or >>, guides: screen.button("Tree guides") or >>,
density: screen.button("Density") or >>, effects: screen.button("Motion") or >>, failure: screen.button("Fail next build") or >>,
message: screen.label("Local work batches report completed items. No simulated percentage clock.", 13.0, true) or >>,
headings: headings, controls_page: controls_page, work_group: work_group, basic_group: basic_group, extras: extras, show_controls: false, theme_index: 1, guided: false, compact: false, reduced: false, fail_next: false, appearance_dirty: true,
task_id: 0, completed: 0, running: false, checksum: 0, next_work: time.zero_instant()}
}
fn (m &Model) layout(screen $&widgets.Screen) int {
width := screen.width()
height := screen.height()
left := 310.0
screen.place(m.headings[0], 28.0, 24.0, width - 56.0, 22.0) or >>
screen.place(m.headings[1], 28.0, 54.0, width - 56.0, 36.0) or >>
buttons :=[m.theme, m.guides, m.density, m.effects, m.failure, m.controls_page]
for i in 0:buttons.len{screen.place(buttons[i], 28.0 + f64(i) * 144.0, 111.0, 132.0, 36.0) or >> }
screen.set_visible(m.work_group, !m.show_controls) or >>
screen.set_visible(m.basic_group, m.show_controls) or >>
screen.set_selected_button(m.controls_page, m.show_controls) or >>
extra_layout(screen, &m.extras) or >>
screen.set_selected_button(m.guides, m.guided) or >>
screen.set_selected_button(m.effects, m.reduced) or >>
screen.set_selected_button(m.failure, m.fail_next) or >>
screen.place(m.headings[2], 28.0, 173.0, left - 24.0, 24.0) or >>
screen.place(m.search, 28.0, 208.0, left - 24.0, 80.0) or >>
screen.place(m.tree, 28.0, 302.0, left - 24.0, height - 352.0) or >>
x := left + 36.0
right_width := width - x - 28.0
screen.place(m.headings[3], x, 173.0, right_width, 24.0) or >>
screen.place(m.name, x, 208.0, right_width, 86.0) or >>
screen.place(m.task, x, 307.0, 230.0, 40.0) or >>
screen.place(m.cancel, x + 246.0, 307.0, 136.0, 40.0) or >>
screen.set_enabled(m.cancel, m.running) or >>
screen.place(m.headings[4], x, 377.0, right_width, 24.0) or >>
screen.place(m.table, x, 413.0, right_width, height - 493.0) or >>
screen.place(m.message, 28.0, height - 41.0, width - 56.0, 24.0) or >>
<< 0
}
fn (m $&Model) work(screen $&widgets.Screen, now time.Instant) int {
if !m.running || now.before(m.next_work) { << 0}
// Each progress update follows an actual bounded work batch. The pause
// represents an application work queue and never changes the percentage.
for i in 0:5000 {m.checksum =(m.checksum + i *(m.completed + 1)) % 1000003}
m.completed = m.completed + 1
_ := screen.set_task_progress(m.task, m.task_id, f64(m.completed) / 48.0) or >>
m.next_work = now.add(time.milliseconds(35) or >>) or >>
if m.fail_next && m.completed == 18 {
_ := screen.complete_task(m.task, m.task_id, widgets.TASK_ERROR) or >>
m.running = false
m.fail_next = false
screen.set_text(m.message, "Example failure. Retry starts a new task; stale progress is rejected.") or >>
} else if m.completed == 48 {
_ := screen.complete_task(m.task, m.task_id, widgets.TASK_SUCCESS) or >>
m.running = false
screen.set_text(m.message, "48/48 work batches completed · checksum " + str(m.checksum)) or >>
}
<< 0
}
fn extra_controls(screen $&widgets.Screen)[]int {
$ids :=[]int {}
ids.push(screen.card() or >>)
ids.push(screen.label("CONTROLS / keyboard, pointer and state", 12.0, true) or >>)
ids.push(screen.checkbox("Keep generated files", true) or >>)
ids.push(screen.switch_control("Live preview", true) or >>)
ids.push(screen.radio("Use workspace settings", 1, true) or >>)
ids.push(screen.slider(0.0, 100.0, 40.0) or >>)
ids.push(screen.stepper(1.0, 16.0, 1.0, 4.0) or >>)
ids.push(screen.tabs(&["Files", "History", "Output"], 0) or >>)
ids.push(screen.segmented(&["Desktop", "Tablet", "Phone"], 0) or >>)
ids.push(screen.select_box(&["Xu source", "Configuration", "Plain text"], 0) or >>)
ids.push(screen.list_box(&["Compiler", "Widgets", "Runtime", "Desktop", "Examples", "Tooling"], 0) or >>)
ids.push(screen.progress(0.62) or >>)
ids.push(screen.badge("Ready") or >>)
ids.push(screen.divider(widgets.AXIS_HORIZONTAL) or >>)
ids.push(screen.radio_group(&["Use local build", "Use cached build", "Build dependencies"], 0) or >>)
ids.push(screen.input("Native input · 中文") or >>)
ids.push(screen.text_area("A multi-line editor.\nSelection, clipboard and native IME remain available.") or >>)
ids.push(screen.date_picker(time.date(2026, 10, 25, 10, 30, 0, 0)) or >>)
ids.push(screen.time_picker(time.date(2026, 10, 25, 10, 30, 0, 0)) or >>)
ids.push(screen.button("Queue notification") or >>)
_ := screen.tooltip(ids[19], "Repeated notifications queue; hover or focus pauses expiry.") or >>
screen.set_slider_commit_only(ids[5], true) or >>
screen.set_checkbox_indeterminate(ids[2], true) or >>
screen.set_select_option_enabled(ids[9], 2, false) or >>
screen.set_badge_tone(ids[12], widgets.BADGE_SUCCESS) or >>
screen.set_progress_buffer(ids[11], 0.84) or >>
screen.set_date_options(ids[17], time.date(2026, 10, 25, 0, 0, 0, 0), true) or >>
screen.set_clock_format(ids[18], true, true) or >>
<< ids
}
fn extra_layout(screen $&widgets.Screen, ids &[]int) int {
gap := 28.0
width :=(screen.width() - 84.0) * 0.5
right := 56.0 + width
screen.place(ids[0], gap, 628.0, width, 112.0) or >>
screen.place(ids[1], gap, 173.0, screen.width() - 56.0, 24.0) or >>
for i in 2:5 {screen.place(ids[i], gap, 211.0 + f64(i - 2) * 46.0, width, 36.0) or >> }
screen.place(ids[5], gap, 357.0, width - 136.0, 36.0) or >>
screen.place(ids[6], gap + width - 124.0, 357.0, 124.0, 36.0) or >>
screen.place(ids[7], gap, 412.0, width, 36.0) or >>
screen.place(ids[8], gap, 466.0, width, 36.0) or >>
screen.place(ids[11], gap, 522.0, width - 120.0, 12.0) or >>
screen.place(ids[12], gap + width - 100.0, 510.0, 100.0, 32.0) or >>
screen.place(ids[13], gap, 607.0, width, 1.0) or >>
screen.place(ids[14], right, 211.0, width, 126.0) or >>
screen.place(ids[9], right, 357.0, width, 36.0) or >>
screen.place(ids[10], right, 412.0, width, 158.0) or >>
screen.place(ids[15], right, 590.0, width, 36.0) or >>
screen.place(ids[16], right, 644.0, width, 96.0) or >>
screen.place(ids[17], gap, 560.0,(width - 16.0) * 0.5, 36.0) or >>
screen.place(ids[18], gap +(width + 16.0) * 0.5, 560.0,(width - 16.0) * 0.5, 36.0) or >>
screen.place(ids[19], gap + 16.0, 665.0, width - 32.0, 38.0) or >>
<< 0
}
fn next_event(events chan ui.Event, deadline time.Instant) ui.Event{
if deadline.is_zero() { << <- events}
delay := deadline.since(time.instant())
if delay.nanoseconds() <= 0 { << ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}}
timer := delay.timer()
select {
event := <- events{timer.stop()
<< event}
_ := <- timer.c{timer.stop()}
}
<< ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
}
fn scene(events chan ui.Event) int {
ready := demo.ready(events) or >>
if ready.kind == ui.EV_EXIT{ << 0}
$screen := widgets.screen(&ready) or >>
screen.resize(1000.0, 820.0) or >>
screen.set_min_size(900, 720) or >>
$model := make_model($&screen) or(err) {screen.dispose()
>> err}
apply_appearance($&model, $&screen) or >>
model.layout($&screen) or >>
_ := screen.render() or >>
$dispatcher := register_actions(&model, &screen) or >>
while screen.is_open() {
now := time.instant()
apply_appearance($&model, $&screen) or >>
register_notices(&screen, $&dispatcher) or >>
model.work($&screen, now) or >>
model.layout($&screen) or >>
$deadline := screen.advance(now) or(err) { >> errors.new("gallery animation: " + err.msg())}
for action in screen.take_actions() {_ := dispatcher.dispatch(&action, $&model, $&screen) or >> }
apply_appearance($&model, $&screen) or >>
_ := screen.render() or(err) { >> errors.new("gallery render: " + err.msg())}
if model.running &&(deadline.is_zero() || model.next_work.before(deadline)) {deadline = model.next_work}
event := next_event(events, deadline) or >>
$actions := screen.event(&event) or >>
$count := 0
while screen.is_open() && count < 128 {
pending := ui.poll_chan(events)
if pending.kind == ui.EV_NONE{ <- }
more := screen.event(&pending) or >>
for action in more{actions.push(action)}
count += 1
}
for action in actions{_ := dispatcher.dispatch(&action, $&model, $&screen) or >> }
}
screen.dispose()
<< 0
}
fn worker(events chan ui.Event) {scene(events) or(err) {demo.fail(err.msg())
<< }}
fn launch() int {
$app := demo.app("XUUI / Interaction Lab", 1000, 820) or >>
xu worker(app.event_ch)
<< app.run() or >>
}
fn main() int { << launch() or(err) {eprintln(err.msg())
<< 1}}@main
#ui
#ui/widgets
#time
fn search_changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
query := screen.text_value(m.search) or(err) { << err.msg()}
screen.set_tree_filter(m.tree, query) or(err) { << err.msg()}
<< ""
}
fn name_changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.set_field_invalid(m.name, false) or(err) { << err.msg()}
<< ""
}
fn node_action(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
_ := screen.notify("Node action · " + str(int(action.value))) or(err) { << err.msg()}
<< ""
}
fn slider_committed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.set_text(m.message, "Slider committed · " + str(int(action.value))) or(err) { << err.msg()}
<< ""
}
fn toggle_controls(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.show_controls = !m.show_controls
<< ""
}
fn queue_notice(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
$notice := widgets.notice(&"Saved a local configuration")
notice.action = "Undo"
_ := screen.enqueue_notice(¬ice) or(err) { << err.msg()}
<< ""
}
fn choose_theme(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.theme_index =(m.theme_index + 1) % 3
m.appearance_dirty = true
<< ""
}
fn choose_guides(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.guided = !m.guided
m.appearance_dirty = true
<< ""
}
fn choose_density(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.compact = !m.compact
m.appearance_dirty = true
<< ""
}
fn choose_motion(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.reduced = !m.reduced
m.appearance_dirty = true
<< ""
}
fn choose_failure(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
m.fail_next = !m.fail_next
<< ""
}
fn start_task(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
if m.running{ << ""}
name := screen.text_value(m.name) or(err) { << err.msg()}
if name.len == 0 {screen.set_field_invalid(m.name, true) or(err) { << err.msg()}
screen.focus(m.name) or(err) { << err.msg()}
<< ""}
m.task_id = m.task_id + 1
m.completed = 0
m.checksum = 0
m.running = true
m.next_work = time.instant()
screen.begin_task(m.task, m.task_id) or(err) { << err.msg()}
<< ""
}
fn cancel_task(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
if !m.running{ << ""}
_ := screen.complete_task(m.task, m.task_id, widgets.TASK_CANCELLED) or(err) { << err.msg()}
m.running = false
screen.set_text(m.message, "Task cancelled. Completed work remains " + str(m.completed) + "/48.") or(err) { << err.msg()}
<< ""
}
fn notice_action(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
screen.set_text(m.message, "Notification action · " + str(int(action.value))) or(err) { << err.msg()}
<< ""
}
fn register_actions(m &Model, screen &widgets.Screen) widgets.ActionDispatcher#Model, widgets.Screen, widgets.Action{
$d := widgets.action_dispatcher(m, screen)
d.on(m.search, widgets.ACTION_CHANGE, search_changed) or >>
d.on(m.name, widgets.ACTION_CHANGE, name_changed) or >>
d.on(m.tree, widgets.ACTION_ITEM_ACTION, node_action) or >>
d.on(m.extras[5], widgets.ACTION_COMMIT, slider_committed) or >>
d.on(m.controls_page, widgets.ACTION_ACTIVATE, toggle_controls) or >>
d.on(m.extras[19], widgets.ACTION_ACTIVATE, queue_notice) or >>
d.on(m.theme, widgets.ACTION_ACTIVATE, choose_theme) or >>
d.on(m.guides, widgets.ACTION_ACTIVATE, choose_guides) or >>
d.on(m.density, widgets.ACTION_ACTIVATE, choose_density) or >>
d.on(m.effects, widgets.ACTION_ACTIVATE, choose_motion) or >>
d.on(m.failure, widgets.ACTION_ACTIVATE, choose_failure) or >>
d.on(m.task, widgets.ACTION_ACTIVATE, start_task) or >>
d.on(m.cancel, widgets.ACTION_ACTIVATE, cancel_task) or >>
<< d
}
fn register_notices(screen &widgets.Screen, d $&widgets.ActionDispatcher#Model, widgets.Screen, widgets.Action) int {
for id in screen.notice_ids() {d.on(id, widgets.ACTION_NOTICE_ACTION, notice_action) or >> }
<< 0
}@main
#ui
#ui/widgets
fn apply_appearance(m $&Model, screen $&widgets.Screen) int {
if !m.appearance_dirty{ << 0}
$styles := widgets.preset_styles(m.theme_index) or >>
if m.compact{styles.density = 0.85}
appearance := widgets.screen_appearance(&styles, m.reduced) or >>
screen.apply_appearance(&appearance) or >>
primary := styles.button_variant(widgets.BUTTON_PRIMARY) or >>
screen.set_control_style(m.task, &primary) or >>
$tree := widgets.tree_appearance()
tree.guides = m.guided
screen.set_tree_appearance(m.tree, &tree) or >>
m.appearance_dirty = false
<< 0
}16_ui_webview/editor_workbench/main.xu@main
#ui
#ui/draw
#ui/widgets
#ui/layout
tokens #xuui_tokens
demo #"github.com/xulang-org/examples/ui_demo"
struct Model{
title widgets.Editor
body widgets.Editor
context draw.Context
styles widgets.Styles
dark bool
header int
title_id int
body_id int
footer int
changes int
status string
}
fn (model $&Model) input(id int, kind int, event &ui.InputEvent) widgets.Action{
if id == model.title_id{control := $&model.title
<< control.route(kind, event) or >> }
if id == model.body_id{control := $&model.body
<< control.route(kind, event) or >> }
<< widgets.Action{kind: 0, id: id, needs_paint: false, request_focus: false, consumed: false, value: 0.0}
}
fn (model $&Model) paint(id int, bounds &layout.Rect, frame $&draw.Frame) bool {
model.draw_node(id, frame) or(err) {eprintln(err.msg())
<< false}
<< true
}
fn (model $&Model) draw_node(id int,frame $&draw.Frame) int {
styles := model.styles.clone()
if id == model.title_id { control := $&model.title
control.paint_styled(frame,&styles) or >> }
else if id == model.body_id { control := $&model.body
control.paint_styled(frame,&styles) or >> }
else if id == model.header {
demo.text(&model.context,frame,0.0,0.0,24.0,tokens.text(model.dark),"Writing desk") or >>
demo.text(&model.context,frame,0.0,34.0,14.0,tokens.muted(model.dark),"XUUI design standard · native text and menu controls") or >>
demo.text(&model.context,frame,0.0,62.0,14.0,tokens.muted(model.dark),"Tab / Shift+Tab · drag selection · copy / cut / paste · arrows / Home / End") or >>
} else if id == model.footer {
demo.text(&model.context,frame,0.0,0.0,14.0,tokens.brand(model.dark),"Changes: " + str(model.changes) + " | " + model.status) or >>
demo.text(&model.context,frame,0.0,27.0,14.0,tokens.muted(model.dark),"Use the Document menu: toggle editing, reset, query screens. Escape quits.") or >>
}
<< 0
}
fn (model $&Model) place(view $&widgets.View) int {
title := $&model.title
widgets.place_editor(view, title) or >>
body := $&model.body
widgets.place_editor(view, body) or >>
<< 0
}
fn (model $&Model) native_event(event &ui.Event) bool {
title := $&model.title
first := title.event(event) or >>
body := $&model.body
second := body.event(event) or >>
<< first.kind == widgets.ACTION_CHANGE || second.kind == widgets.ACTION_CHANGE
}
fn (model $&Model) editing(on bool) int {
title := $&model.title
title.enable(on) or >>
body := $&model.body
body.enable(on) or >>
<< 0
}
fn (model $&Model) reset() int {
title := $&model.title
title.set_value(&"Untitled note") or >>
body := $&model.body
body.set_value(&"Write here.\n你好,Xu。\n\nSelection and IME are native; layout and painting stay in the retained View.") or >>
<< 0
}
fn menus(window &ui.Window,enabled bool,dark bool) int {
$entries := [ui.submenu("document","Document",-1)]
$reset := ui.menu_action("reset","Reset note",0)
reset.key = 82
reset.modifiers = ui.MENU_PRIMARY | ui.MOD_SHIFT
entries.push(reset)
entries.push(ui.menu_check("editing","Enable editing",0,enabled))
entries.push(ui.menu_separator(0))
entries.push(ui.submenu("display","Displays",0))
$query := ui.menu_action("screens","Query current screens",4)
query.key = 68
query.modifiers = ui.MENU_PRIMARY | ui.MOD_SHIFT
entries.push(query)
$unavailable := ui.menu_action("unavailable","Unavailable action",4)
unavailable.enabled = false
entries.push(unavailable)
entries.push(ui.menu_check("dark-theme","Dark appearance",0,dark))
<< window.set_menu_entries(entries) or >>
}
fn scene(ech chan ui.Event) int {
ready := demo.ready(ech) or >>
if ready.kind == ui.EV_EXIT{ << 0}
identity := ui.canvas_of(&ready) or >>
context := draw.context_of(&ready) or >>
window := ui.Window{id: identity.window_id, generation: identity.generation, title: "", width: 0, height: 0, content_kind: ui.CONTENT_DRAW, content_backend_id: identity.canvas_id, closed: 0}
menus(&window, true, false) or >>
host := widgets.Host{context: context, identity: identity}
$column := layout.box_style(layout.BOX_COLUMN)
column.padding = layout.insets(24.0) or >>
column.gap = 16.0
column.cross_alignment = layout.CROSS_STRETCH
$view := host.view(&column, tokens.canvas(false)) or >>
leaf := layout.box_style(layout.BOX_LEAF)
header := view.add(view.root(), &leaf, &layout.Size{width: 500.0, height: 88.0}) or >>
title_id := view.add(view.root(), &leaf, &layout.Size{width: 500.0, height: 44.0}) or >>
body_id := view.add(view.root(), &leaf, &layout.Size{width: 500.0, height: 260.0}) or >>
footer := view.add(view.root(), &leaf, &layout.Size{width: 500.0, height: 72.0}) or >>
for id in[header, title_id, body_id, footer] {view.set_boundary(id, true) or >> }
for id in[title_id, body_id] {view.set_input(id, true, true) or >> }
empty := layout.Rect{x: 0.0, y: 0.0, width: 0.0, height: 0.0}
$model := Model{title: widgets.input(&context, &identity, title_id, &empty, &"Untitled note") or >>,
body: widgets.text_area(&context, &identity, body_id, &empty, &"Write here.\n你好,Xu。\n\nSelection and IME are native; layout and painting stay in the retained View.") or >>,
context: context, styles: tokens.editor_styles(false), dark: false, header: header, title_id: title_id, body_id: body_id, footer: footer, changes: 0, status: "Ready"}
$dispatcher := widgets.action_dispatcher(&model, &view)
dispatcher.on(title_id, widgets.ACTION_SUBMIT, submit_title) or >>
$width := 820.0
$height := 620.0
$enabled := true
options := ui.RequestOptions{timeout_ms: 5000}
$screens := window.screens_async(&options) or >>
$event := ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
// Native text snapshots already carry the latest revision. Drain queued
// edits before painting so a key burst cannot fill the frame queue.
while true {
if event.kind == ui.EV_NONE{
constraints := layout.tight(width, height) or >>
_ := view.layout(&constraints) or >>
model.place($&view) or >>
submitted := widgets.present($&view, &constraints, $&model) or >>
if submitted{
first := $&model.title
first.painted()
second := $&model.body
second.painted()
}
event = demo.next(ech)
}
if event.kind == ui.EV_EXIT{ <- }
if event.window_id != identity.window_id{event = ui.poll_chan(ech)
-> }
if event.kind == ui.EV_CANVAS_METRICS{metrics := ui.metrics_of(&event) or >>
width = metrics.width
height = metrics.height}
actions := widgets.dispatch_event($&view, &event, $&model) or >>
if model.native_event(&event) or >> {model.changes = model.changes + 1
view.mark_paint(footer) or >> }
for action in actions{_ := dispatcher.dispatch(&action, $&model, $&view) or >> }
if event.kind == ui.EV_MENU_CLICKED{
if event.menu_id == "reset" {model.reset() or >> }
if event.menu_id == "editing" {enabled = !enabled
model.editing(enabled) or >>
for id in[title_id, body_id] {view.set_input(id, enabled, enabled) or >> }
menus(&window, enabled, model.dark) or >> }
if event.menu_id == "dark-theme" {
model.dark = !model.dark
model.styles = tokens.editor_styles(model.dark)
view.set_background(tokens.canvas(model.dark))
for id in [header,title_id,body_id,footer] { view.mark_paint(id) or >> }
menus(&window,enabled,model.dark) or >>
}
if event.menu_id == "screens" {screens.cancel()
screens = window.screens_async(&options) or >> }
}
if event.kind == ui.EV_REQUEST{result := ui.request_of(&event) or >>
if result.matches(&screens) && result.status == ui.REQUEST_COMPLETED{
displays := ui.screen_result(&result) or >>
model.status = str(displays.len) + " display(s)"
for display in displays{println("Screen: " + display.name + " / " + str(int(display.bounds.width)) + " x " + str(int(display.bounds.height)) + " / scale " + str(int(display.scale_x)))
if display.current{model.status = display.name + " · " + str(int(display.bounds.width)) + " x " + str(int(display.bounds.height))}}
view.mark_paint(footer) or >>
}
}
if event.kind == ui.EV_CANVAS_CLOSED || event.kind == ui.EV_CLOSED{ <- }
if ui.is_input_event(event.kind) {input := ui.input_of(&event) or >>
if input.kind == ui.EV_KEY_DOWN && input.key == ui.KEY_ESCAPE{demo.quit() or >> }}
event = ui.poll_chan(ech)
}
screens.cancel()
view.dispose()
<< 0
}
fn worker(ech chan ui.Event) {scene(ech) or(err) {demo.fail(err.msg())
<< }}
fn main() int {
$app := demo.app("Xu UI / Writing Desk", 820, 620) or(err) {eprintln(err.msg())
<< 1}
xu worker(app.event_ch)
<< app.run() or(err) {eprintln(err.msg())
<< 1}
}@main
#ui
#ui/widgets
fn submit_title(m $&Model, screen $&widgets.View, action &widgets.Action) string {
m.status = "Title submitted: " + m.title.value()
screen.mark_paint(m.footer) or(err) { << err.msg()}
<< ""
}16_ui_webview/workbench/main.xu@main
#ui
#ui/draw
#ui/layout
#ui/widgets
#math
demo #"github.com/xulang-org/examples/ui_demo"
struct Model{
button widgets.Button
checkbox widgets.Checkbox
progress widgets.Progress
scroll widgets.Scroll
button_label draw.TextLayout
checkbox_label draw.TextLayout
theme widgets.Theme
context draw.Context
count int
message string
source string
images []draw.Image
header_id int
button_id int
check_id int
progress_id int
scroll_id int
row_ids []int
identity ui.CanvasEvent
pending ui.Request
}
fn (model $&Model) button_input(kind int, input &ui.InputEvent) widgets.Action{
button := $&model.button
<< button.route(kind, input) or >>
}
fn (model $&Model) checkbox_input(kind int, input &ui.InputEvent) widgets.Action{
checkbox := $&model.checkbox
<< checkbox.route(kind, input) or >>
}
fn (model $&Model) scroll_input(kind int, input &ui.InputEvent) widgets.Action{
scroll := $&model.scroll
<< scroll.route(kind, input) or >>
}
fn (model $&Model) input(id int, kind int, input &ui.InputEvent) widgets.Action{
if id == model.button_id{ << model.button_input(kind, input) or >> }
if id == model.check_id{ << model.checkbox_input(kind, input) or >> }
if id == model.scroll_id{ << model.scroll_input(kind, input) or >> }
<< widgets.Action{kind: widgets.ACTION_NONE, id: id, needs_paint: false, request_focus: false, consumed: false, value: 0.0}
}
fn (model $&Model) place_button(bounds &layout.Rect) int {
button := $&model.button
<< button.set_bounds(bounds) or >>
}
fn (model $&Model) place_checkbox(bounds &layout.Rect) int {
checkbox := $&model.checkbox
<< checkbox.set_bounds(bounds) or >>
}
fn (model $&Model) place_progress(bounds &layout.Rect) int {
progress := $&model.progress
<< progress.set_bounds(bounds) or >>
}
fn (model $&Model) paint(id int, bounds &layout.Rect, frame $&draw.Frame) bool {
model.draw_node(id, bounds, frame) or(err) {eprintln(err.msg())
<< false}
<< true
}
fn (model $&Model) draw_node(id int, bounds &layout.Rect, frame $&draw.Frame) int {
if id == model.header_id{
demo.text(&model.context, frame, 0.0, 0.0, 14.0, demo.accent(), "07 / IMAGE WORKBENCH") or >>
demo.text(&model.context, frame, 0.0, 28.0, 24.0, demo.ink(), "Image workbench") or >>
demo.text(&model.context, frame, 0.0, 58.0, 13.0, demo.muted(), model.message + "") or >>
} else if id == model.button_id{
model.place_button(bounds) or >>
model.button.paint(frame, &model.button_label, &model.theme) or >>
} else if id == model.check_id{
model.place_checkbox(bounds) or >>
model.checkbox.paint(frame, &model.checkbox_label, &model.theme) or >>
} else if id == model.progress_id{
model.place_progress(bounds) or >>
model.progress.paint(frame, &model.theme) or >>
} else if id == model.scroll_id{
scroll := $&model.scroll
scroll.set_bounds(bounds) or >>
frame.fill_rect(0.0, 0.0, bounds.width, bounds.height, draw.rgb(26, 37, 50)) or >>
} else if model.row_ids.len > 0 && id == model.row_ids[0] {
if model.images.len > 0 {
image := model.images[0]
scale := math.min(bounds.width / f64(image.width), bounds.height / f64(image.height))
frame.image(&image, 0.0, 0.0, f64(image.width) * scale, f64(image.height) * scale) or >>
} else {demo.text(&model.context, frame, 12.0, 20.0, 17.0, demo.muted(), "The selected image appears here.") or >> }
}
<< 0
}
fn (model $&Model) progress_value(value f64) int {
progress := $&model.progress
<< progress.set_value(value) or >>
}
fn (model $&Model) retire_image(index int) int {
$image := model.images[index]
image.dispose() or >>
model.images[index] = image
<< 0
}
fn (model $&Model) replace_image(image draw.Image) int {
for i in 0:model.images.len{model.retire_image(i) or >> }
model.images =[]draw.Image{}
model.images.push(image)
<< 0
}
fn preview_paint(window &ui.Window, path &string) int {
context := draw.window_context(window) or >>
$image := context.load_image(path) or >>
$frame := context.new_frame(256)
frame.begin() or >>
frame.set_bg(demo.background()) or >>
scale := math.min(f64(window.width - 40) / f64(image.width), f64(window.height - 40) / f64(image.height))
frame.image(&image, 20.0, 20.0, f64(image.width) * scale, f64(image.height) * scale) or >>
frame.present() or >>
frame.dispose()
image.dispose() or >>
<< 0
}
fn (model $&Model) acknowledge_button() {
control := $&model.button
control.painted()
}
fn (model $&Model) acknowledge_checkbox() {
control := $&model.checkbox
control.painted()
}
fn (model $&Model) acknowledge_progress() {
control := $&model.progress
control.painted()
}
fn (model $&Model) acknowledge_scroll() {
control := $&model.scroll
control.painted()
}
fn (model $&Model) acknowledge() {
model.acknowledge_button()
model.acknowledge_checkbox()
model.acknowledge_progress()
model.acknowledge_scroll()
}
fn scene(ech chan ui.Event) int {
ready := demo.ready(ech) or >>
if ready.kind == ui.EV_EXIT{ << 0}
identity := ui.canvas_of(&ready) or >>
context := draw.context_of(&ready) or >>
host := widgets.Host{context: context, identity: identity}
$column := layout.box_style(layout.BOX_COLUMN)
column.padding = layout.insets(28.0) or >>
column.gap = 14.0
column.cross_alignment = layout.CROSS_STRETCH
$view := host.view(&column, demo.background()) or >>
leaf := layout.box_style(layout.BOX_LEAF)
header := view.add(view.root(), &leaf, &layout.Size{width: 400.0, height: 88.0}) or >>
button_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 44.0}) or >>
check_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 40.0}) or >>
progress_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 12.0}) or >>
$viewport := layout.box_style(layout.BOX_COLUMN)
viewport.height = 260.0
viewport.clip = true
viewport.cross_alignment = layout.CROSS_STRETCH
viewport.gap = 6.0
scroll_id := view.add(view.root(), &viewport, &layout.Size{width: 400.0, height: 260.0}) or >>
$rows :=[]int {}
for _ in 0:1 {
row := view.add(scroll_id, &leaf, &layout.Size{width: 400.0, height: 250.0}) or >>
rows.push(row)
view.set_boundary(row, true) or >>
}
for id in[header, button_id, check_id, progress_id, scroll_id] {view.set_boundary(id, true) or >> }
for id in[button_id, check_id, scroll_id] {view.set_input(id, true, true) or >> }
empty := layout.Rect{x: 0.0, y: 0.0, width: 0.0, height: 0.0}
options := draw.text_options(15.0)
first := "Open a PNG or JPEG"
second := "Show a separate preview window"
$model := Model{button: widgets.button(&identity, button_id, &empty) or >>,
checkbox: widgets.checkbox(&identity, check_id, &empty, true) or >>,
progress: widgets.progress(&empty, 0.0) or >>,
scroll: widgets.scroll(&identity, scroll_id, &empty, widgets.AXIS_VERTICAL, 250.0) or >>,
button_label: context.layout_text(&first, &options) or >>,
checkbox_label: context.layout_text(&second, &options) or >>,
theme: widgets.default_theme(), context: context, count: 0, message: "Open a local image to begin.", source: "", images:[]draw.Image{}, header_id: header, button_id: button_id, check_id: check_id, progress_id: progress_id, scroll_id: scroll_id, row_ids: rows, identity: identity, pending: ui.Request{id: 0, window_id: 0, canvas_id: 0, generation: 0, kind: 0}}
$width := 900.0
$height := 700.0
$native := demo.windows(ech)
$preview := ui.Window{id: 0, generation: 0, title: "Preview", width: 720, height: 500, content_kind: ui.CONTENT_DRAW, content_backend_id: 0, closed: 1}
dispatcher := register_actions(&model, &view) or >>
while true {
constraints := layout.tight(width, height) or >>
submitted := widgets.present($&view, &constraints, $&model) or >>
if submitted{model.acknowledge()}
event := demo.next(ech)
if event.kind == ui.EV_EXIT{ <- }
if preview.id > 0 && event.window_id == preview.id{
if event.kind == ui.EV_CLOSED || event.kind == ui.EV_WINDOW_FAILED{preview.closed = 1}
if event.kind == ui.EV_CANVAS_READY && model.source.len > 0 {
preview.content_command("input_enabled\t1") or >>
preview.content_command("pan_enabled\t0") or >>
preview_paint(&preview, &model.source) or >> }
if event.kind == ui.EV_CANVAS_METRICS{
metrics := ui.metrics_of(&event) or >>
if metrics.width > 40.0 && metrics.height > 40.0 {preview.width = int(metrics.width)
preview.height = int(metrics.height)
if model.source.len > 0 {preview_paint(&preview, &model.source) or >> }}
}
->
}
if event.window_id != identity.window_id{ -> }
if event.kind == ui.EV_REQUEST{
result := ui.request_of(&event) or >>
if result.matches(&model.pending) {
model.pending.id = 0
model.message = "Selection cancelled or failed."
if result.status == ui.REQUEST_COMPLETED{
paths := ui.file_paths(&result) or >>
if paths.len > 0 {
path := paths[0] + ""
image := context.load_image(&path) or(err) {model.message = err.msg()
view.mark_paint(header) or >>
-> }
model.replace_image(image) or >>
model.source = path + ""
model.message = "Loaded " + str(image.width) + " x " + str(image.height) + " pixels"
println(model.message + "")
model.progress_value(1.0) or >>
view.mark_paint(model.row_ids[0]) or >>
if model.checkbox.value() {
if preview.closed != 0 {preview = native.open_content_window(ui.WindowOpts{title: "Xu UI / Image Preview", width: 720, height: 500}, ui.CONTENT_DRAW) or >> }
else {preview_paint(&preview, &path) or >>
preview.focus() or >> }
}
}
}
view.mark_paint(header) or >>
view.mark_paint(progress_id) or >>
}
}
if event.kind == ui.EV_CANVAS_METRICS{
metrics := ui.metrics_of(&event) or >>
if metrics.width > 0.0 && metrics.height > 0.0 {width = metrics.width
height = metrics.height}
}
actions := widgets.dispatch_event($&view, &event, $&model) or >>
for action in actions{_ := dispatcher.dispatch(&action, $&model, $&view) or >> }
if event.kind == ui.EV_CANVAS_CLOSED{demo.quit() or >>
<- }
if ui.is_input_event(event.kind) {
input := ui.input_of(&event) or >>
if input.kind == ui.EV_KEY_DOWN && input.key == ui.KEY_ESCAPE{demo.quit() or >> }
}
stats := view.stats()
if stats.recorded_boundaries > 0 || stats.reused_boundaries > 0 {
println("View: " + str(stats.recorded_boundaries) + " recorded / " + str(stats.reused_boundaries) + " reused boundaries")
}
}
if model.pending.id > 0 {_ := model.pending.cancel()}
view.dispose()
// Native close has already revoked this canvas's images and text layouts.
if demo.alive(&identity) {
for i in 0:model.images.len{model.retire_image(i) or >> }
label := $&model.button_label
label.dispose() or >>
check_label := $&model.checkbox_label
check_label.dispose() or >>
}
<< 0
}
fn worker(ech chan ui.Event) {scene(ech) or(err) {demo.fail(err.msg())
<< }}
fn launch() int {
$app := demo.app("Xu UI / Retained Image Workbench", 900, 700) or >>
xu worker(app.event_ch)
<< app.run() or >>
}
fn main() int { << launch() or(err) {eprintln(err.msg())
<< 1}}@main
#ui
#ui/widgets
fn open_image(m $&Model, screen $&widgets.View, action &widgets.Action) string {
if m.pending.id != 0 { << ""}
$options := ui.file_dialog_options()
options.title = "Open an image"
options.filters =[ui.FileFilter{label: "Images", extensions:["png", "jpg", "jpeg"]}]
m.pending = ui.open_files_async(&m.identity, &options) or(err) { << err.msg()}
m.message = "Choose a PNG or JPEG in the native dialog."
m.progress_value(0.2) or(err) { << err.msg()}
screen.mark_paint(m.header_id) or(err) { << err.msg()}
screen.mark_paint(m.progress_id) or(err) { << err.msg()}
<< ""
}
fn scroll(m $&Model, screen $&widgets.View, action &widgets.Action) string {
screen.set_scroll(m.scroll_id, 0.0, action.value) or(err) { << err.msg()}
<< ""
}
fn register_actions(m &Model, screen &widgets.View) widgets.ActionDispatcher#Model, widgets.View, widgets.Action{
$d := widgets.action_dispatcher(m, screen)
d.on(m.button_id, widgets.ACTION_ACTIVATE, open_image) or >>
d.on(m.scroll_id, widgets.ACTION_SCROLL, scroll) or >>
<< d
}16_ui_webview/style_gallery/main.xu@main
#ui
#ui/draw
#ui/widgets
#ui/layout
#time
demo #"github.com/xulang-org/examples/ui_demo"
// IDs follow the stable topology created below. All control bounds are local;
// Editor.place receives the separate canvas rectangle for native IME geometry.
struct Model{
theme widgets.Button
scale widgets.Button
density widgets.Button
brand widgets.Button
disabled widgets.Button
check widgets.Checkbox
toggle widgets.Switch
radio_a widgets.Radio
radio_b widgets.Radio
slider widgets.Slider
stepper widgets.Stepper
tabs widgets.Tabs
select_ctrl widgets.Select
select_origin layout.Rect
select_popup_armed bool
transitions []widgets.PaintTransition
switch_motion widgets.Tween
popup_motion widgets.Tween
clock time.Instant
reduced_motion bool
theme_index int
text_scale f64
density_scale f64
appearance_dirty bool
badge widgets.Badge
divider widgets.Divider
card widgets.Card
list widgets.ListBox
input widgets.Editor
invalid widgets.Editor
read_only widgets.Editor
area widgets.Editor
progress widgets.Progress
scroll widgets.Scroll
context draw.Context
icon draw.Image
switcher widgets.StyleSwitcher
theme_label widgets.StyledLabel
scale_label widgets.StyledLabel
density_label widgets.StyledLabel
brand_label widgets.StyledLabel
disabled_label widgets.StyledLabel
check_label widgets.StyledLabel
toggle_label widgets.StyledLabel
radio_a_label widgets.StyledLabel
radio_b_label widgets.StyledLabel
stepper_label widgets.StyledLabel
badge_label widgets.StyledLabel
divider_label widgets.StyledLabel
card_label widgets.StyledLabel
tab_label widgets.StyledLabel
tab_2_label widgets.StyledLabel
tab_3_label widgets.StyledLabel
select_label widgets.StyledLabel
option_auto widgets.StyledLabel
option_manual widgets.StyledLabel
option_locked widgets.StyledLabel
list_label widgets.StyledLabel
list_2_label widgets.StyledLabel
list_3_label widgets.StyledLabel
list_4_label widgets.StyledLabel
}
fn (m $&Model) motion_style(id int, base &widgets.ControlStyle, state int) widgets.ControlStyle{
now := m.clock
reduced := m.reduced_motion
motion := $&m.transitions[id]
<< motion.style(base, state, now, reduced) or >>
}
fn (m $&Model) tick(view $&widgets.View, now time.Instant) int {
m.clock = now
reduced := m.reduced_motion
for id in 1:m.transitions.len{
motion := $&m.transitions[id]
if reduced && motion.is_animating() {motion.finish()
view.mark_paint(id) or >> }
else if motion.advance(now) or >> {view.mark_paint(id) or >> }
}
$selected := 0.0
if m.toggle.value() {selected = 1.0}
switch_motion := $&m.switch_motion
before_switch := switch_motion.value()
switch_motion.retarget(selected, now, time.milliseconds(180) or >>, reduced) or >>
if before_switch != switch_motion.value() {view.mark_paint(32) or >> }
$opened := 0.0
if m.select_ctrl.is_open() {opened = 1.0}
popup_motion := $&m.popup_motion
before_popup := popup_motion.value()
$popup_duration := time.milliseconds(130) or >>
if opened == 0.0 {popup_duration = time.milliseconds(95) or >> }
popup_motion.retarget(opened, now, popup_duration, reduced) or >>
if before_popup != popup_motion.value() {view.mark_paint(1) or >> }
input := $&m.input
if input.tick(now, reduced) or >> {view.mark_paint(12) or >> }
invalid := $&m.invalid
if invalid.tick(now, reduced) or >> {view.mark_paint(13) or >> }
read_only := $&m.read_only
if read_only.tick(now, reduced) or >> {view.mark_paint(14) or >> }
area := $&m.area
if area.tick(now, reduced) or >> {view.mark_paint(15) or >> }
<< 0
}
fn (m &Model) next_frame(now time.Instant) time.Instant{
if m.switch_motion.is_animating() || m.popup_motion.is_animating() { << now.add(time.milliseconds(16) or >>) or >> }
for motion in m.transitions{if motion.is_animating() { << now.add(time.milliseconds(16) or >>) or >> }}
$deadline := time.zero_instant()
for next in[m.input.next_caret_tick(now, m.reduced_motion) or >>, m.invalid.next_caret_tick(now, m.reduced_motion) or >>,
m.read_only.next_caret_tick(now, m.reduced_motion) or >>, m.area.next_caret_tick(now, m.reduced_motion) or >>] {
if !next.is_zero() &&(deadline.is_zero() || next.before(deadline)) {deadline = next}
}
<< deadline
}
fn (m &Model) next_event(ech chan ui.Event) ui.Event{
deadline := m.next_frame(time.instant()) or >>
while true {
event := ui.poll_chan(ech)
if event.kind != ui.EV_NONE{ << event}
if !deadline.is_zero() && !time.instant().before(deadline) { << event}
pause := time.milliseconds(8) or >>
pause.sleep()
}
<< ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
}
fn (m $&Model) measure_node(id int, s &widgets.Styles) layout.Size{
if id == 4 {control := m.theme.clone()
label := $&m.theme_label
<< control.measure_styled(label, s) or >> }
if id == 5 {control := m.scale.clone()
label := $&m.scale_label
<< control.measure_styled(label, s) or >> }
if id == 6 {control := m.density.clone()
label := $&m.density_label
<< control.measure_styled(label, s) or >> }
if id == 8 {control := m.brand.clone()
label := $&m.brand_label
<< control.measure_icon_styled(label, s) or >> }
if id == 9 {control := m.disabled.clone()
label := $&m.disabled_label
<< control.measure_styled(label, s) or >> }
if id == 10 {control := m.check.clone()
label := $&m.check_label
<< control.measure_styled(label, s) or >> }
if id == 11 {control := m.progress.clone()
<< control.measure_styled(s) or >> }
if id == 12 {control := $&m.input
<< control.measure_styled(s) or >> }
if id == 13 {control := $&m.invalid
<< control.measure_styled(s) or >> }
if id == 14 {control := $&m.read_only
<< control.measure_styled(s) or >> }
if id == 15 {control := $&m.area
<< control.measure_styled(s) or >> }
if id == 32 {control := m.toggle.clone()
label := $&m.toggle_label
<< control.measure_styled(label, s) or >> }
if id == 33 {control := m.radio_a.clone()
label := $&m.radio_a_label
<< control.measure_styled(label, s) or >> }
if id == 34 {control := m.radio_b.clone()
label := $&m.radio_b_label
<< control.measure_styled(label, s) or >> }
if id == 35 {control := m.slider.clone()
<< control.measure_styled(s) or >> }
if id == 36 {control := m.stepper.clone()
label := $&m.stepper_label
<< control.measure_styled(label, s) or >> }
if id == 37 {control := m.badge.clone()
label := $&m.badge_label
<< control.measure_styled(label, s) or >> }
if id == 38 {control := m.divider.clone()
label := $&m.divider_label
<< control.measure_labeled_styled(label, s) or >> }
if id == 40 {control := m.tabs.clone()
label := $&m.tab_label
<< control.measure_styled(label, s) or >> }
if id == 41 {control := m.select_ctrl.clone()
label := $&m.select_label
<< control.measure_styled(label, s) or >> }
if id == 42 {control := m.card.clone()
label := $&m.card_label
<< control.measure_header_styled(label, s) or >> }
if id == 43 {control := m.list.clone()
label := $&m.list_label
<< control.measure_styled(label, s) or >> }
<< layout.Size{width: 0.0, height: 0.0}
}
fn (m $&Model) measure_styled(id int, s &widgets.Styles) layout.Size{
<< m.measure_node(id, s) or(err) {eprintln(err.msg())
<< layout.Size{width: - 1.0, height: - 1.0}}
}
fn (m $&Model) draw_node(id int, b &layout.Rect, s &widgets.Styles, f $&draw.Frame) int {
if id == 4 {target := $&m.theme
target.set_bounds(b) or >>
$control := m.theme.clone()
base := control.style_or(s)
appearance := m.motion_style(4, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.theme_label
control.paint_styled(f, label, s) or >> }
if id == 5 {target := $&m.scale
target.set_bounds(b) or >>
$control := m.scale.clone()
base := control.style_or(s)
appearance := m.motion_style(5, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.scale_label
control.paint_styled(f, label, s) or >> }
if id == 6 {target := $&m.density
target.set_bounds(b) or >>
$control := m.density.clone()
base := control.style_or(s)
appearance := m.motion_style(6, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.density_label
control.paint_styled(f, label, s) or >> }
if id == 8 {target := $&m.brand
target.set_bounds(b) or >>
$control := m.brand.clone()
base := control.style_or(s)
appearance := m.motion_style(8, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
icon := m.icon
label := $&m.brand_label
control.paint_icon_styled(f, label, &icon, s) or >> }
if id == 9 {target := $&m.disabled
target.set_bounds(b) or >>
$control := m.disabled.clone()
base := control.style_or(s)
appearance := m.motion_style(9, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.disabled_label
control.paint_styled(f, label, s) or >> }
if id == 10 {target := $&m.check
target.set_bounds(b) or >>
$control := m.check.clone()
base := control.style_or(s)
appearance := m.motion_style(10, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.check_label
control.paint_styled(f, label, s) or >> }
if id == 12 {
now := m.clock
reduced := m.reduced_motion
$motion := m.transitions[12]
control := $&m.input
control.paint_motion_styled(f, s, $&motion, now, reduced) or >>
m.transitions[12] = motion}
if id == 13 {
now := m.clock
reduced := m.reduced_motion
$motion := m.transitions[13]
control := $&m.invalid
control.paint_motion_styled(f, s, $&motion, now, reduced) or >>
m.transitions[13] = motion}
if id == 14 {
now := m.clock
reduced := m.reduced_motion
$motion := m.transitions[14]
control := $&m.read_only
control.paint_motion_styled(f, s, $&motion, now, reduced) or >>
m.transitions[14] = motion}
if id == 15 {
now := m.clock
reduced := m.reduced_motion
$motion := m.transitions[15]
control := $&m.area
control.paint_motion_styled(f, s, $&motion, now, reduced) or >>
m.transitions[15] = motion}
if id == 11 {control := $&m.progress
control.set_bounds(b) or >>
control.paint_styled(f, s) or >> }
if id == 32 {target := $&m.toggle
target.set_bounds(b) or >>
$control := m.toggle.clone()
base := control.style_or(s)
appearance := m.motion_style(32, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
position := m.switch_motion.value()
label := $&m.toggle_label
control.paint_position_styled(f, label, s, position) or >> }
if id == 33 {target := $&m.radio_a
target.set_bounds(b) or >>
$control := m.radio_a.clone()
base := control.style_or(s)
appearance := m.motion_style(33, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.radio_a_label
control.paint_styled(f, label, s) or >> }
if id == 34 {target := $&m.radio_b
target.set_bounds(b) or >>
$control := m.radio_b.clone()
base := control.style_or(s)
appearance := m.motion_style(34, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.radio_b_label
control.paint_styled(f, label, s) or >> }
if id == 35 {target := $&m.slider
target.set_bounds(b) or >>
$control := m.slider.clone()
base := control.style_or(s)
appearance := m.motion_style(35, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
control.paint_styled(f, s) or >> }
if id == 36 {target := $&m.stepper
target.set_bounds(b) or >>
$control := m.stepper.clone()
base := control.style_or(s)
appearance := m.motion_style(36, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.stepper_label
control.paint_styled(f, label, s) or >> }
if id == 37 {target := $&m.badge
target.set_bounds(b) or >>
control := m.badge.clone()
label := $&m.badge_label
control.paint_styled(f, label, s) or >> }
if id == 38 {target := $&m.divider
target.set_bounds(b) or >>
control := m.divider.clone()
label := $&m.divider_label
control.paint_labeled_styled(f, label, s) or >> }
if id == 40 {target := $&m.tabs
target.set_bounds(b) or >>
control := m.tabs.clone()
control.paint_box_styled(f, s) or >>
l0 := $&m.tab_label
control.paint_tab_styled(f, 0, l0, s) or >>
l1 := $&m.tab_2_label
control.paint_tab_styled(f, 1, l1, s) or >>
l2 := $&m.tab_3_label
control.paint_tab_styled(f, 2, l2, s) or >> }
if id == 41 {target := $&m.select_ctrl
target.set_bounds(b) or >>
$control := m.select_ctrl.clone()
base := control.style_or(s)
appearance := m.motion_style(41, &base, control.visual_state()) or >>
control.set_style(&appearance) or >>
label := $&m.select_label
control.paint_styled(f, label, s) or >> }
if id == 42 {target := $&m.card
target.set_bounds(b) or >>
control := m.card.clone()
label := $&m.card_label
control.paint_header_styled(f, label, s) or >>
demo.text(&m.context, f, 14.0 * s.density, 42.0 * s.density, 11.0 * s.text_scale, s.button.palette.muted, "Card body") or >> }
if id == 43 {target := $&m.list
target.set_bounds(b) or >>
control := m.list.clone()
control.paint_box_styled(f, s) or >>
r0 := $&m.list_label
control.paint_item_styled(f, 0, r0, s) or >>
r1 := $&m.list_2_label
control.paint_item_styled(f, 1, r1, s) or >>
r2 := $&m.list_3_label
control.paint_item_styled(f, 2, r2, s) or >>
r3 := $&m.list_4_label
control.paint_item_styled(f, 3, r3, s) or >> }
if id == 2 {
demo.text(&m.context, f, 0.0, 0.0, 24.0, s.button.palette.foreground, "A theme that reaches every control") or >>
demo.text(&m.context, f, 0.0, 33.0, 13.0, s.button.palette.muted, "Light / dark / contrast · typography · density · local overrides · no idle redraw") or >>
}
if id >= 18 && id <= 29 {
f.fill_rect(0.0, 0.0, b.width, b.height, s.input.palette.normal) or >>
demo.text(&m.context, f, 12.0, 5.0, 14.0, s.input.palette.foreground, "Scrollable item " + str(id - 17) + " — wheel, drag the thumb, or Page Down") or >>
}
if id == 30 {
demo.text(&m.context, f, 0.0, 0.0, 12.0, s.button.palette.muted, "The green button keeps its own font and palette. Error and read-only fields are distinct states.") or >>
demo.text(&m.context, f, 0.0, 21.0, 12.0, s.button.palette.muted, "Tab / Shift+Tab to move focus · copy from read-only text · Escape to quit") or >>
}
<< 0
}
fn (m $&Model) paint_styled(id int, b &layout.Rect, s &widgets.Styles, f $&draw.Frame) bool {
m.draw_node(id, b, s, f) or(err) {eprintln(err.msg())
<< false}
<< true
}
fn (m $&Model) overlay_styled(id int, b &layout.Rect, s &widgets.Styles, f $&draw.Frame) bool {
if id == 16 {control := $&m.scroll
control.paint_scrollbar(f, s) or(err) {eprintln(err.msg())
<< false}}
if id == 1 &&(m.select_ctrl.is_open() || m.popup_motion.value() > 0.0) {
m.paint_select_popup(s, f) or(err) {eprintln(err.msg())
<< false}
}
<< true
}
// Root overlay keeps the popup above every sibling and outside the button's box.
fn (m $&Model) paint_select_popup(s &widgets.Styles, f $&draw.Frame) int {
$control := m.select_ctrl.clone()
control.set_open(true)
opacity := m.popup_motion.value()
if opacity <= 0.0 { << 0}
base := control.style_or(s)
appearance := base.with_opacity(opacity) or >>
control.set_style(&appearance) or >>
popup := control.popup_bounds(s)
$offset := - 4.0 *(1.0 - opacity)
if popup.y < 0.0 {offset = 4.0 *(1.0 - opacity)}
f.push() or >>
f.translate(m.select_origin.x, m.select_origin.y + offset) or >>
control.paint_popup_box_styled(f, s) or >>
auto_label := $&m.option_auto
control.paint_option_styled(f, 0, auto_label, s) or >>
manual_label := $&m.option_manual
control.paint_option_styled(f, 1, manual_label, s) or >>
locked_label := $&m.option_locked
control.paint_option_styled(f, 2, locked_label, s) or >>
f.pop() or >>
<< 0
}
// The popup is an overlay, so route its pointer sequence before normal tree hits.
fn (m $&Model) dispatch_input(view $&widgets.View, event &ui.InputEvent)[]widgets.Action{
was_open := m.select_ctrl.is_open()
pointer := event.kind == ui.EV_POINTER_DOWN || event.kind == ui.EV_POINTER_UP ||
event.kind == ui.EV_POINTER_MOVE || event.kind == ui.EV_POINTER_SCROLL
if pointer &&(was_open || m.select_popup_armed) {
local := view.local_input(41, event) or >>
styles := view.styles_for(41) or >>
pop := m.select_ctrl.popup_bounds(&styles)
if pop.contains(local.x, local.y) || m.select_popup_armed{
if event.kind == ui.EV_POINTER_DOWN && event.button == ui.BUTTON_LEFT{m.select_popup_armed = true}
control := $&m.select_ctrl
action := control.input(&local) or >>
view.set_pointer_cursor(ui.CURSOR_HAND) or >>
if event.kind == ui.EV_POINTER_UP{m.select_popup_armed = false}
view.mark_paint(41) or >>
view.mark_paint(1) or >>
<<[action]
}
}
if event.kind == ui.EV_POINTER_CANCEL{m.select_popup_armed = false}
actions := widgets.dispatch(view, event, m) or >>
if was_open || m.select_ctrl.is_open() {view.mark_paint(1) or >> }
<< actions
}
fn (m $&Model) dispatch_event(view $&widgets.View, event &ui.Event)[]widgets.Action{
if ui.is_input_event(event.kind) {
input := ui.input_of(event) or >>
<< m.dispatch_input(view, &input) or >>
}
was_open := m.select_ctrl.is_open()
actions := widgets.dispatch_event(view, event, m) or >>
m.select_popup_armed = false
if was_open && !m.select_ctrl.is_open() {view.mark_paint(1) or >> }
<< actions
}
fn (m $&Model) input(id int, kind int, event &ui.InputEvent) widgets.Action{
if id == 4 {control := $&m.theme
<< control.route(kind, event) or >> }
if id == 5 {control := $&m.scale
<< control.route(kind, event) or >> }
if id == 6 {control := $&m.density
<< control.route(kind, event) or >> }
if id == 8 {control := $&m.brand
<< control.route(kind, event) or >> }
if id == 9 {control := $&m.disabled
<< control.route(kind, event) or >> }
if id == 10 {control := $&m.check
<< control.route(kind, event) or >> }
if id == 12 {control := $&m.input
<< control.route(kind, event) or >> }
if id == 13 {control := $&m.invalid
<< control.route(kind, event) or >> }
if id == 14 {control := $&m.read_only
<< control.route(kind, event) or >> }
if id == 15 {control := $&m.area
<< control.route(kind, event) or >> }
if id == 16 {control := $&m.scroll
<< control.route(kind, event) or >> }
if id == 32 {control := $&m.toggle
<< control.route(kind, event) or >> }
if id == 33 {control := $&m.radio_a
<< control.route(kind, event) or >> }
if id == 34 {control := $&m.radio_b
<< control.route(kind, event) or >> }
if id == 35 {control := $&m.slider
<< control.route(kind, event) or >> }
if id == 36 {control := $&m.stepper
<< control.route(kind, event) or >> }
if id == 40 {control := $&m.tabs
<< control.route(kind, event) or >> }
if id == 41 {control := $&m.select_ctrl
<< control.route(kind, event) or >> }
if id == 43 {control := $&m.list
<< control.route(kind, event) or >> }
<< widgets.Action{kind: 0, id: id, needs_paint: false, request_focus: false, consumed: false, value: 0.0}
}
fn (m $&Model) place(view $&widgets.View) int {
select_bounds := view.node_bounds(41) or >>
m.select_origin = select_bounds
select_styles := view.styles_for(41) or >>
select_control := $&m.select_ctrl
select_control.set_bounds(&layout.Rect{x: 0.0, y: 0.0, width: select_bounds.width, height: select_bounds.height}) or >>
select_control.apply_styles(&select_styles) or >>
popup := select_control.popup_bounds(&select_styles)
window_bounds := view.node_bounds(1) or >>
below := window_bounds.y + window_bounds.height - select_bounds.y - select_bounds.height
above := select_bounds.y - window_bounds.y
select_control.set_popup_above(below < popup.height + 2.0 * select_styles.density && above > below)
list_bounds := view.node_bounds(43) or >>
list_styles := view.styles_for(43) or >>
list_control := $&m.list
list_control.set_bounds(&layout.Rect{x: 0.0, y: 0.0, width: list_bounds.width, height: list_bounds.height}) or >>
list_control.apply_styles(&list_styles) or >>
input := $&m.input
widgets.place_editor(view, input) or >>
invalid := $&m.invalid
widgets.place_editor(view, invalid) or >>
read_only := $&m.read_only
widgets.place_editor(view, read_only) or >>
area := $&m.area
widgets.place_editor(view, area) or >>
bounds := view.node_bounds(16) or >>
styles := view.styles_for(16) or >>
control := $&m.scroll
control.set_bounds(&layout.Rect{x: 0.0, y: 0.0, width: bounds.width, height: bounds.height}) or >>
control.apply_styles(&styles) or >>
view.set_scroll(16, 0.0, control.offset()) or >>
<< 0
}
fn (m $&Model) native_event(view $&widgets.View, event &ui.Event) int {
input := $&m.input
action_12 := input.event(event) or >>
if action_12.needs_paint{view.mark_paint(12) or >> }
invalid := $&m.invalid
action_13 := invalid.event(event) or >>
if action_13.needs_paint{view.mark_paint(13) or >> }
read_only := $&m.read_only
action_14 := read_only.event(event) or >>
if action_14.needs_paint{view.mark_paint(14) or >> }
area := $&m.area
action_15 := area.event(event) or >>
if action_15.needs_paint{view.mark_paint(15) or >> }
<< 0
}
fn (m $&Model) acknowledge() {
theme := $&m.theme
theme.painted()
scale := $&m.scale
scale.painted()
density := $&m.density
density.painted()
brand := $&m.brand
brand.painted()
disabled := $&m.disabled
disabled.painted()
check := $&m.check
check.painted()
input := $&m.input
input.painted()
invalid := $&m.invalid
invalid.painted()
read_only := $&m.read_only
read_only.painted()
area := $&m.area
area.painted()
progress := $&m.progress
progress.painted()
scroll := $&m.scroll
scroll.painted()
toggle := $&m.toggle
toggle.painted()
radio_a := $&m.radio_a
radio_a.painted()
radio_b := $&m.radio_b
radio_b.painted()
slider := $&m.slider
slider.painted()
stepper := $&m.stepper
stepper.painted()
tabs := $&m.tabs
tabs.painted()
select_ctrl := $&m.select_ctrl
select_ctrl.painted()
badge := $&m.badge
badge.painted()
divider := $&m.divider
divider.painted()
card := $&m.card
card.painted()
list := $&m.list
list.painted()
}
fn (m $&Model) cleanup() {
icon := $&m.icon
icon.dispose() or(err) {eprintln(err.msg())
<< }
theme_label := $&m.theme_label
theme_label.dispose()
scale_label := $&m.scale_label
scale_label.dispose()
density_label := $&m.density_label
density_label.dispose()
brand_label := $&m.brand_label
brand_label.dispose()
disabled_label := $&m.disabled_label
disabled_label.dispose()
check_label := $&m.check_label
check_label.dispose()
toggle_label := $&m.toggle_label
toggle_label.dispose()
radio_a_label := $&m.radio_a_label
radio_a_label.dispose()
radio_b_label := $&m.radio_b_label
radio_b_label.dispose()
stepper_label := $&m.stepper_label
stepper_label.dispose()
badge_label := $&m.badge_label
badge_label.dispose()
divider_label := $&m.divider_label
divider_label.dispose()
card_label := $&m.card_label
card_label.dispose()
tab_label := $&m.tab_label
tab_label.dispose()
tab_2_label := $&m.tab_2_label
tab_2_label.dispose()
tab_3_label := $&m.tab_3_label
tab_3_label.dispose()
select_label := $&m.select_label
select_label.dispose()
option_auto := $&m.option_auto
option_auto.dispose()
option_manual := $&m.option_manual
option_manual.dispose()
option_locked := $&m.option_locked
option_locked.dispose()
list_label := $&m.list_label
list_label.dispose()
list_2_label := $&m.list_2_label
list_2_label.dispose()
list_3_label := $&m.list_3_label
list_3_label.dispose()
list_4_label := $&m.list_4_label
list_4_label.dispose()
input := $&m.input
input.dispose()
invalid := $&m.invalid
invalid.dispose()
read_only := $&m.read_only
read_only.dispose()
area := $&m.area
area.dispose()
}
fn leaf(view $&widgets.View, parent int, width f64, height f64) int {
style := layout.box_style(layout.BOX_LEAF)
<< view.add(parent, &style, &layout.Size{width: width, height: height}) or >>
}
fn brand_scope(view $&widgets.View) int {
$brand := widgets.light_styles()
brand.button.palette.normal = draw.rgb(10, 91, 69)
brand.button.palette.hovered = draw.rgb(17, 120, 90)
brand.button.palette.pressed = draw.rgb(7, 65, 49)
brand.button.palette.foreground = draw.rgb(255, 255, 255)
brand.button.font.size = 17.0
brand.button.font.weight = 600
brand.button.inherit_font = false
brand.button.radius = 18.0
brand.button.icon_size = 22.0
brand.button.icon_placement = widgets.ICON_TRAILING
$hover := widgets.state_paint(widgets.STATE_HOVERED)
hover.unless = widgets.STATE_DISABLED
hover.fields = widgets.PAINT_FOREGROUND | widgets.PAINT_BORDER
hover.foreground = draw.rgb(209, 250, 229)
hover.border = draw.rgb(110, 231, 183)
brand.button.states =[hover]
brand.button.shadow = draw.rgba(0, 0, 0, 28)
brand.button.shadow_y = 2.0
brand.button.shadow_blur = 6.0
view.set_style_scope(8, &brand) or >>
<< 0
}
fn scene(ech chan ui.Event) int {
ready := demo.ready(ech) or >>
if ready.kind == ui.EV_EXIT{ << 0}
identity := ui.canvas_of(&ready) or >>
context := draw.context_of(&ready) or >>
host := widgets.Host{context: context, identity: identity}
$column := layout.box_style(layout.BOX_COLUMN)
column.padding = layout.insets(22.0) or >>
column.gap = 10.0
column.cross_alignment = layout.CROSS_STRETCH
$view := host.view(&column, draw.rgb(20, 25, 34)) or >>
_ := leaf($&view, 1, 400.0, 56.0) or >> // 2 header
$row := layout.box_style(layout.BOX_ROW)
row.gap = 12.0
row.cross_alignment = layout.CROSS_CENTER
_ := view.add(1, &row, &layout.Size{width: 0.0, height: 0.0}) or >> // 3 toolbar
for i in 0:3 {_ := leaf($&view, 3, 0.0, 0.0) or >> } // 4..6
_ := view.add(1, &row, &layout.Size{width: 0.0, height: 0.0}) or >> // 7 controls
for i in 0:3 {_ := leaf($&view, 7, 0.0, 0.0) or >> } // 8..10
_ := leaf($&view, 1, 300.0, 12.0) or >> // 11 progress
for i in 0:4 {_ := leaf($&view, 1, 300.0, 0.0) or >> } // 12..15 editors
$viewport := layout.box_style(layout.BOX_COLUMN)
viewport.height = 84.0
viewport.clip = true
viewport.cross_alignment = layout.CROSS_STRETCH
_ := view.add(1, &viewport, &layout.Size{width: 0.0, height: 0.0}) or >> // 16 scroll
$items := layout.box_style(layout.BOX_COLUMN)
items.gap = 6.0
items.cross_alignment = layout.CROSS_STRETCH
_ := view.add(16, &items, &layout.Size{width: 0.0, height: 0.0}) or >> // 17 items
for i in 0:12 {_ := leaf($&view, 17, 300.0, 28.0) or >> } // 18..29
_ := leaf($&view, 1, 400.0, 42.0) or >> // 30 footer
_ := view.add(1, &row, &layout.Size{width: 0.0, height: 0.0}) or >> // 31 extended controls row 1
for i in 0:6 {_ := leaf($&view, 31, 0.0, 0.0) or >> } // 32..37: switch, radio_a, radio_b, slider, stepper, badge
_ := leaf($&view, 1, 300.0, 0.0) or >> // 38 labeled divider
_ := view.add(1, &row, &layout.Size{width: 0.0, height: 0.0}) or >> // 39 extended controls row 2
for i in 0:4 {_ := leaf($&view, 39, 0.0, 0.0) or >> } // 40..43: tabs, select, card, list_box
for id in[2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 30, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43] {view.set_boundary(id, true) or >> }
for id in[4, 5, 6, 8, 10, 12, 13, 14, 15, 16, 32, 33, 34, 35, 36, 40, 41, 43] {view.set_input(id, true, true) or >> }
view.set_capture_outside(16, true) or >>
view.set_capture_outside(35, true) or >>
for id in[4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43] {view.set_style_measure(id, true) or >> }
empty := layout.Rect{x: 0.0, y: 0.0, width: 0.0, height: 0.0}
$m := Model{theme: widgets.button(&identity, 4, &empty) or >>, scale: widgets.button(&identity, 5, &empty) or >>,
density: widgets.button(&identity, 6, &empty) or >>, brand: widgets.button(&identity, 8, &empty) or >>,
disabled: widgets.button(&identity, 9, &empty) or >>, check: widgets.checkbox(&identity, 10, &empty, true) or >>,
toggle: widgets.switch_control(&identity, 32, &empty, true) or >>,
radio_a: widgets.radio(&identity, 33, &empty, 0, true) or >>,
radio_b: widgets.radio(&identity, 34, &empty, 1, false) or >>,
slider: widgets.slider(&identity, 35, &empty, 0.0, 100.0, 64.0) or >>,
stepper: widgets.stepper(&identity, 36, &empty, 0.0, 100.0, 5.0, 65.0) or >>,
tabs: widgets.tabs(&identity, 40, &empty, 3, 0) or >>,
select_ctrl: widgets.select_box(&identity, 41, &empty, 3, 0) or >>,
select_origin: empty, select_popup_armed: false,
transitions:[]widgets.PaintTransition{}, switch_motion: widgets.tween(1.0) or >>, popup_motion: widgets.tween(0.0) or >>,
clock: time.zero_instant(), reduced_motion: false, theme_index: 0, text_scale: 1.0, density_scale: 1.0, appearance_dirty: true,
badge: widgets.badge(&empty) or >>,
divider: widgets.divider(&empty, widgets.AXIS_HORIZONTAL) or >>,
card: widgets.card(&empty) or >>,
list: widgets.list_box(&identity, 43, &empty, 4, 0) or >>,
input: widgets.input(&context, &identity, 12, &empty, &"Editable input · 你好 Xu") or >>,
invalid: widgets.input(&context, &identity, 13, &empty, &"Invalid value — custom error colors") or >>,
read_only: widgets.input(&context, &identity, 14, &empty, &"Read-only · select and copy, edits are ignored") or >>,
area: widgets.text_area(&context, &identity, 15, &empty, &"TextArea uses the same font, padding and selection theme.\nIME, preedit and caret geometry follow typography changes.") or >>,
progress: widgets.progress(&empty, 0.64) or >>, scroll: widgets.scroll(&identity, 16, &empty, widgets.AXIS_VERTICAL, 402.0) or >>,
context: context, icon: context.load_embedded_image(&"logo.png") or >>, switcher: widgets.style_switcher(),
theme_label: widgets.styled_label(&context, &"Theme: dark / light / contrast"),
scale_label: widgets.styled_label(&context, &"Text: 100% / 140%"),
density_label: widgets.styled_label(&context, &"Density: normal / compact"),
brand_label: widgets.styled_label(&context, &"Local green"),
disabled_label: widgets.styled_label(&context, &"Disabled"),
check_label: widgets.styled_label(&context, &"Checkbox"),
toggle_label: widgets.styled_label(&context, &"Switch"),
radio_a_label: widgets.styled_label(&context, &"Radio A"),
radio_b_label: widgets.styled_label(&context, &"Radio B"),
stepper_label: widgets.styled_label(&context, &"65"),
badge_label: widgets.styled_label(&context, &"Active"),
divider_label: widgets.styled_label(&context, &"Navigation & Data Components"),
card_label: widgets.styled_label(&context, &"Card Panel"),
tab_label: widgets.styled_label(&context, &"Overview"),
tab_2_label: widgets.styled_label(&context, &"Tokens"),
tab_3_label: widgets.styled_label(&context, &"Themes"),
select_label: widgets.styled_label(&context, &"Option: Auto"),
option_auto: widgets.styled_label(&context, &"Auto"),
option_manual: widgets.styled_label(&context, &"Manual"),
option_locked: widgets.styled_label(&context, &"Locked"),
list_label: widgets.styled_label(&context, &"1 · Buttons"),
list_2_label: widgets.styled_label(&context, &"2 · Editors"),
list_3_label: widgets.styled_label(&context, &"3 · Surfaces"),
list_4_label: widgets.styled_label(&context, &"4 · Controls")}
for i in 0:44 {m.transitions.push(widgets.paint_transition() or >>)}
for id in[4, 5, 6, 8, 10, 32, 33, 34, 36, 40, 41, 43] {view.set_cursor(id, ui.CURSOR_HAND) or >> }
for id in[12, 13, 14, 15] {view.set_cursor(id, ui.CURSOR_TEXT) or >> }
view.set_cursor(35, ui.CURSOR_RESIZE_HORIZONTAL) or >>
badge_ref := $&m.badge
badge_ref.set_selected(true)
disabled := $&m.disabled
disabled.set_enabled(false)
invalid := $&m.invalid
invalid.set_invalid(true)
read_only := $&m.read_only
read_only.set_read_only(true) or >>
apply_appearance($&m, $&view) or >>
brand_scope($&view) or >>
dispatcher := register_actions(&m, &view) or >>
$width := 960.0
$height := 820.0
$event := ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
// Drain input bursts before painting. Native text snapshots already hold
// the latest revision; rendering each queued key would fill the frame queue.
ui.request_canvas_preferences(&identity) or >>
while true {
if event.kind == ui.EV_NONE{
apply_appearance($&m, $&view) or >>
m.tick($&view, time.instant()) or >>
constraints := layout.tight(width, height) or >>
_ := widgets.layout_styled($&view, &constraints, $&m) or >>
m.place($&view) or >>
if widgets.present_styled($&view, &constraints, $&m) or >> {m.acknowledge()}
event = m.next_event(ech)
}
if event.kind == ui.EV_EXIT{ <- }
if event.window_id == identity.window_id{
if event.kind == ui.EV_CANVAS_CLOSED || event.kind == ui.EV_CLOSED{ <- }
if event.kind == ui.EV_CANVAS_METRICS{metrics := ui.metrics_of(&event) or >>
width = metrics.width
height = metrics.height}
if event.kind == ui.EV_FOCUSED{ui.request_canvas_preferences(&identity) or >> }
if event.kind == ui.EV_CANVAS_PREFERENCES{
preferences := ui.canvas_preferences_of(&event) or >>
if preferences.identity.canvas_id == identity.canvas_id && preferences.identity.generation == identity.generation{
m.reduced_motion = preferences.reduced_motion
view.mark_paint(1) or >>
}
}
popup_was_open := m.select_ctrl.is_open()
actions := m.dispatch_event($&view, &event) or >>
m.native_event($&view, &event) or >>
for action in actions{_ := dispatcher.dispatch(&action, $&m, $&view) or >> }
if ui.is_input_event(event.kind) {input := ui.input_of(&event) or >>
if input.kind == ui.EV_KEY_DOWN && input.key == ui.KEY_ESCAPE && !popup_was_open{
view.dispose()
if demo.alive(&identity) {m.cleanup()}
demo.quit() or >>
<< 0
}}
}
event = ui.poll_chan(ech)
}
view.dispose()
if demo.alive(&identity) {m.cleanup()}
<< 0
}
fn worker(ech chan ui.Event) {scene(ech) or(err) {demo.fail(err.msg())
<< }}
fn main() int {
$app := demo.app("Xu UI / Style Gallery", 960, 820) or(err) {eprintln(err.msg())
<< 1}
xu worker(app.event_ch)
<< app.run() or(err) {eprintln(err.msg())
<< 1}
}@main
#ui
#ui/widgets
fn choose_theme(m $&Model, screen $&widgets.View, action &widgets.Action) string {
m.theme_index =(m.theme_index + 1) % 3
m.appearance_dirty = true
<< ""
}
fn choose_scale(m $&Model, screen $&widgets.View, action &widgets.Action) string {
if m.text_scale == 1.0 {m.text_scale = 1.4} else {m.text_scale = 1.0}
m.appearance_dirty = true
<< ""
}
fn choose_density(m $&Model, screen $&widgets.View, action &widgets.Action) string {
if m.density_scale == 1.0 {m.density_scale = 0.8} else {m.density_scale = 1.0}
m.appearance_dirty = true
<< ""
}
fn cycle_option(m $&Model, screen $&widgets.View, action &widgets.Action) string {
sel := $&m.select_ctrl
next_opt :=(sel.selected() + 1) % 3
sel.set_selected(next_opt) or(err) { << err.msg()}
lbl := $&m.select_label
if next_opt == 0 {lbl.set_text(&"Option: Auto")}
if next_opt == 1 {lbl.set_text(&"Option: Manual")}
if next_opt == 2 {lbl.set_text(&"Option: Locked")}
screen.mark_measure(41) or(err) { << err.msg()}
screen.mark_paint(41) or(err) { << err.msg()}
<< ""
}
fn scroll(m $&Model, screen $&widgets.View, action &widgets.Action) string {
screen.set_scroll(16, 0.0, action.value) or(err) { << err.msg()}
<< ""
}
fn toggle_badge(m $&Model, screen $&widgets.View, action &widgets.Action) string {
bdg := $&m.badge
bdg.set_selected(action.value > 0.5)
blbl := $&m.badge_label
if action.value > 0.5 {blbl.set_text(&"Active")} else {blbl.set_text(&"Paused")}
screen.mark_measure(37) or(err) { << err.msg()}
screen.mark_paint(37) or(err) { << err.msg()}
<< ""
}
fn radio_a_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
rb := $&m.radio_b
rb.set_value(false)
screen.mark_paint(34) or(err) { << err.msg()}
<< ""
}
fn radio_b_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
ra := $&m.radio_a
ra.set_value(false)
screen.mark_paint(33) or(err) { << err.msg()}
<< ""
}
fn slider_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
prog := $&m.progress
prog.set_value(action.value / 100.0) or(err) { << err.msg()}
screen.mark_paint(11) or(err) { << err.msg()}
<< ""
}
fn stepper_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
lbl := $&m.stepper_label
lbl.set_text(&str(int(action.value)))
screen.mark_measure(36) or(err) { << err.msg()}
prog := $&m.progress
prog.set_value(action.value / 100.0) or(err) { << err.msg()}
screen.mark_paint(11) or(err) { << err.msg()}
<< ""
}
fn tabs_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
clbl := $&m.card_label
if action.value == 0.0 {clbl.set_text(&"Card · Overview")}
if action.value == 1.0 {clbl.set_text(&"Card · Tokens")}
if action.value == 2.0 {clbl.set_text(&"Card · Segmented")}
screen.mark_measure(42) or(err) { << err.msg()}
screen.mark_paint(42) or(err) { << err.msg()}
<< ""
}
fn option_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
lbl := $&m.select_label
if action.value == 0.0 {lbl.set_text(&"Option: Auto")}
if action.value == 1.0 {lbl.set_text(&"Option: Manual")}
if action.value == 2.0 {lbl.set_text(&"Option: Locked")}
screen.mark_measure(41) or(err) { << err.msg()}
screen.mark_paint(41) or(err) { << err.msg()}
<< ""
}
fn row_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
clbl := $&m.card_label
clbl.set_text(&("Card · Row " + str(int(action.value) + 1)))
screen.mark_measure(42) or(err) { << err.msg()}
screen.mark_paint(42) or(err) { << err.msg()}
<< ""
}
fn register_actions(m &Model, screen &widgets.View) widgets.ActionDispatcher#Model, widgets.View, widgets.Action{
$d := widgets.action_dispatcher(m, screen)
d.on(4, widgets.ACTION_ACTIVATE, choose_theme) or >>
d.on(5, widgets.ACTION_ACTIVATE, choose_scale) or >>
d.on(6, widgets.ACTION_ACTIVATE, choose_density) or >>
d.on(41, widgets.ACTION_ACTIVATE, cycle_option) or >>
d.on(16, widgets.ACTION_SCROLL, scroll) or >>
d.on(32, widgets.ACTION_CHANGE, toggle_badge) or >>
d.on(33, widgets.ACTION_CHANGE, radio_a_changed) or >>
d.on(34, widgets.ACTION_CHANGE, radio_b_changed) or >>
d.on(35, widgets.ACTION_CHANGE, slider_changed) or >>
d.on(36, widgets.ACTION_CHANGE, stepper_changed) or >>
d.on(40, widgets.ACTION_CHANGE, tabs_changed) or >>
d.on(41, widgets.ACTION_CHANGE, option_changed) or >>
d.on(43, widgets.ACTION_CHANGE, row_changed) or >>
<< d
}@main
#ui
#ui/widgets
fn apply_appearance(m $&Model, view $&widgets.View) int {
if !m.appearance_dirty{ << 0}
theme := m.theme_index
scale := m.text_scale
density := m.density_scale
switcher := $&m.switcher
switcher.use_preset(theme) or >>
switcher.set_text_scale(scale) or >>
switcher.set_density(density) or >>
switcher.apply(view) or >>
m.appearance_dirty = false
<< 0
}16_ui_webview/component_workshop/main.xu@main
#ui
#ui/widgets
#time
demo #"github.com/xulang-org/examples/ui_demo"
fn scene(events chan ui.Event) int {
ready := demo.ready(events) or >>
if ready.kind == ui.EV_EXIT{ << 0}
$screen := widgets.screen(&ready) or >>
screen.resize(1180.0, 900.0) or(err) {screen.dispose()
>> err}
screen.set_min_size(920, 780) or(err) {screen.dispose()
>> err}
$model := create($&screen) or(err) {screen.dispose()
>> err}
workshop_loop(events, $&model, $&screen) or(err) {screen.dispose()
>> err}
screen.dispose()
<< 0
}
fn worker(events chan ui.Event) {scene(events) or(err) {demo.fail(err.msg())
<< }}
fn launch() int {
$app := demo.app("XUUI / Component Workshop", 1180, 900) or >>
xu worker(app.event_ch)
<< app.run() or >>
}
fn main() int { << launch() or(err) {eprintln(err.msg())
<< 1}}
fn next_event(events chan ui.Event, deadline time.Instant) ui.Event{
if deadline.is_zero() { << <- events}
delay := deadline.since(time.instant())
if delay.nanoseconds() <= 0 { << ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}}
timer := delay.timer()
select {event := <- events{timer.stop()
<< event}
_ := <- timer.c{timer.stop()}}
<< ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
}
fn workshop_loop(events chan ui.Event, model $&Workshop, screen $&widgets.Screen) int {
model.apply_locale(screen) or >>
screen.set_text(model.title, "XUUI / Field") or >>
model.configure_controls(screen) or >>
model.controls_dirty = false
model.apply_appearance(screen) or >>
model.appearance_dirty = false
$dispatcher := register_events(& * model, & * screen) or >>
model.layout(screen) or >>
while screen.is_open() {
register_notice_events(& * screen, $&dispatcher) or >>
now := time.instant()
model.work(screen, now) or >>
if model.controls_dirty{model.configure_controls(screen) or >>
model.controls_dirty = false}
if model.appearance_dirty{model.apply_appearance(screen) or >>
model.appearance_dirty = false}
model.apply_page_options(screen) or >>
model.layout(screen) or >>
$deadline := screen.advance(now) or >>
$timed_actions := false
for action in screen.take_actions() {
_ := dispatcher.dispatch_or_fallback(&action, model, screen) or >>
timed_actions = true
}
// Reconcile timer-driven values/styles before computing the next wait.
if timed_actions{ -> }
_ := screen.render() or >>
if model.running &&(deadline.is_zero() || model.deadline.before(deadline)) {deadline = model.deadline}
event := next_event(events, deadline) or >>
$actions := screen.event(&event) or >>
$count := 0
while screen.is_open() && count < 128 {pending := ui.poll_chan(events)
if pending.kind == ui.EV_NONE{ <- }
more := screen.event(&pending) or >>
for action in more{actions.push(action)}
count += 1}
for action in actions{register_notice_events(& * screen, $&dispatcher) or >>
_ := dispatcher.dispatch_or_fallback(&action, model, screen) or >> }
}
<< 0
}@main
#ui/widgets
#time
#math
// Each control ID has one owner-specific handler. No page-number update switch.
fn register_events(m &Workshop, s &widgets.Screen) widgets.ActionDispatcher#Workshop, widgets.Screen, widgets.Action{
$d := widgets.action_dispatcher(m, s)
for page in m.pages{for id in page.ids{d.on_any(id, sample_action) or >> }}
d.on(m.navigation, widgets.ACTION_CHANGE, navigate) or >>
d.on(m.language, widgets.ACTION_CHANGE, language_changed) or >>
for id in[m.theme, m.density, m.scale, m.reduced] {d.on(id, widgets.ACTION_CHANGE, appearance_changed) or >> }
d.on(m.state, widgets.ACTION_CHANGE, state_changed) or >>
d.on(m.custom, widgets.ACTION_ACTIVATE, custom_clicked) or >>
d.on(m.motion, widgets.ACTION_ACTIVATE, motion_clicked) or >>
d.on(m.focus, widgets.ACTION_ACTIVATE, focus_clicked) or >>
for id in m.tools{d.on(id, widgets.ACTION_ACTIVATE, tool_clicked) or >> }
for i in 0:4 {d.on(m.pages[1].ids[9 + i], widgets.ACTION_CHANGE, appearance_changed) or >> }
d.on(m.pages[7].ids[1], widgets.ACTION_CHANGE, tree_filter_changed) or >>
d.on(m.pages[7].ids[0], widgets.ACTION_ITEM_ACTION, node_action) or >>
d.on(m.pages[8].ids[0], widgets.ACTION_ACTIVATE, task_clicked) or >>
for kind in[widgets.ACTION_CHANGE, widgets.ACTION_COMMIT] {
d.on(m.pages[13].ids[0], kind, slider_changed) or >>
d.on(m.pages[20].ids[0], kind, color_changed) or >>
d.on(m.pages[40].ids[0], kind, range_changed) or >>
}
d.on(m.pages[17].ids[1], widgets.ACTION_CHANGE, multi_filter_changed) or >>
d.on(m.pages[24].ids[0], widgets.ACTION_ACTIVATE, table_sorted) or >>
d.on(m.pages[25].ids[0], widgets.ACTION_CHANGE, pagination_changed) or >>
d.on(m.pages[25].ids[2], widgets.ACTION_CHANGE, page_size_changed) or >>
for kind in[widgets.ACTION_SUBMIT, widgets.ACTION_COMMIT] {d.on(m.pages[25].ids[1], kind, page_submitted) or >> }
d.on(m.pages[25].ids[4], widgets.ACTION_ACTIVATE, page_submitted) or >>
d.on(m.pages[30].ids[1], widgets.ACTION_ACTIVATE, inbox_clicked) or >>
d.on(m.pages[30].ids[2], widgets.ACTION_ACTIVATE, online_clicked) or >>
d.on(m.pages[33].ids[0], widgets.ACTION_ACTIVATE, preferences_open) or >>
d.on(m.pages[33].ids[6], widgets.ACTION_ACTIVATE, preferences_cancel) or >>
d.on(m.pages[33].ids[7], widgets.ACTION_ACTIVATE, preferences_apply) or >>
d.on(m.pages[35].ids[0], widgets.ACTION_ACTIVATE, notice_clicked) or >>
d.on(m.pages[36].ids[0], widgets.ACTION_ACTIVATE, modal_open) or >>
for i in 2:4 {d.on(m.pages[36].ids[i], widgets.ACTION_ACTIVATE, modal_close) or >> }
for id in m.pages[38].ids{for kind in[widgets.ACTION_ACTIVATE, widgets.ACTION_CHANGE] {d.on(id, kind, group_changed) or >> }}
for r in 1:7 {d.on(m.pages[39].ids[r], widgets.ACTION_CHANGE, chart_kind_changed) or >> }
for kind in[widgets.ACTION_CHART_HOVER, widgets.ACTION_CHART_SELECT] {d.on(m.pages[39].ids[0], kind, chart_hit) or >> }
d.on(m.pages[39].ids[0], widgets.ACTION_CHART_VIEWPORT, chart_viewport_changed) or >>
d.on(m.pages[41].ids[0], widgets.ACTION_COMMIT, split_committed) or >>
for page in 42:45 {for kind in[widgets.ACTION_ACTIVATE, widgets.ACTION_CHANGE] {d.on(m.pages[page].ids[0], kind, menu_action) or >> }}
d.on(m.pages[45].ids[1], widgets.ACTION_CHANGE, password_visibility_changed) or >>
for kind in[widgets.ACTION_WEB_LOADING, widgets.ACTION_WEB_LOADED, widgets.ACTION_WEB_FAILED, widgets.ACTION_WEB_PROGRESS] {
d.on(m.pages[37].ids[0], kind, webview_changed) or >>
}
<< d
}
fn register_notice_events(s &widgets.Screen, d $&widgets.ActionDispatcher#Workshop, widgets.Screen, widgets.Action) int {
for id in s.notice_ids() {d.on(id, widgets.ACTION_NOTICE_ACTION, notice_action) or >> }
<< 0
}
// Adapters catch Xu errors before crossing the function-value ABI.
fn sample_action(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
sample_action_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn navigate(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
navigate_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn language_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
language_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn appearance_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
appearance_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn custom_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
custom_clicked_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn motion_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
motion_clicked_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn focus_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
focus_clicked_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn tree_filter_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
tree_filter_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn multi_filter_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
multi_filter_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn slider_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
slider_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn color_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
color_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn pagination_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
pagination_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn page_size_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
page_size_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn page_submitted(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
page_submitted_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn task_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
task_clicked_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn inbox_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
inbox_clicked_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn online_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
online_clicked_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn preferences_open(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
preferences_open_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn preferences_cancel(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
preferences_cancel_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn preferences_apply(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
preferences_apply_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn notice_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
notice_clicked_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn notice_action(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
notice_action_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn modal_open(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
modal_open_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn modal_close(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
modal_close_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn group_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
group_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn chart_kind_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
chart_kind_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn chart_hit(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
chart_hit_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn chart_viewport_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
chart_viewport_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn range_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
range_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn split_committed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
split_committed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn menu_action(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
menu_action_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn password_visibility_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
password_visibility_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn table_sorted(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
table_sorted_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn node_action(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
node_action_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn webview_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
webview_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn state_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
state_changed_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn sample_action_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
if a.kind == widgets.ACTION_COMMIT{s.set_text(m.status, "Committed value · " + str(int(a.value))) or >> }
if a.kind == widgets.ACTION_ACTIVATE{s.set_text(m.status, "Activated / 已激活 · control " + str(a.id)) or >> }
<< 0
}
fn navigate_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
old := m.page_snapshot(m.selected)
if m.selected == 33 || m.selected == 36 {s.close_overlay(old.ids[1]) or >> }
m.controls_dirty = true
m.selected = s.selected(m.navigation) or >>
s.set_scroll_offset(m.preview, 0.0) or >>
m.appearance_dirty = true
<< 0
}
fn language_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << m.apply_locale(s) or >> }
fn appearance_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.appearance_dirty = true
<< 0}
fn custom_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.customized = !m.customized
m.controls_dirty = true
m.appearance_dirty = true
<< 0}
fn motion_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.slow = !m.slow
m.controls_dirty = true
m.appearance_dirty = true
<< 0}
fn focus_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
page := m.page_snapshot(m.selected)
$target := page.ids[0]
if m.selected == 31 {target = page.ids[6]}
s.focus(target) or >>
<< 0
}
fn tree_filter_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
s.set_tree_filter(m.pages[7].ids[0], s.text_value(a.id) or >>) or >>
<< 0
}
fn multi_filter_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
s.set_multi_filter(m.pages[17].ids[0], s.text_value(a.id) or >>) or >>
<< 0
}
fn slider_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
s.set_value(m.pages[13].ids[1], str(int(a.value))) or >>
<< sample_action_update(m, s, a) or >>
}
fn color_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
s.set_value(m.pages[20].ids[1], s.color_hex(a.id) or >>) or >>
s.set_field_invalid(m.pages[20].ids[1], false) or >>
<< sample_action_update(m, s, a) or >>
}
fn pagination_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << m.update_pagination(s, true) or >> }
fn page_size_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
page := m.page_snapshot(25)
data := s.pagination_data(page.ids[0]) or >>
sizes :=[10, 20, 50, 100]
s.set_pagination_data(page.ids[0], max_int_local(0, data.total), sizes[s.selected(a.id) or >>]) or >>
<< m.update_pagination(s, true) or >>
}
fn page_submitted_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << tool_25_update(m, s, 0) or >> }
fn task_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
if m.running{ << 0}
m.revision += 1
m.completed = 0
m.checksum = 0
m.running = true
m.deadline = time.instant()
s.begin_task(a.id, m.revision) or >>
<< 0
}
fn inbox_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.unread = 0
<< m.update_badges(s) or >> }
fn online_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.online = !m.online
<< m.update_badges(s) or >> }
fn preferences_open_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << m.open_preferences(s) or >> }
fn preferences_cancel_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.close_overlay(m.pages[33].ids[1]) or >>
<< 0}
fn preferences_apply_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
page := m.page_snapshot(33)
name := s.text_value(page.ids[4]) or >>
if name.len == 0 {s.set_field_invalid(page.ids[4], true) or >>
<< 0}
s.set_field_invalid(page.ids[4], false) or >>
$history := "off"
if s.toggle_value(page.ids[5]) or >> {history = "on"}
m.preferences_name = name
m.preferences_history = s.toggle_value(page.ids[5]) or >>
s.set_text(page.ids[8], "Current: " + m.preferences_name + " · history " + history) or >>
s.close_overlay(page.ids[1]) or >>
<< 0
}
fn notice_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << tool_35_update(m, s, 0) or >> }
fn notice_action_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_text(m.status, "Undo requested · business state can now be restored.") or >>
<< 0}
fn modal_open_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.open(m.pages[36].ids[1]) or >>
<< 0}
fn modal_close_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.close_overlay(m.pages[36].ids[1]) or >>
<< 0}
fn group_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
values := s.button_group_values(a.id) or >>
s.set_text(m.status, "ButtonGroup · key " + str(int(a.value)) + " · selected " + str(values.len)) or >>
<< 0
}
fn chart_kind_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
m.controls_dirty = true
m.chart_kind = int(a.value) - 1
english := (s.selected(m.language) or >>) == 1
series := chart_data_locale(m.chart_kind, m.revision, english)
s.set_chart_series(m.pages[39].ids[0], &series) or >>
s.reset_chart_viewport(m.pages[39].ids[0]) or >>
m.appearance_dirty = true
<< 0
}
fn chart_hit_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
$hit := s.chart_hovered(a.id) or >>
if a.kind == widgets.ACTION_CHART_SELECT{hit = s.chart_selection(a.id) or >> }
if hit.valid{s.set_text(m.status, "Series " + str(hit.series_id) + " / point " + str(hit.point_id) + " · " + str(int(hit.y))) or >> }
<< 0
}
fn chart_viewport_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_text(m.status, "Viewport updated · Double click / Home to reset") or >>
<< 0}
fn range_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << m.range_summary(s, a.kind == widgets.ACTION_COMMIT) or >> }
fn split_committed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_text(m.status, "Split ratio / 分栏比例 · " + str(int(math.round(a.value * 100.0))) + "%") or >>
<< 0}
fn menu_action_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
for index in 42:45 {page := m.page_snapshot(index)
if page.ids[0] == a.id{s.set_text(page.ids[1], "Action / 操作 · " + str(int(a.value))) or >> }}
<< 0
}
fn password_visibility_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_password_visible(m.pages[45].ids[0], s.toggle_value(a.id) or >>) or >>
<< 0}
fn table_sorted_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
$direction := "ascending / 升序"
if s.sort_descending(a.id) or >> {direction = "descending / 降序"}
selected := s.table_selected_row(a.id) or >>
s.set_text(m.status, "Sorted / 已排序 · " + direction + " · source row " + str(selected)) or >>
<< 0
}
fn node_action_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_text(m.status, "Node action · " + str(int(a.value))) or >>
<< 0}
fn webview_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
if m.selected != 37 { << 0}s.set_text(m.status, "WebView · event " + str(a.kind) + " · " + str(int(a.value))) or >>
<< 0}
fn state_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
m.controls_dirty = true
<< 0
}@main
#ui/widgets
#ui/webview
#time
#math
#errors
#strconv
fn tool_0_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(0)
id := page.ids[0]
$text := "精密 · 清晰 · 可靠。"
if option == 0 {text = "长中文:输入、选择、复制与原生排版保持一致。Long English text wraps inside its content width. Family 👨👩👧👦 and developer 👩🏽💻 remain intact."}
s.set_text(id, text) or >>
<< 0
}
fn tool_1_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(1)
id := page.ids[0]
s.set_selected_button(id, option == 0) or >>
<< 0
}
fn tool_2_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(2)
id := page.ids[0]
s.set_selected_button(id, option == 0) or >>
<< 0
}
fn tool_3_update(m $&Workshop, s $&widgets.Screen, option int) int {
index := 3
page := m.page_snapshot(3)
id := page.ids[0]
if option == 0 {s.set_value(id, "") or >> }
if option == 1 {$value := "Long text · 很长的中文与 English · 👩🏽💻 🙂 abcdefghijklmnopqrstuvwxyz"
if index == 4 || index == 6 {value = value + "\n第二行\n第三行\n第四行\n第五行\n第六行\n第七行:内部滚动"}
s.set_value(id, value) or >> }
<< 0
}
fn tool_4_update(m $&Workshop, s $&widgets.Screen, option int) int {
index := 4
page := m.page_snapshot(4)
id := page.ids[0]
if option == 0 {s.set_value(id, "") or >> }
if option == 1 {$value := "Long text · 很长的中文与 English · 👩🏽💻 🙂 abcdefghijklmnopqrstuvwxyz"
if index == 4 || index == 6 {value = value + "\n第二行\n第三行\n第四行\n第五行\n第六行\n第七行:内部滚动"}
s.set_value(id, value) or >> }
<< 0
}
fn tool_5_update(m $&Workshop, s $&widgets.Screen, option int) int {
index := 5
page := m.page_snapshot(5)
id := page.ids[0]
if option == 0 {s.set_value(id, "") or >> }
if option == 1 {$value := "Long text · 很长的中文与 English · 👩🏽💻 🙂 abcdefghijklmnopqrstuvwxyz"
if index == 4 || index == 6 {value = value + "\n第二行\n第三行\n第四行\n第五行\n第六行\n第七行:内部滚动"}
s.set_value(id, value) or >> }
if option == 2 && index >= 5 {m.field_options_dirty = true
m.field_options_page = index
m.variant += 1}
<< 0
}
fn tool_6_update(m $&Workshop, s $&widgets.Screen, option int) int {
index := 6
page := m.page_snapshot(6)
id := page.ids[0]
if option == 0 {s.set_value(id, "") or >> }
if option == 1 {$value := "Long text · 很长的中文与 English · 👩🏽💻 🙂 abcdefghijklmnopqrstuvwxyz"
if index == 4 || index == 6 {value = value + "\n第二行\n第三行\n第四行\n第五行\n第六行\n第七行:内部滚动"}
s.set_value(id, value) or >> }
if option == 2 && index >= 5 {m.field_options_dirty = true
m.field_options_page = index
m.variant += 1}
<< 0
}
fn tool_7_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(7)
id := page.ids[0]
if option == 0 {m.guided = !m.guided
m.tree_options_dirty = true}
if option == 1 {s.set_selected(id, 7) or >>
s.focus(id) or >> }
if option == 2 {s.set_value(page.ids[1], "") or >>
s.set_tree_filter(id, "") or >> }
<< 0
}
fn tool_8_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(8)
id := page.ids[0]
if option == 0 {m.variant += 1
s.set_task_progress_mode(id, m.variant % 3) or >> }
if option == 1 {m.failure = !m.failure
s.set_selected_button(m.tools[1], m.failure) or >> }
if option == 2 && m.running{_ := s.complete_task(id, m.revision, widgets.TASK_CANCELLED) or >>
m.running = false}
<< 0
}
fn tool_9_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(9)
id := page.ids[0]
s.set_checkbox_indeterminate(id, option == 0) or >>
if option > 0 {s.set_toggle_value(id, option == 1) or >> }
<< 0
}
fn tool_10_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(10)
id := page.ids[0]
if option == 0 {m.pending_before = s.toggle_value(id) or >>
s.set_switch_pending(id, true) or >>
s.set_text(id, "Live preview · Saving…") or >> }
else {s.set_switch_pending(id, false) or >>
s.set_toggle_value(id, option == 1 || m.pending_before) or >>
s.set_invalid(id, option == 2) or >>
s.set_text(id, "Live preview 实时预览") or >> }
<< 0
}
fn tool_11_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(11)
id := page.ids[0]
s.set_toggle_value(id, option == 0) or >>
<< 0
}
fn tool_13_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(13)
id := page.ids[0]
if option > 0 {s.set_slider_commit_only(id, option == 1) or >> }
else {text := s.text_value(page.ids[1]) or >>
value := strconv.parse_float(&text) or(err) {s.set_field_invalid(page.ids[1], true) or >>
<< 0}
if math.is_nan(value) || math.is_inf(value) || value < 0.0 || value > 100.0 {s.set_field_invalid(page.ids[1], true) or >>
<< 0}
s.set_number_value(id, value) or >>
s.set_field_invalid(page.ids[1], false) or >> }
<< 0
}
fn tool_15_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(15)
id := page.ids[0]
if option == 0 {s.set_candidate_open(id, true) or >> }
else {s.set_select_option_enabled(id, 2, false) or >> }
<< 0
}
fn tool_16_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(16)
id := page.ids[0]
if option < 2 {s.set_combo_custom_values(id, option == 0) or >> }
else {s.set_value(id, "") or >> }
<< 0
}
fn tool_17_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(17)
id := page.ids[0]
s.select_all(id, option == 0) or >>
<< 0
}
fn tool_18_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(18)
id := page.ids[0]
if option == 0 {s.clear_calendar(id) or >> }
else {value := time.date(2026, 10, 25, 0, 0, 0, 0)
s.set_calendar_value(id, value) or >> }
<< 0
}
fn tool_19_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(19)
id := page.ids[0]
s.set_clock_format(id, option == 0, option != 2) or >>
<< 0
}
fn tool_20_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(20)
id := page.ids[0]
$value := "#B4392DFF"
if option == 0 {value = s.text_value(page.ids[1]) or >> }
if option == 2 {value = "#3279A080"}
s.set_color_hex(id, value) or(err) {s.set_field_invalid(page.ids[1], true) or >>
s.set_text(m.status, err.msg()) or >>
<< 0}
s.set_field_invalid(page.ids[1], false) or >>
s.remember_color(id) or >>
s.set_value(page.ids[1], s.color_hex(id) or >>) or >>
<< 0
}
fn tool_24_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(24)
id := page.ids[0]
s.set_table_status(id,["", "Loading workspace… 正在加载", "Unable to load. Retry when ready."][option]) or >>
<< 0
}
fn tool_25_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(25)
id := page.ids[0]
sizes :=[10, 20, 50, 100]
size := sizes[s.selected(page.ids[2]) or >>]
data := s.pagination_data(id) or >>
if option == 2 {if data.total == 0 {s.set_pagination_data(id, 20000, size) or >> }
else {s.set_pagination_data(id, 0, size) or >> }}
else {
if data.pages == 0 {m.pagination_invalid(s) or >>
<< 0}
current := s.pagination_data(id) or >>
$number := current.pages
if option == 0 {text := s.text_value(page.ids[1]) or >>
number = strconv.atoi(&text) or(err) {m.pagination_invalid(s) or >>
<< 0}
if number < 1 || number > current.pages{m.pagination_invalid(s) or >>
<< 0}}
s.set_selected(id, number - 1) or >>
s.set_field_invalid(page.ids[1], false) or >>
}
m.update_pagination(s, true) or >>
<< 0
}
fn tool_27_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(27)
id := page.ids[0]
s.set_number_value(id,[0.0, 0.42, 1.0][option]) or >>
<< 0
}
fn tool_28_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(28)
id := page.ids[0]
if option < 2 {s.set_running(id, option == 0) or >> }
else {m.spinner_options_dirty = true}
<< 0
}
fn tool_30_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(30)
id := page.ids[0]
if option == 0 {m.unread += 1}
if option == 1 {m.unread = 0}
if option == 2 {m.unread = 123}
m.update_badges(s) or >>
<< 0
}
fn tool_32_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(32)
id := page.ids[0]
if option == 0 {s.set_scroll_offset(id, 0.0) or >> }
if option == 1 {s.set_scroll_offset(id, 100000.0) or >> }
if option == 2 {s.focus(page.ids[page.ids.len - 1]) or >> }
<< 0
}
fn tool_33_update(m $&Workshop, s $&widgets.Screen, option int) int {
index := 33
page := m.page_snapshot(33)
id := page.ids[0]
if option == 2 {m.variant =(m.variant + 1) % 4
m.popover_options_dirty = true}
if option == 0 {if index == 33 {m.open_preferences(s) or >> } else {s.open(page.ids[1]) or >> }}
else if option == 1 {s.close_overlay(page.ids[1]) or >> }
<< 0
}
fn tool_34_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(34)
id := page.ids[0]
if option == 2 {m.tooltip_side =(m.tooltip_side + 1) % 4
m.appearance_dirty = true
s.focus(id) or >>
s.set_text(m.status, "Tooltip · " +["Bottom 下", "Top 上", "Left 左", "Right 右"][m.tooltip_side] + " · flips at the viewport edge") or >> }
if option == 0 {s.focus(id) or >> }
else if option == 1 {s.focus(0) or >> }
<< 0
}
fn tool_35_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(35)
id := page.ids[0]
$notice := widgets.notice(&"Workspace saved · 工作区已保存")
notice.action = "Undo"
notice.key = "workspace-save"
if option == 1 {notice.text = "Changes restored · 已撤销"
notice.key = "workspace-undo"}
$count := 1
if option == 2 {count = 3}
for i in 0:count{if count > 1 {notice.key = "notice-" + str(i)
notice.text = "Queued notice " + str(i + 1)}
_ := s.enqueue_notice(¬ice) or >> }
<< 0
}
fn tool_36_update(m $&Workshop, s $&widgets.Screen, option int) int {
index := 36
page := m.page_snapshot(36)
id := page.ids[0]
if option == 0 {if index == 33 {m.open_preferences(s) or >> } else {s.open(page.ids[1]) or >> }}
else if option == 1 {s.close_overlay(page.ids[1]) or >> }
<< 0
}
fn tool_37_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(37)
id := page.ids[0]
if option == 0 {native := s.webview_native(id) or >>
client := webview.bind_native(&native) or >>
client.command("reload") or >> }
else {s.set_visible(id, option == 2) or >> }
<< 0
}
fn tool_38_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(38)
id := page.ids[0]
if option == 0 {m.group_disabled = !m.group_disabled
m.controls_dirty = true}
if option == 1 {m.group_vertical = !m.group_vertical}
if option == 2 {m.group_joined = !m.group_joined}
m.appearance_dirty = true
<< 0
}
fn tool_39_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(39)
id := page.ids[0]
if option == 0 {m.revision += 1
english := (s.selected(m.language) or >>) == 1
series := chart_data_locale(m.chart_kind, m.revision, english)
s.set_chart_series(id, &series) or >>
m.chart_paused = false}
if option == 1 {s.reset_chart_viewport(id) or >> }
if option == 2 {m.chart_paused = !m.chart_paused
if m.chart_paused{s.pause_chart_animation(id) or >> }
else {s.resume_chart_animation(id) or >> }}
<< 0
}
fn tool_40_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(40)
id := page.ids[0]
if option == 0 {m.range_push = !m.range_push}
if option == 1 {m.range_commit = !m.range_commit}
if option == 2 {m.range_vertical = !m.range_vertical}
m.appearance_dirty = true
m.range_summary(s, false) or >>
<< 0
}
fn tool_41_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(41)
id := page.ids[0]
if option == 0 {m.split_vertical = !m.split_vertical
m.appearance_dirty = true}
if option == 1 {m.split_collapsed =(s.split_layout(id) or >>).collapsed == 0
s.set_split_collapsed(id, 0, m.split_collapsed) or >> }
if option == 2 {m.split_collapsed = false
s.set_split_ratio(id, 0.4) or >> }
<< 0
}
fn tool_42_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(42)
id := page.ids[0]
if option == 0 {s.focus(id) or >>
s.set_menu_open(id, true) or >> }
if option == 1 {m.menu_stays_open = !m.menu_stays_open
m.appearance_dirty = true}
if option == 2 {m.menu_export_disabled = !m.menu_export_disabled
s.set_menu_item_enabled(id, 30, !m.menu_export_disabled) or >> }
<< 0
}
fn tool_43_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(43)
id := page.ids[0]
if option == 0 {s.focus(id) or >>
s.set_menu_open(id, true) or >> }
if option == 1 {m.menu_stays_open = !m.menu_stays_open
m.appearance_dirty = true}
if option == 2 {m.menu_export_disabled = !m.menu_export_disabled
s.set_menu_item_enabled(id, 30, !m.menu_export_disabled) or >> }
<< 0
}
fn tool_44_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(44)
id := page.ids[0]
if option == 0 {s.focus(id) or >>
s.set_menu_open(id, true) or >> }
if option == 1 {m.menu_stays_open = !m.menu_stays_open
m.appearance_dirty = true}
if option == 2 {m.menu_export_disabled = !m.menu_export_disabled
s.set_menu_item_enabled(id, 30, !m.menu_export_disabled) or >> }
<< 0
}
fn tool_45_update(m $&Workshop, s $&widgets.Screen, option int) int {
page := m.page_snapshot(45)
id := page.ids[0]
if option == 0 {s.set_value(id, "") or >> }
if option == 1 {s.set_value(id, "Xu-密码🙂") or >> }
if option == 2 {s.focus(id) or >> }
<< 0
}
fn tool_none_update(m $&Workshop, s $&widgets.Screen, option int) int { << 0}
fn tool_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
handlers :=[tool_0, tool_1, tool_2, tool_3, tool_4, tool_5, tool_6, tool_7, tool_8, tool_9, tool_10, tool_11, tool_none, tool_13, tool_none, tool_15, tool_16, tool_17, tool_18, tool_19, tool_20, tool_none, tool_none, tool_none, tool_24, tool_25, tool_none, tool_27, tool_28, tool_none, tool_30, tool_none, tool_32, tool_33, tool_34, tool_35, tool_36, tool_37, tool_38, tool_39, tool_40, tool_41, tool_42, tool_43, tool_44, tool_45]
for i in 0:3 {if a.id == m.tools[i] {handler := handlers[m.selected]
message := handler(m, s, i)
if message.len > 0 { >> errors.new(message)}
<< 0}}
<< 0
}
fn tool_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
tool_clicked_update(m, s, a) or(err) { << err.msg()}
<< ""
}
fn tool_0(m $&Workshop, s $&widgets.Screen, option int) string {
tool_0_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_1(m $&Workshop, s $&widgets.Screen, option int) string {
tool_1_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_2(m $&Workshop, s $&widgets.Screen, option int) string {
tool_2_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_3(m $&Workshop, s $&widgets.Screen, option int) string {
tool_3_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_4(m $&Workshop, s $&widgets.Screen, option int) string {
tool_4_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_5(m $&Workshop, s $&widgets.Screen, option int) string {
tool_5_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_6(m $&Workshop, s $&widgets.Screen, option int) string {
tool_6_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_7(m $&Workshop, s $&widgets.Screen, option int) string {
tool_7_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_8(m $&Workshop, s $&widgets.Screen, option int) string {
tool_8_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_9(m $&Workshop, s $&widgets.Screen, option int) string {
tool_9_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_10(m $&Workshop, s $&widgets.Screen, option int) string {
tool_10_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_11(m $&Workshop, s $&widgets.Screen, option int) string {
tool_11_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_13(m $&Workshop, s $&widgets.Screen, option int) string {
tool_13_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_15(m $&Workshop, s $&widgets.Screen, option int) string {
tool_15_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_16(m $&Workshop, s $&widgets.Screen, option int) string {
tool_16_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_17(m $&Workshop, s $&widgets.Screen, option int) string {
tool_17_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_18(m $&Workshop, s $&widgets.Screen, option int) string {
tool_18_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_19(m $&Workshop, s $&widgets.Screen, option int) string {
tool_19_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_20(m $&Workshop, s $&widgets.Screen, option int) string {
tool_20_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_24(m $&Workshop, s $&widgets.Screen, option int) string {
tool_24_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_25(m $&Workshop, s $&widgets.Screen, option int) string {
tool_25_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_27(m $&Workshop, s $&widgets.Screen, option int) string {
tool_27_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_28(m $&Workshop, s $&widgets.Screen, option int) string {
tool_28_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_30(m $&Workshop, s $&widgets.Screen, option int) string {
tool_30_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_32(m $&Workshop, s $&widgets.Screen, option int) string {
tool_32_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_33(m $&Workshop, s $&widgets.Screen, option int) string {
tool_33_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_34(m $&Workshop, s $&widgets.Screen, option int) string {
tool_34_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_35(m $&Workshop, s $&widgets.Screen, option int) string {
tool_35_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_36(m $&Workshop, s $&widgets.Screen, option int) string {
tool_36_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_37(m $&Workshop, s $&widgets.Screen, option int) string {
tool_37_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_38(m $&Workshop, s $&widgets.Screen, option int) string {
tool_38_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_39(m $&Workshop, s $&widgets.Screen, option int) string {
tool_39_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_40(m $&Workshop, s $&widgets.Screen, option int) string {
tool_40_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_41(m $&Workshop, s $&widgets.Screen, option int) string {
tool_41_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_42(m $&Workshop, s $&widgets.Screen, option int) string {
tool_42_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_43(m $&Workshop, s $&widgets.Screen, option int) string {
tool_43_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_44(m $&Workshop, s $&widgets.Screen, option int) string {
tool_44_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_45(m $&Workshop, s $&widgets.Screen, option int) string {
tool_45_update(m, s, option) or(err) { << err.msg()}
<< ""
}
fn tool_none(m $&Workshop, s $&widgets.Screen, option int) string {
tool_none_update(m, s, option) or(err) { << err.msg()}
<< ""
}@main
#ui/widgets
#ui/layout
#math
fn focusable_sample(index int) bool { << index != 0 && index != 27 && index != 28 && index != 29 && index != 30}
fn (m &Workshop) layout(s $&widgets.Screen) int {
styles := s.styles()
scale := math.max(1.0, styles.text_scale)
width := s.width()
height := s.height()
gap := 16.0
rail := 216.0 + 40.0 *(scale - 1.0)
x := rail + 48.0
right := width - x - 24.0
row := math.max(40.0 * styles.density, 36.0 * scale)
s.place(m.title, 24.0, 20.0, width - 48.0, 36.0 * scale) or >>
$top := 36.0 * scale + 32.0
items :=[m.theme, m.density, m.scale, m.state]
part :=(width - 48.0 - gap * 3.0) / 4.0
for i in 0:4 {s.place(items[i], 24.0 + f64(i) *(part + gap), top, part, row) or >> }
top += row + 12.0
s.place(m.custom, 24.0, top, part, row) or >>
s.place(m.motion, 24.0 + part + gap, top, part, row) or >>
s.place(m.reduced, 24.0 +(part + gap) * 2.0, top, part, row) or >>
s.place(m.focus, 24.0 +(part + gap) * 3.0, top, part, row) or >>
top += row + 24.0
s.place(m.navigation, 24.0, top, rail, height - top - row - 36.0) or >>
s.place(m.language, 24.0, height - row - 24.0, rail, row) or >>
s.place(m.caption, x, top, right, 58.0 * scale) or >>
control_top := top + 66.0 * scale + 16.0
content := math.max(100.0, right - 48.0)
// Keep complete action labels at large text sizes. The toolbar shares the
// preview's scroll area so wrapping never pushes the sample off the window.
$columns := 3
if content < 780.0 * scale{columns = 2}
if content < 520.0 * scale{columns = 1}
column :=(content - f64(columns - 1) * 12.0) / f64(columns)
tool_names := tool_labels(m.selected)
$tool_count := 0
for i in 0:3 {if tool_names[i].len > 0 {
s.place(m.tools[i], 24.0 + f64(tool_count % columns) *(column + 12.0), 24.0 + f64(tool_count / columns) *(row + 12.0), column, row) or >>
tool_count += 1}}
$tool_extent := 0.0
if tool_count > 0 {tool_extent = f64((tool_count + columns - 1) / columns) *(row + 12.0) + 16.0}
bottom := height - 56.0 * scale - 24.0
s.place(m.preview, x, control_top, right, math.max(100.0, bottom - control_top)) or >>
s.place(m.status, x, math.max(bottom + 12.0, control_top + 112.0), right, 52.0 * scale) or >>
for i in 0:m.pages.len{s.set_visible(m.pages[i].group, i == m.selected) or >> }
position := m.selected
pages := &m.pages
page := &pages[position]
s.place(page.group, 0.0, tool_extent, right, 1000.0 * scale) or >>
id := page.ids[0]
$h := row
if m.selected == 0 {h = 180.0 * scale}
if m.selected == 4 {h = 220.0 * scale}
if m.selected == 5 {h = 96.0 * scale}
if m.selected == 6 {h = 210.0 * scale}
if m.selected == 7 || m.selected == 23 || m.selected == 24 || m.selected == 32 || m.selected == 37 {h = 320.0 * scale}
if m.selected == 12 {h = 144.0 * scale}
if m.selected == 13 {h = 80.0 * scale}
if m.selected == 20 {h = 280.0 * scale}
if m.selected == 27 {h = 16.0 * scale}
if m.selected == 28 {h = 54.0 * scale}
if m.selected == 29 {h = 28.0 * scale}
if m.selected == 30 {h = 320.0 * scale}
if m.selected == 31 {h = 280.0 * scale}
$y := 24.0
if m.selected == 7 || m.selected == 17 {s.place(page.ids[1], 24.0, 24.0, content, 86.0 * scale) or >>
y += 102.0 * scale}
$sample_width := content
if m.selected == 2 {sample_width = row
h = row}
if m.selected != 30 && m.selected != 1 {s.place(id, 24.0, y, sample_width, h) or >> }
if m.selected == 1 {
buttons := m.page_snapshot(1)
h = layout_buttons(s, &buttons, content, row, scale) or >>
}
if m.selected == 34 {
size := s.measure_button(id) or >>
width := math.min(content, math.ceil(size.width))
s.place(id, 24.0 +(content - width) * 0.5, y + 100.0 * scale, width, math.max(row, size.height)) or >>
h = math.max(row, size.height) + 200.0 * scale
}
if m.selected == 0 {s.place(page.ids[1], 24.0, y + h + 16.0, content, 48.0 * scale) or >>
h += 80.0 * scale}
if m.selected == 13 {s.place(page.ids[1], 24.0, y + h + 24.0, content, 100.0 * scale) or >>
h += 148.0 * scale}
if m.selected == 25 {
$summary_height := 28.0 * scale
if content < 650.0 && scale > 1.4 {summary_height = 56.0 * scale}
s.place(page.ids[3], 24.0, y, content, summary_height) or >>
page_y := y + summary_height + 12.0 * scale
s.place(id, 24.0, page_y, content, row) or >>
cy := page_y + row + 28.0 * scale
size_width := math.min(content, 150.0 * scale)
input_width := 112.0 * scale
go_width := 88.0 * scale
$input_x := 40.0 + size_width
$input_y := cy
if size_width + input_width + go_width + 32.0 > content{
input_x = 24.0
input_y = cy + row + 32.0 * scale}
s.place(page.ids[2], 24.0, cy, size_width, row) or >>
s.place(page.ids[1], input_x, input_y - 8.0 * styles.density, input_width, row + 8.0 * styles.density) or >>
s.place(page.ids[4], input_x + input_width + 16.0, input_y, go_width, row) or >>
s.place(page.ids[5], 24.0, input_y + row + 12.0 * scale, content, 40.0 * scale) or >>
h = input_y - y + row + 64.0 * scale
}
if m.selected == 33 {
s.place(id, 24.0, y, math.min(content, 200.0 * scale), row) or >>
s.place(page.ids[1], 0.0, 0.0, 360.0 * scale, 340.0 * scale) or >>
s.place(page.ids[2], 24.0 * scale, 20.0 * scale, 312.0 * scale, 30.0 * scale) or >>
s.place(page.ids[3], 24.0 * scale, 58.0 * scale, 312.0 * scale, 66.0 * scale) or >>
s.place(page.ids[4], 24.0 * scale, 132.0 * scale, 312.0 * scale, 88.0 * scale) or >>
s.place(page.ids[5], 24.0 * scale, 224.0 * scale, 312.0 * scale, row) or >>
s.place(page.ids[6], 24.0 * scale, 280.0 * scale, 148.0 * scale, row) or >>
s.place(page.ids[7], 188.0 * scale, 280.0 * scale, 148.0 * scale, row) or >>
s.place(page.ids[8], 24.0, y + row + 20.0 * scale, content, 64.0 * scale) or >>
h = row + 100.0 * scale
}
if m.selected == 20 {s.place(page.ids[1], 24.0, y + h + 24.0, content, 96.0 * scale) or >>
h += 124.0 * scale}
if m.selected == 28 || m.selected == 29 {s.place(page.ids[1], 24.0, y + h + 12.0, content, 36.0 * scale) or >>
h += 60.0 * scale}
if m.selected == 30 {
button_width := math.min(content - 16.0, 220.0 * scale)
s.place(page.ids[1], 24.0, y, button_width, row) or >>
s.place(page.ids[6], 24.0, y + row + 14.0 * scale, content, 36.0 * scale) or >>
ay := y + row + 78.0 * scale
s.place(page.ids[2], 24.0, ay, 56.0 * scale, 56.0 * scale) or >>
s.place(page.ids[7], 100.0 * scale, ay, math.max(1.0, content - 100.0 * scale), 32.0 * scale) or >>
s.place(page.ids[8], 100.0 * scale, ay + 34.0 * scale, math.max(1.0, content - 100.0 * scale), 40.0 * scale) or >>
sy := ay + 106.0 * scale
tag := s.badge_size(page.ids[4]) or >>
beta := s.badge_size(page.ids[5]) or >>
label_width := 220.0 * scale
$tx := 24.0
$ty := sy + 44.0 * scale
if label_width + tag.width + beta.width + 32.0 <= content{
s.place(page.ids[9], 24.0, sy, label_width, 32.0 * scale) or >>
tx = 40.0 + label_width
ty = sy
} else {s.place(page.ids[9], 24.0, sy, content, 32.0 * scale) or >> }
s.place(page.ids[4], tx, ty, tag.width, tag.height) or >>
s.place(page.ids[5], tx + 16.0 + tag.width, ty, beta.width, beta.height) or >>
h = ty + math.max(tag.height, 32.0 * scale)
}
if m.selected == 31 {s.place(page.ids[4], 0.0, 0.0, content - 32.0, 36.0 * scale) or >>
s.place(page.ids[5], 0.0, 0.0, content - 32.0, 110.0 * scale) or >>
s.place(page.ids[6], 0.0, 0.0, content - 32.0, row) or >> }
if m.selected == 32 {s.set_scroll_extent(id, 14.0 *(row + 16.0) + 24.0) or >>
for i in 1:page.ids.len{s.place(page.ids[i], 12.0, 12.0 + f64(i - 1) *(row + 16.0), content - 44.0, row) or >> }}
if m.selected == 38 {
height := row
$group_h := height
if m.group_vertical{group_h = row * 3.0}
$group_width := content
if m.group_vertical{group_width = math.min(content, 260.0 * scale)}
for i in 0:3 {cy := y + f64(i) *(group_h + 40.0 * scale)
s.place(page.ids[3 + i], 24.0, cy, content, 24.0 * scale) or >>
s.place(page.ids[i], 24.0, cy + 28.0 * scale, group_width, group_h) or >> }
h = 3.0 *(group_h + 40.0 * scale)
}
if m.selected == 39 {
$selector_h := row
$selector := widgets.button_group_appearance()
selector.equal_width = true
selector.allow_empty = true
if scale > 1.4 && content < 560.0 {selector.vertical = true
selector_h = row * 5.0}
$cy := y
for r in 0:6 {
gid := page.ids[1 + r]
s.set_button_group_appearance(gid, &selector) or >>
s.place(gid, 24.0, cy, content, selector_h) or >>
cy += selector_h + 8.0 * scale
}
chart_y := cy + 12.0 * scale
chart_h := math.max(320.0, 320.0 * scale)
s.place(id, 24.0, chart_y, content, chart_h) or >>
h = (chart_y - y) + chart_h + 20.0 * scale
}
if m.selected >= 40 {h = m.interaction_layout(s, row, scale, content) or >> }
if m.selected == 36 {s.place(page.ids[2], 24.0 * scale, 190.0 * scale, 170.0 * scale, row) or >>
s.place(page.ids[3], 210.0 * scale, 190.0 * scale, 170.0 * scale, row) or >> }
s.set_scroll_extent(m.preview, tool_extent + y + h + 32.0) or >>
<< 0
}
fn layout_buttons(s $&widgets.Screen, page &Page, content f64, row f64, scale f64) f64 {
stepper_width := math.min(content, 160.0 * scale)
label_height := 24.0 * scale
inspector_height := label_height + 8.0 + row + 12.0
$cy := 24.0
// Keep each direction pair together when it fits, then wrap by the native
// measured size rather than stretching every example across the preview.
for group in 0:2 {
$x := 24.0
$line_height := 0.0
for i in(group * 2):(group * 2 + 2) {
size := s.measure_button(page.ids[i]) or >>
width := math.min(content, math.ceil(size.width))
height := math.max(row, math.ceil(size.height))
column := math.max(width, stepper_width)
if x > 24.0 && x + column > 24.0 + content{
x = 24.0
cy += line_height + 12.0
line_height = 0.0
}
s.place(page.ids[13 + i], x, cy, column, label_height) or >>
s.place(page.ids[9 + i], x, cy + label_height + 8.0, stepper_width, row) or >>
s.place(page.ids[i], x, cy + inspector_height, width, height) or >>
x += column + 16.0
line_height = math.max(line_height, inspector_height + height)
}
cy += line_height + 20.0
}
$x := 24.0
$line_height := 0.0
for i in 4:9 {
size := s.measure_button(page.ids[i]) or >>
width := math.min(content, math.ceil(size.width))
height := math.max(row, math.ceil(size.height))
if x > 24.0 && x + width > 24.0 + content{
x = 24.0
cy += line_height + 12.0
line_height = 0.0
}
s.place(page.ids[i], x, cy, width, height) or >>
x += width + 12.0
line_height = math.max(line_height, height)
}
cy += line_height + 20.0
<< cy - 24.0
}
fn (m &Workshop) interaction_layout(s $&widgets.Screen, row f64, scale f64, content f64) f64 {
position := m.selected
pages := &m.pages
page := &pages[position]
id := page.ids[0]
if m.selected == 45 {
width := math.min(content, 380.0 * scale)
label_height := 28.0 * scale
input_height := math.max(row, 48.0 * s.styles().density)
input_y := 24.0 + label_height + 8.0
s.place(page.ids[2], 24.0, 24.0, width, label_height) or >>
s.place(id, 24.0, input_y, width, input_height) or >>
s.place(page.ids[1], 24.0, input_y + input_height + 16.0, content, row) or >>
s.place(page.ids[3], 24.0, input_y + input_height + row + 36.0, content, 100.0 * scale) or >>
<< label_height + input_height + row + 160.0 * scale
}
if m.selected == 40 {
$width := content
$height := 104.0 * scale
if m.range_vertical{width = math.min(content, 160.0 * scale)
height = 300.0 * scale}
s.place(page.ids[1], 24.0, 24.0, content, 32.0 * scale) or >>
s.place(id, 24.0, 64.0 * scale, width, height) or >>
s.place(page.ids[2], 24.0, 80.0 * scale + height, content, 64.0 * scale) or >>
<< height + 144.0 * scale
}
if m.selected == 41 {
height := 320.0 * scale
s.place(id, 24.0, 24.0, content, height) or >>
boxes := s.split_layout(id) or >>
for pane in 0:2 {
$width := boxes.first.width
$height := boxes.first.height
if pane == 1 {width = boxes.second.width
height = boxes.second.height}
inner := math.max(1.0, width - 32.0)
caption_height := math.max(1.0, math.min(100.0 * scale, height - row - 48.0))
s.place(page.ids[3 + pane], 16.0, 16.0, inner, caption_height) or >>
s.set_visible(page.ids[5 + pane], height >= row + 32.0) or >>
s.place(page.ids[5 + pane], 16.0, math.max(16.0, height - row - 16.0), inner, row) or >>
}
<< height
}
if m.selected >= 42 && m.selected <= 44 {
$width := math.min(content, 240.0 * scale)
$height := row
if m.selected == 43 {width = content
height = 180.0 * scale}
s.place(id, 24.0, 24.0, width, height) or >>
s.place(page.ids[1], 24.0, height + 44.0 * scale, content, 44.0 * scale) or >>
s.place(page.ids[2], 24.0, height + 100.0 * scale, content, 80.0 * scale) or >>
<< height + 180.0 * scale
}
<< row
}@main
#ui/widgets
#time
#strconv
struct Page{group int
ids []int}
// A state transition may reconfigure Workshop while these control IDs are in
// use. Copy the IDs; Screen keeps ownership of the actual controls.
fn (m &Workshop) page_snapshot(index int) Page{
group := m.pages[index].group
$ids :=[]int {}
for id in m.pages[index].ids{ids.push(id)}
<< Page{group: group, ids: ids}
}
struct Workshop{
controls_dirty bool
field_options_page int
appearance_dirty bool
tree_options_dirty bool
field_options_dirty bool
spinner_options_dirty bool
popover_options_dirty bool
tooltip_side int
range_push bool
range_vertical bool
range_commit bool
split_vertical bool
split_collapsed bool
menu_stays_open bool
menu_export_disabled bool
chart_kind int
chart_paused bool
group_vertical bool
group_joined bool
group_disabled bool
pages []Page
names []string
navigation int
language int
preview int
title int
caption int
status int
theme int
density int
scale int
state int
custom int
reduced int
motion int
focus int
tools []int
selected int
customized bool
guided bool
slow bool
variant int
revision int
completed int
running bool
failure bool
pending_before bool
pagination_error bool
preferences_name string
preferences_history bool
unread int
online bool
checksum int
deadline time.Instant
}
fn create(s $&widgets.Screen) Workshop{
labels := names()
$pages :=[]Page{}
preview := s.scroll_area(widgets.AXIS_VERTICAL, 760.0) or >>
for index in 0:labels.len{page := new_page(s, index) or >>
s.set_parent(page.group, preview) or >>
pages.push(page)}
title := s.label("", 25.0, false) or >>
caption := s.label("", 13.0, true) or >>
s.set_label_wrapped(caption, true) or >>
status := s.label("Hover · press · Tab · arrows · Escape / 使用真实鼠标与键盘状态", 12.0, true) or >>
s.set_label_wrapped(status, true) or >>
navigation := s.list_box(&labels, 5) or >>
language := s.select_box(&["中文", "English", "Custom"], 1) or >>
_ := s.tooltip(language, "Component language · 组件默认文案与格式") or >>
tools :=[s.button("Option 1") or >>, s.button("Option 2") or >>, s.button("Option 3") or >>]
for tool in tools{s.set_parent(tool, preview) or >> }
<< Workshop{controls_dirty: true, field_options_page: 5, appearance_dirty: true, tree_options_dirty: false, field_options_dirty: false, spinner_options_dirty: false, popover_options_dirty: false, tooltip_side: widgets.OVERLAY_TOP, range_push: false, range_vertical: false, range_commit: false, split_vertical: false, split_collapsed: false, menu_stays_open: false, menu_export_disabled: false, chart_kind: 0, chart_paused: false, group_vertical: false, group_joined: true, group_disabled: false, language: language, pages: pages, names: labels, navigation: navigation, preview: preview, title: title, caption: caption, status: status,
theme: s.select_box(&["Light 亮色", "Dark 暗色", "Contrast 对比"], 1) or >>,
density: s.select_box(&["Normal 常规", "Compact 紧凑", "Touch 触控"], 0) or >>,
scale: s.select_box(&["Text 100%", "Text 140%", "Text 200%"], 0) or >>,
state: s.select_box(&["Normal 普通", "Disabled 禁用", "Read only 只读", "Invalid 错误"], 0) or >>,
custom: s.button("Default 默认") or >>, reduced: s.checkbox("Reduce 减少动效", false) or >>,
motion: s.button("Motion 160ms") or >>, focus: s.button("Focus sample") or >>,
tools: tools, selected: 5, customized: false, guided: true, slow: false,
variant: 0, revision: 0, completed: 0, running: false, failure: false, pending_before: false, pagination_error: false, preferences_name: "XU workspace", preferences_history: true, unread: 12, online: true, checksum: 0, deadline: time.zero_instant()}
}
fn (m $&Workshop) apply_locale(s $&widgets.Screen) int {
index := s.selected(m.language) or >>
$locale := widgets.locale_en_us()
if index != 1 {locale = widgets.locale_zh_cn()}
if index == 2 {
locale.set_text(widgets.TEXT_TODAY, "回到今天") or >>
locale.set_text(widgets.TEXT_CLEAR, "移除日期") or >>
locale.set_text(widgets.TEXT_DATE_PLACEHOLDER, "预约日期") or >>
locale.set_text(widgets.TEXT_DATE_PATTERN, "{day}.{month}.{year}") or >>
locale.set_text(widgets.TEXT_DECIMAL_SEPARATOR, ",") or >>
locale.set_text(widgets.TEXT_GROUP_SEPARATOR, " ") or >>
locale.set_weekdays(&["周日", "周一", "周二", "周三", "周四", "周五", "周六"]) or >>
}
s.set_locale(&locale) or >>
pages := &m.pages
pagination := &pages[25]
sizes :=[10, 20, 50, 100]
for i in 0:4 {s.set_option_text(pagination.ids[2], i, locale.count_text(widgets.TEXT_ITEMS_PER_PAGE, sizes[i]) or >>) or >> }
m.update_pagination(s, false) or >>
// Business copy is supplied by the app, never silently translated by the widget.
english := index == 1
m.names = names_locale(english)
for i in 0:m.names.len {s.set_option_text(m.navigation, i, m.names[i]) or >> }
$themes :=["亮色", "暗色", "高对比"]
$densities :=["常规", "紧凑", "触控"]
$scales :=["字号 100%", "字号 140%", "字号 200%"]
$states :=["普通", "禁用", "只读", "错误"]
$choices :=["工作区", "历史", "输出"]
$segments :=["日", "周", "月"]
$group_titles :=["独立操作", "单选", "多选"]
$btn_samples :=["构建项目", "打开工作区 · 右侧图标", "保存修改 · 上方图标", "下载 SDK · 下方图标", "次要按钮", "描边按钮", "幽灵按钮", "危险操作", "轻量按钮"]
$overlay_triggers :=["打开浮层", "聚焦或悬停查看帮助", "发送通知", "打开确认弹窗"]
if english{
themes =["Light", "Dark", "Contrast"]
densities =["Normal", "Compact", "Touch"]
scales =["Text 100%", "Text 140%", "Text 200%"]
states =["Normal", "Disabled", "Read only", "Invalid"]
choices =["Workspace", "History", "Output"]
segments =["Day", "Week", "Month"]
group_titles =["Actions", "Single", "Multiple"]
btn_samples =["Build project", "Open workspace · trailing", "Save changes · above", "Download SDK · below", "Secondary", "Outline", "Ghost", "Danger", "Subtle"]
overlay_triggers =["Open popover", "Focus or hover for help", "Enqueue notification", "Open confirmation"]
}
for i in 0:9 {s.set_text(m.pages[1].ids[i], btn_samples[i]) or >> }
for i in 0:4 {s.set_text(m.pages[33 + i].ids[0], overlay_triggers[i]) or >> }
for i in 0:3 {
s.set_option_text(m.theme, i, themes[i]) or >>
s.set_option_text(m.density, i, densities[i]) or >>
s.set_option_text(m.scale, i, scales[i]) or >>
s.set_option_text(m.pages[21].ids[0], i, choices[i]) or >>
s.set_option_text(m.pages[22].ids[0], i, segments[i]) or >>
s.set_text(m.pages[38].ids[3 + i], group_titles[i]) or >>
}
for i in 0:4 {s.set_option_text(m.state, i, states[i]) or >> }
page := &m.pages[8]
if english {
s.set_text(page.ids[0], "Build project") or >>
s.set_task_labels(page.ids[0], "Building", "Built · run again", "Retry build", "Build again") or >>
s.set_text(m.reduced, "Reduce motion") or >>
s.set_text(m.focus, "Focus sample") or >>
s.set_text(m.pages[9].ids[0], "Keep generated files") or >>
s.set_text(m.pages[10].ids[0], "Live preview") or >>
s.set_text(m.pages[11].ids[0], "Use workspace settings") or >>
s.set_text(m.pages[25].ids[4], "Go") or >>
s.set_text(m.pages[28].ids[1], "Loading assets…") or >>
s.set_text(m.pages[29].ids[1], "SECTION") or >>
s.set_text(m.pages[30].ids[1], "Inbox") or >>
s.set_text(m.pages[30].ids[4], "Synced") or >>
s.set_text(m.pages[30].ids[9], "Workspace") or >>
s.set_text(m.pages[31].ids[4], "Workspace configuration") or >>
s.set_text(m.pages[31].ids[6], "Open workspace") or >>
s.set_text(m.pages[33].ids[2], "Workspace preferences") or >>
s.set_text(m.pages[33].ids[5], "Keep history") or >>
s.set_text(m.pages[33].ids[6], "Cancel") or >>
s.set_text(m.pages[33].ids[7], "Apply") or >>
s.set_text(m.pages[36].ids[2], "Cancel") or >>
s.set_text(m.pages[36].ids[3], "Apply changes") or >>
s.set_text(m.pages[41].ids[5], "Open workspace") or >>
s.set_text(m.pages[41].ids[6], "Refresh preview") or >>
s.set_text(m.pages[45].ids[1], "Show password") or >>
s.set_text(m.pages[45].ids[2], "Password") or >>
} else {
s.set_text(page.ids[0], "构建项目") or >>
s.set_task_labels(page.ids[0], "正在构建", "已构建 · 再次运行", "重试构建", "再次构建") or >>
s.set_text(m.reduced, "减少动效") or >>
s.set_text(m.focus, "聚焦示例") or >>
s.set_text(m.pages[9].ids[0], "保留生成产物") or >>
s.set_text(m.pages[10].ids[0], "实时预览") or >>
s.set_text(m.pages[11].ids[0], "使用工作区设置") or >>
s.set_text(m.pages[25].ids[4], "跳转") or >>
s.set_text(m.pages[28].ids[1], "正在加载资源…") or >>
s.set_text(m.pages[29].ids[1], "章节分隔") or >>
s.set_text(m.pages[30].ids[1], "收件箱") or >>
s.set_text(m.pages[30].ids[4], "已同步") or >>
s.set_text(m.pages[30].ids[9], "工作区") or >>
s.set_text(m.pages[31].ids[4], "工作区配置") or >>
s.set_text(m.pages[31].ids[6], "打开工作区") or >>
s.set_text(m.pages[33].ids[2], "工作区偏好设置") or >>
s.set_text(m.pages[33].ids[5], "保留历史记录") or >>
s.set_text(m.pages[33].ids[6], "取消") or >>
s.set_text(m.pages[33].ids[7], "应用") or >>
s.set_text(m.pages[36].ids[2], "取消") or >>
s.set_text(m.pages[36].ids[3], "应用更改") or >>
s.set_text(m.pages[41].ids[5], "打开工作区") or >>
s.set_text(m.pages[41].ids[6], "刷新预览") or >>
s.set_text(m.pages[45].ids[1], "显示密码") or >>
s.set_text(m.pages[45].ids[2], "密码") or >>
}
m.update_badges(s) or >>
m.range_summary(s, false) or >>
m.appearance_dirty = true
$group_labels :=[["Undo", "Redo", "Save"],["Day", "Week", "Month"],["Bold", "Italic", "Underline"]]
$type_labels :=["Line", "Area", "Bar", "Scatter", "Donut",
"Step", "StackArea", "StackBar", "H-Bar", "Pie",
"Rose", "Radar", "Gauge", "Bubble", "Histogram",
"Boxplot", "Heatmap", "Candle", "Waterfall", "Funnel",
"Spline", "SplineArea", "PolarBar", "Treemap", "Sankey",
"Violin", "Bullet", "Lollipop", "Dumbbell", "Pareto"]
if !english {
group_labels =[["撤销", "重做", "保存"],["日", "周", "月"],["加粗", "斜体", "下划线"]]
type_labels =["折线", "面积", "柱状", "散点", "环形",
"阶梯", "堆叠面积", "堆叠柱状", "水平条形", "饼图",
"玫瑰", "雷达", "仪表盘", "气泡", "直方图",
"箱线", "热力", "K 线", "瀑布", "漏斗",
"样条线", "样条面积", "极坐标环", "树图", "桑基",
"小提琴", "子弹图", "棒棒糖", "哑铃", "帕累托"]
}
for mode in 0:3 {for i in 0:3 {s.set_button_group_label(m.pages[38].ids[mode],(i + 1) * 10, group_labels[mode][i]) or >> }}
for r in 0:6 {
gid := m.pages[39].ids[1 + r]
for k in 0:5 {
key := r * 5 + k + 1
s.set_button_group_label(gid, key, type_labels[key - 1]) or >>
}
}
series := chart_data_locale(m.chart_kind, m.revision, english)
s.set_chart_series(m.pages[39].ids[0], &series) or >>
translated := workshop_menu_items(english)
for page_index in 42:45 {for item in translated{s.set_menu_item_label(m.pages[page_index].ids[0], item.key, item.label) or >> }}
$menu_labels :=["Actions", "Right click here", "Save"]
if !english {menu_labels =["操作", "右键打开菜单", "保存"]}
for page_index in 42:45 {s.set_menu_label(m.pages[page_index].ids[0], menu_labels[page_index - 42]) or >> }
m.controls_dirty = true
<< 0
}
fn max_int_local(a int, b int) int {if a > b{ << a}
<< b}
fn (m &Workshop) open_preferences(s $&widgets.Screen) int {
pages := &m.pages
page := &pages[33]
s.set_value(page.ids[4], m.preferences_name) or >>
s.set_toggle_value(page.ids[5], m.preferences_history) or >>
s.set_field_invalid(page.ids[4], false) or >>
s.open(page.ids[1]) or >>
<< 0
}
fn (m $&Workshop) pagination_invalid(s $&widgets.Screen) int {
m.pagination_error = true
page := m.page_snapshot(25)
data := s.pagination_data(page.ids[0]) or >>
s.set_field_invalid(page.ids[1], true) or >>
$message := "Enter a page from 1 to " + str(data.pages) + "."
if(s.selected(m.language) or >>) != 1 {message = "请输入 1 至 " + str(data.pages) + " 之间的页码。"}
if data.pages == 0 {message = "No pages / 暂无数据,无法跳页。"}
s.set_text(page.ids[5], message) or >>
<< 0
}
fn (m $&Workshop) update_pagination(s $&widgets.Screen, sync_input bool) int {
page := m.page_snapshot(25)
data := s.pagination_data(page.ids[0]) or >>
s.set_text(page.ids[3], s.pagination_summary(page.ids[0]) or >>) or >>
s.set_enabled(page.ids[1], data.pages > 0) or >>
s.set_enabled(page.ids[4], data.pages > 0) or >>
if sync_input{
m.pagination_error = false
s.set_field_invalid(page.ids[1], false) or >>
$text := ""
if data.current >= 0 {text = str(data.current + 1)}
s.set_value(page.ids[1], text) or >> }
if m.pagination_error{m.pagination_invalid(s) or >> }
else {$hint := "Enter ↵ · 1–" + str(data.pages)
if data.pages == 0 {hint = "No data / 暂无数据"}
s.set_text(page.ids[5], hint) or >> }
<< 0
}
fn (m &Workshop) update_badges(s $&widgets.Screen) int {
english := (s.selected(m.language) or >>) == 1
pages := &m.pages
page := &pages[30]
s.set_badge_count(page.ids[0], m.unread, 99, false) or >>
$summary := str(m.unread) + " 条未读 · 点击收件箱清零,徽标随数字收紧。"
if english {summary = str(m.unread) + " unread · Click Inbox to clear; badge tightens with digits."}
s.set_text(page.ids[6], summary) or >>
s.set_visible(page.ids[3], m.online) or >>
$name := "林文 · 离线"
if m.online{name = "林文 · 在线"}
if english {
name = "Lin Wen · Away"
if m.online{name = "Lin Wen · Available"}
}
s.set_text(page.ids[7], name) or >>
<< 0
}
fn (m $&Workshop) work(s $&widgets.Screen, now time.Instant) int {
if !m.running || now.before(m.deadline) { << 0}
for i in 0:5000 {m.checksum =(m.checksum + i *(m.completed + 1)) % 1000003}
m.completed += 1
id := m.pages[8].ids[0]
_ := s.set_task_progress(id, m.revision, f64(m.completed) / 48.0) or >>
m.deadline = now.add(time.milliseconds(35) or >>) or >>
if m.failure && m.completed == 18 {_ := s.complete_task(id, m.revision, widgets.TASK_ERROR) or >>
m.running = false
m.failure = false
if m.selected == 8 {s.set_selected_button(m.tools[1], false) or >> }}
else if m.completed == 48 {_ := s.complete_task(id, m.revision, widgets.TASK_SUCCESS) or >>
m.running = false}
<< 0
}
fn (m &Workshop) range_summary(s $&widgets.Screen, committed bool) int {
english := (s.selected(m.language) or >>) == 1
pages := &m.pages
page := &pages[40]
values := s.range_values(page.ids[0]) or >>
$prefix := "预览"
if committed{prefix = "已提交"}
if english {
prefix = "Preview"
if committed{prefix = "Committed"}
}
text := strconv.format_float(values.lower, 102, 0) or >>
upper := strconv.format_float(values.upper, 102, 0) or >>
s.set_text(page.ids[1], prefix + " · " + text + " – " + upper) or >>
<< 0
}
fn (m $&Workshop) configure_controls(s $&widgets.Screen) int {
position := m.selected
page := m.page_snapshot(position)
s.set_text(m.title, "XUUI / " + m.names[position]) or >>
s.set_selected(m.navigation, position) or >>
id := page.ids[0]
state := s.selected(m.state) or >>
s.set_enabled(id, state != 1) or >>
if position == 45 {s.set_enabled(page.ids[1], state != 1) or >> }
if position == 25 {s.set_enabled(page.group, state != 1) or >> }
if read_only(m.selected) {s.set_read_only(id, state == 2) or >> }
if invalid(m.selected) || m.selected == 31 || m.selected == 32 {s.set_invalid(id, state == 3) or >> }
if position == 1 {for i in 0:9 {s.set_enabled(page.ids[i], state != 1) or >> }}
if position == 38 {for i in 0:3 {
s.set_button_group_item_enabled(page.ids[i], 20, !m.group_disabled) or >>
s.set_enabled(page.ids[i], state != 1) or >>
s.set_read_only(page.ids[i], state == 2) or >>
}}
if position == 39 {
for r in 0:6 {
gid := page.ids[1 + r]
for k in 0:5 {
key := r * 5 + k + 1
s.set_button_group_checked(gid, key, m.chart_kind + 1 == key) or >>
}
s.set_enabled(gid, state != 1) or >>
s.set_read_only(gid, state == 2) or >>
}
}
english := (s.selected(m.language) or >>) == 1
s.set_enabled(m.motion, animated(m.selected) ||(m.selected >= 33 && m.selected <= 36)) or >>
s.set_selected_button(m.custom, m.customized) or >>
$custom_text := "默认样式"
if m.customized{custom_text = "自定义样式"}
if english {
custom_text = "Default"
if m.customized{custom_text = "Custom"}
}
s.set_text(m.custom, custom_text) or >>
$motion_text := "动效 160ms"
if m.slow{motion_text = "动效 420ms"}
if english {
motion_text = "Motion 160ms"
if m.slow{motion_text = "Motion 420ms"}
}
s.set_text(m.motion, motion_text) or >>
caption := description_locale(m.selected, english)
s.set_text(m.caption, caption) or >>
$state_text := "悬停 · 按下 · Tab · 方向键 · Escape(使用真实鼠标与键盘状态)"
if english {state_text = "Hover · press · Tab · arrows · Escape"}
if(state == 2 && !read_only(m.selected)) ||(state == 3 && !invalid(m.selected) && m.selected != 31 && m.selected != 32) {
state_text = "此组件没有该状态。预览保持其实际语义。"
if english {state_text = "This component does not have that state; preview keeps its actual semantics."}
}
s.set_text(m.status, state_text) or >>
labels := tool_labels_locale(m.selected, english)
for i in 0:3 {s.set_text(m.tools[i], labels[i]) or >>
s.set_selected_button(m.tools[i], false) or >>
s.set_enabled(m.tools[i], labels[i].len > 0) or >>
s.set_visible(m.tools[i], labels[i].len > 0) or >> }
if m.selected == 8 {s.set_selected_button(m.tools[1], m.failure) or >> }
s.set_visible(m.focus, focusable_sample(m.selected)) or >>
<< 0
}@main
#ui/widgets
#ui/chart
#ui/draw
#ui/layout
#time
fn read_only(index int) bool { << index >= 38 ||(index >= 1 && index <= 26 && index != 8 && index != 25 && index != 26)}
fn invalid(index int) bool { << index >= 40 || index >= 1 && index <= 30 && index != 7 && index != 8 && index != 12 && index != 24 && index != 25 && index != 26 && index != 28}
fn animated(index int) bool { <<(index >= 38 && index <= 44) || index == 1 || index == 2 || index == 5 || index == 6 || index == 7 || index == 8 || index == 9 || index == 10 || index == 11 || index == 25}
fn appearance(styles &widgets.Styles, index int) widgets.ControlStyle{
if index == 0 {$c := styles.input.clone()
c.padding = layout.Insets{left: 0.0, top: 0.0, right: 0.0, bottom: 0.0}
c.align_x = 0.0
c.align_y = 0.0
<< c}
if index == 7 { << styles.tree_style()}
if index == 24 { << styles.table_style()}
if index == 9 || index == 10 || index == 11 || index == 12 { << styles.checkbox.clone()}
if index == 3 || index == 5 || index == 45 { << styles.input.clone()}
if index == 4 || index == 6 { << styles.text_area.clone()}
if index == 13 || index == 40 { << styles.slider_style()}
if index == 41 { << styles.card_style()}
if index == 14 { << styles.stepper_style()}
if index == 15 { << styles.select_style()}
if index == 21 || index == 22 { << styles.tabs_style()}
if index == 23 { << styles.list_box_style()}
if index == 27 { << styles.progress.clone()}
if index == 29 { << styles.divider_style()}
if index == 30 { << styles.badge_style()}
if index == 31 { << styles.card_style()}
if index == 32 { << styles.scroll.clone()}
<< styles.button.clone()
}
fn (m $&Workshop) apply_appearance(s $&widgets.Screen) int {
theme := s.selected(m.theme) or >>
density := s.selected(m.density) or >>
scale := s.selected(m.scale) or >>
preset :=[widgets.THEME_LIGHT, widgets.THEME_DARK, widgets.THEME_CONTRAST][theme]
$styles := widgets.preset_styles(preset) or >>
styles.density =[1.0, 0.85, 1.25][density]
styles.text_scale =[1.0, 1.4, 2.0][scale]
sheet := widgets.screen_appearance(&styles, s.toggle_value(m.reduced) or >>) or >>
s.apply_appearance(&sheet) or >>
position := m.selected
pages := &m.pages
page := &pages[position]
id := page.ids[0]
if m.selected == 30 {$avatar := styles.button_variant(widgets.BUTTON_SUBTLE) or >>
avatar.radius = 999.0
s.set_control_style(page.ids[2], &avatar) or >> }
if m.selected <= 32 || m.selected >= 40 {
s.clear_control_style(id) or >>
if m.customized{$c := appearance(&styles, m.selected)
c.radius = 14.0
c.border_width = 1.5
c.padding.left += 4.0
c.padding.right += 4.0
s.set_control_style(id, &c) or >> }
}
$spec := widgets.motion_spec()
if m.slow{spec.change = time.milliseconds(420) or >>
spec.hover = time.milliseconds(320) or >>
spec.enter = time.milliseconds(360) or >>
spec.exit = time.milliseconds(240) or >>
spec.curve = widgets.EASE_OUT_QUINT}
if animated(m.selected) {s.set_motion(id, &spec) or >> }
if m.selected == 1 {
handles :=[page.ids[0], page.ids[1], page.ids[2], page.ids[3]]
placements :=[widgets.ICON_LEADING, widgets.ICON_TRAILING, widgets.ICON_ABOVE, widgets.ICON_BELOW]
english := (s.selected(m.language) or >>) == 1
for i in 0:4 {
icon_size := s.number_value(page.ids[9 + i]) or >>
$icon_prefix := "图标 · "
if english {icon_prefix = "Icon · "}
s.set_text(page.ids[13 + i], icon_prefix + str(int(icon_size)) + " px") or >>
$c := styles.button_variant(widgets.BUTTON_OUTLINE) or >>
if i == 0 {c = styles.button_variant(widgets.BUTTON_PRIMARY) or >> }
c.icon_placement = placements[i]
c.icon_size = icon_size * styles.text_scale
if m.customized{c.radius = 14.0
c.border_width = 1.5}
s.set_control_style(handles[i], &c) or >>
s.set_motion(handles[i], &spec) or >>
}
}
if m.selected == 33 || m.selected == 34 || m.selected == 36 {s.set_motion(page.ids[1], &spec) or >>
$c := styles.overlay_style()
if m.customized{c.radius = 18.0
c.border_width = 2.0}
s.set_control_style(page.ids[1], &c) or >> }
if m.selected == 34 {
$placement := widgets.overlay_placement()
placement.side = m.tooltip_side
placement.align = widgets.OVERLAY_CENTER
s.set_tooltip_placement(page.ids[1], &placement) or >>
}
if m.selected == 35 {
s.set_notice_motion(&spec) or >>
if m.customized{$c := styles.overlay_style()
c.radius = 18.0
c.border_width = 2.0
s.set_notice_style(&c) or >> }
else {s.clear_notice_style() or >> }
}
if m.selected == 38 {
$group_appearance := widgets.button_group_appearance()
group_appearance.vertical = m.group_vertical
group_appearance.joined = m.group_joined
for i in 0:3 {s.set_button_group_appearance(page.ids[i], &group_appearance) or >>
s.clear_control_style(page.ids[i]) or >>
s.set_motion(page.ids[i], &spec) or >>
if m.customized{$c := styles.button_variant(widgets.BUTTON_OUTLINE) or >>
c.radius = 12.0
c.border_width = 1.5
s.set_control_style(page.ids[i], &c) or >> }}
}
if m.selected == 39 {
s.clear_control_style(id) or >>
$appearance := chart.chart_appearance()
appearance.y_unit = " ms"
if m.chart_kind == widgets.CHART_DONUT || m.chart_kind == widgets.CHART_PIE || m.chart_kind == widgets.CHART_ROSE ||
m.chart_kind == widgets.CHART_FUNNEL || m.chart_kind == widgets.CHART_TREEMAP || m.chart_kind == widgets.CHART_SANKEY{appearance.y_unit = ""}
else if m.chart_kind == widgets.CHART_GAUGE || m.chart_kind == widgets.CHART_POLAR_BAR{appearance.y_unit = "%"}
if m.customized{appearance.grid = false
appearance.area_opacity = 0.26
appearance.inner_radius = 0.78
appearance.palette =[draw.rgb(41, 126, 178), draw.rgb(215, 146, 42), draw.rgb(56, 153, 124)]
$c := styles.card_style()
c.radius = 18.0
s.set_control_style(id, &c) or >> }
s.set_chart_appearance(id, &appearance) or >>
$options := widgets.animation_options()
options.duration = time.milliseconds(650) or >>
options.curve = widgets.EASE_IN_OUT_CUBIC
if m.slow{options.duration = time.milliseconds(1200) or >> }
s.set_chart_animation(id, &options) or >>
if m.chart_paused{s.pause_chart_animation(id) or >> }
}
if m.selected == 40 {
$options := widgets.range_slider_options()
options.step = 5.0
options.min_distance = 10.0
if m.range_push{options.collision = widgets.RANGE_PUSH}
options.vertical = m.range_vertical
options.commit_only = m.range_commit
s.set_range_options(id, &options) or >>
$appearance := widgets.slider_appearance()
appearance.ticks = 11
appearance.show_value = true
s.set_range_appearance(id, &appearance) or >>
}
if m.selected == 41 {
$options := widgets.split_view_options()
options.vertical = m.split_vertical
options.minimum_first = 120.0 * styles.text_scale
options.minimum_second = 140.0 * styles.text_scale
s.set_split_options(id, &options) or >>
}
if m.selected >= 42 && m.selected <= 44 {
$appearance := widgets.menu_appearance()
appearance.close_on_select = !m.menu_stays_open
s.set_menu_appearance(id, &appearance) or >>
}
if m.selected == 37 {$radius := 8.0
if m.customized{radius = 18.0}
s.set_webview_radius(id, radius) or >> }
<< 0
}
// Business handlers set option flags. Appearance changes run only here.
fn (m $&Workshop) apply_page_options(s $&widgets.Screen) int {
if m.tree_options_dirty{
$appearance := widgets.tree_appearance()
appearance.guides = m.guided
s.set_tree_appearance(m.pages[7].ids[0], &appearance) or >>
m.tree_options_dirty = false
}
if m.field_options_dirty{
$decoration := widgets.field_decoration(&"Project name 项目名称")
decoration.variant =(m.variant - 1) % 3
decoration.floating =(m.variant - 1) % 4
decoration.helper = "Floating / fixed label and stable helper area"
decoration.error = "Please enter a valid name."
decoration.clearable = true
s.set_field_decoration(m.pages[m.field_options_page].ids[0], &decoration) or >>
m.field_options_dirty = false
}
if m.spinner_options_dirty{
s.set_spinner_appearance(m.pages[28].ids[0], 48.0, 4.0, time.milliseconds(1200) or >>) or >>
m.spinner_options_dirty = false
}
if m.popover_options_dirty{
$placement := widgets.overlay_placement()
placement.side = m.variant
placement.align = widgets.OVERLAY_CENTER
s.set_popover_placement(m.pages[33].ids[1], &placement) or >>
m.popover_options_dirty = false
}
<< 0
}@main
#ui
#ui/widgets
#ui/chart
#ui/draw
#time
#math
fn names()[]string { << names_locale(true) }
fn names_locale(english bool)[]string {
if english {
<<["StyledLabel", "Button", "IconButton", "Input", "TextArea", "Field", "FieldArea", "TreeView", "TaskButton", "Checkbox", "Switch", "Radio", "RadioGroup", "Slider", "Stepper", "Select", "ComboBox", "MultiSelect", "DatePicker", "TimePicker", "ColorPicker", "Tabs", "Segmented", "ListBox", "Table", "Pagination", "Breadcrumbs", "Progress", "Spinner", "Divider", "Badge", "Card", "Scroll", "Popover", "Tooltip", "ToastHost", "Modal", "WebView", "ButtonGroup", "Chart", "RangeSlider", "SplitView", "Menu", "ContextMenu", "SplitButton", "PasswordInput"]
}
<<["StyledLabel 文本", "Button 按钮", "IconButton 图标按钮", "Input 单行输入", "TextArea 多行输入", "Field 表单字段", "FieldArea 多行字段", "TreeView 树形视图", "TaskButton 任务按钮", "Checkbox 复选框", "Switch 开关", "Radio 单选框", "RadioGroup 单选组", "Slider 滑块", "Stepper 步进器", "Select 下拉选择", "ComboBox 组合框", "MultiSelect 多选框", "DatePicker 日期选择", "TimePicker 时间选择", "ColorPicker 颜色选择", "Tabs 标签页", "Segmented 分段控件", "ListBox 列表框", "Table 数据表格", "Pagination 分页器", "Breadcrumbs 面包屑", "Progress 进度条", "Spinner 加载指示", "Divider 分割线", "Badge 徽标", "Card 卡片", "Scroll 滚动容器", "Popover 气泡浮层", "Tooltip 文字提示", "ToastHost 通知队列", "Modal 模态弹窗", "WebView 网页视图", "ButtonGroup 按钮组", "Chart 图表", "RangeSlider 区间滑块", "SplitView 分栏视图", "Menu 下拉菜单", "ContextMenu 右键菜单", "SplitButton 拆分按钮", "PasswordInput 密码框"]
}
fn new_page(s $&widgets.Screen, index int) Page{
group := s.group() or >>
$ids :=[]int {}
choices :=["Workspace 工作区", "History 历史", "Output 输出"]
if index == 0 {ids.push(s.label("清晰的层级,让每个细节都服务于使用。\n中文、English 与 emoji 👩🏽💻 都使用原生排版。", 20.0, false) or >>)
s.set_label_wrapped(ids[0], true) or >>
ids.push(s.label("很长的完整内容:Cluster-safe truncation · 👨👩👧👦 family · workspace / widgets / component.xu", 16.0, false) or >>)
s.set_label_ellipsis(ids[1], true) or >>
anchor := ids[1]
ids.push(s.tooltip(anchor, "很长的完整内容:Cluster-safe truncation · 👨👩👧👦 family · workspace / widgets / component.xu") or >>)}
if index == 1 {
$sizes :=[]int {}
$labels :=[]int {}
for text in["Build project", "Open workspace · trailing", "Save changes · above", "Download SDK · below"] {
// Each inspector precedes its own button in both layout and Tab order.
inspector := s.stepper(12.0, 64.0, 4.0, 24.0) or >>
sizes.push(inspector)
_ := s.tooltip(inspector, text + " · Icon size 图标尺寸 (px)") or >>
labels.push(s.label("Icon 图标 · 24 px", 14.0, true) or >>)
ids.push(s.button_with_icon("logo.png", text) or >>)}
for text in["Secondary", "Outline", "Ghost", "Danger", "Subtle"] {ids.push(s.button(text) or >>)}
s.set_button_variant(ids[0], widgets.BUTTON_PRIMARY) or >>
for variant in 1:6 {s.set_button_variant(ids[variant + 3], variant) or >> }
for id in sizes{ids.push(id)}
for id in labels{ids.push(id)}}
if index == 2 {ids.push(s.icon_button("logo.png", "Open XU workspace") or >>)
anchor := ids[0]
ids.push(s.tooltip(anchor, "Open XU workspace · Enter") or >>)}
if index == 3 {ids.push(s.input("中文 / English / 🙂") or >>)}
if index == 4 {ids.push(s.text_area("Native text editing\n选择文字、复制、粘贴,保留输入法会话。\n👩🏽💻 family 👨👩👧👦") or >>)}
if index == 5 || index == 6 {
$decoration := widgets.field_decoration(&"Project name 项目名称")
decoration.helper = "Enter a name · Native IME / selection / clipboard"
decoration.error = "名称不能为空。Please enter a project name."
decoration.clearable = true
if index == 5 {decoration.prefix = "xu /"
ids.push(s.field("", &decoration) or >>)}
else {ids.push(s.text_field_area("Build notes\n中文与 emoji 🙂", &decoration) or >>)}
$options := widgets.field_text_options()
options.counter = true
options.character_limit = 32
if index == 6 {options.min_rows = 3
options.max_rows = 6}
s.set_field_text_options(ids[0], &options) or >>
}
if index == 7 {
ids.push(s.tree() or >>)
root := s.tree_add(ids[0], - 1, "XU workspace") or >>
src := s.tree_add(ids[0], root, "src") or >>
widgets_node := s.tree_add(ids[0], src, "widgets") or >>
for name in["tree_view.xu", "task_button.xu", "field.xu", "screen.xu"] {leaf := s.tree_add(ids[0], widgets_node, name) or >>
s.set_tree_metadata(ids[0], leaf, "Xu") or >>
s.set_tree_action(ids[0], leaf, true) or >> }
_ := s.tree_add(ids[0], root, "xu.xun") or >>
for node in[root, src, widgets_node] {s.set_expanded(ids[0], node, true) or >> }
$appearance := widgets.tree_appearance()
appearance.guides = true
s.set_tree_appearance(ids[0], &appearance) or >>
$decoration := widgets.field_decoration(&"Find a node")
decoration.clearable = true
ids.push(s.field("", &decoration) or >>)
}
if index == 8 {ids.push(s.task_button("Build project") or >>)
s.set_task_labels(ids[0], "Building", "Built · run again", "Retry build", "Build again") or >> }
if index == 9 {ids.push(s.checkbox("Keep generated files 保留产物", true) or >>)}
if index == 10 {ids.push(s.switch_control("Live preview 实时预览", true) or >>)}
if index == 11 {ids.push(s.radio("Use workspace settings", 1, true) or >>)}
if index == 12 {ids.push(s.radio_group(&choices, 0) or >>)}
if index == 13 {ids.push(s.slider(0.0, 100.0, 40.0) or >>)
$appearance := widgets.slider_appearance()
appearance.ticks = 11
appearance.show_value = true
s.set_slider_appearance(ids[0], &appearance, 10.0) or >>
s.set_slider_commit_only(ids[0], true) or >>
$decoration := widgets.field_decoration(&"Exact value / 精确数值")
decoration.helper = "0–100 · step 10 · Apply input"
decoration.error = "Enter a number between 0 and 100."
ids.push(s.field("40", &decoration) or >>)}
if index == 14 {ids.push(s.stepper(0.0, 100.0, 1.0, 24.0) or >>)
s.set_stepper_repeat(ids[0], true, time.milliseconds(400) or >>, time.milliseconds(80) or >>) or >> }
if index == 15 {$unavailable := widgets.select_option("Remote (unavailable)")
unavailable.enabled = false
options :=[widgets.select_group("LOCAL"), widgets.select_option("Workspace 工作区"), widgets.select_option("History 历史"), widgets.select_group("REMOTE"), unavailable]
ids.push(s.select_options(&options, 1) or >>)}
if index == 16 {ids.push(s.combo_box(&choices, "") or >>)
s.set_combo_custom_values(ids[0], false) or >> }
if index == 17 {ids.push(s.multi_select(&choices) or >>)
$decoration := widgets.field_decoration(&"Filter options")
decoration.clearable = true
ids.push(s.field("", &decoration) or >>)}
if index == 18 || index == 19 {value := time.date(2026, 10, 25, 14, 30, 0, 0)
if index == 18 {ids.push(s.date_picker(value) or >>)
s.set_date_options(ids[0], value, true) or >> }
else {ids.push(s.time_picker(value) or >>)
s.set_clock_format(ids[0], true, true) or >> }}
if index == 20 {ids.push(s.color_picker(draw.rgb(180, 57, 45)) or >>)
s.set_color_swatches(ids[0], &[draw.rgb(180, 57, 45), draw.rgb(50, 121, 160), draw.rgb(72, 130, 90)]) or >>
$decoration := widgets.field_decoration(&"HEX / RGBA")
decoration.helper = "#RGB, #RGBA, #RRGGBB, #RRGGBBAA"
decoration.error = "Use a valid HEX value."
ids.push(s.field("#B4392DFF", &decoration) or >>)}
if index == 21 {ids.push(s.tabs(&choices, 0) or >>)
s.set_tab_behavior(ids[0], &[180.0, 144.0, 160.0], false) or >> }
if index == 22 {ids.push(s.segmented(&["Day", "Week", "Month"], 0) or >>)}
if index == 23 {ids.push(s.list_box(&["TreeView", "TaskButton", "Field", "Table", "WebView", "Scroll", "Tabs", "Select", "ToastHost"], 0) or >>)
for row in 0:9 {$detail := widgets.list_row(["TreeView", "TaskButton", "Field", "Table", "WebView", "Scroll", "Tabs", "Select", "ToastHost"][row])
detail.description = "Native component · 原生交互"
detail.detail = "Ready"
detail.icon = widgets.TREE_ICON_FILE
s.set_list_row(ids[0], row, &detail) or >> }}
if index == 24 {ids.push(s.table(&["Component", "Build ms", "Status"], 12, 0) or >>)
components :=["Button", "TreeView", "Field", "Input", "Tabs", "Checkbox", "Switch", "Menu", "WebView", "Chart", "Table", "Badge"]
durations :=[14, 7, 120, 3, 21, 7, 45, 9, 210, 32, 18, 2]
for row in 0:12 {s.set_cell(ids[0], row, 0, components[row]) or >>
s.set_cell(ids[0], row, 1, str(durations[row])) or >>
s.set_cell(ids[0], row, 2,["Ready", "Review", "Draft"][row % 3]) or >> }
s.set_table_sort_kind(ids[0], 1, widgets.TABLE_SORT_NUMBER) or >>
s.set_table_column_min_width(ids[0], 0, 160.0) or >>
s.set_table_column(ids[0], 0, 280.0, 0.0) or >>
s.set_table_column(ids[0], 1, 160.0, 1.0) or >>
s.set_table_column(ids[0], 2, 200.0, 0.0) or >> }
if index == 25 {ids.push(s.pagination(1000, 122) or >>)
s.set_pagination_data(ids[0], 20000, 20) or >>
$decoration := widgets.field_decoration(&"Page 页码")
decoration.helper = ""
decoration.error = ""
decoration.reserve_helper = false
decoration.floating = widgets.LABEL_ALWAYS
ids.push(s.field("123", &decoration) or >>)
ids.push(s.select_box(&["10 / page", "20 / page", "50 / page", "100 / page"], 1) or >>)
ids.push(s.label("", 14.0, true) or >>)
s.set_label_wrapped(ids[3], true) or >>
ids.push(s.button("Go 跳转") or >>)
ids.push(s.label("", 13.0, true) or >>)
s.set_label_wrapped(ids[5], true) or >> }
if index == 26 {ids.push(s.breadcrumbs(&["Home", "XU workspace", "src", "ui", "widgets", "A long Chinese path 中文路径", "field.xu"]) or >>)}
if index == 27 {ids.push(s.progress(0.42) or >>)
s.set_progress_buffer(ids[0], 0.72) or >> }
if index == 28 {ids.push(s.spinner() or >>)
s.set_spinner_appearance(ids[0], 32.0, 3.0, time.milliseconds(900) or >>) or >>
s.set_running(ids[0], true) or >>
ids.push(s.label("Loading assets… 正在加载", 14.0, true) or >>)}
if index == 29 {ids.push(s.divider(widgets.AXIS_HORIZONTAL) or >>)
ids.push(s.label("SECTION / 章节", 12.0, true) or >>)}
if index == 30 {
inbox := s.button("Inbox 收件箱") or >>
count := s.badge_on(inbox, "12", widgets.BADGE_COUNT) or >>
s.set_badge_tone(count, widgets.BADGE_ERROR) or >>
avatar := s.button("LW") or >>
s.set_button_variant(avatar, widgets.BUTTON_SUBTLE) or >>
dot := s.badge_on(avatar, "", widgets.BADGE_DOT) or >>
s.set_badge_anchor(dot, avatar, 0.86, 0.86) or >>
s.set_badge_tone(dot, widgets.BADGE_SUCCESS) or >>
synced := s.badge("Synced 已同步") or >>
s.set_badge_tone(synced, widgets.BADGE_SUCCESS) or >>
beta := s.badge("BETA") or >>
s.set_badge_tone(beta, widgets.BADGE_INFO) or >>
ids =[count, inbox, avatar, dot, synced, beta,
s.label("12 unread · 点击收件箱清零,徽标随数字收紧。", 14.0, true) or >>,
s.label("林文 · Available 在线", 16.0, false) or >>,
s.label("点击头像切换在线状态;状态点不单独承担文字含义。", 13.0, true) or >>,
s.label("Workspace 工作区", 16.0, false) or >>]
}
if index == 31 {
ids.push(s.card() or >>)
sections := s.card_sections(ids[0], 36.0, 44.0) or >>
for parent in[sections.header, sections.body, sections.footer] {ids.push(parent)}
ids.push(s.label("Workspace configuration", 18.0, false) or >>)
ids.push(s.label("Header, body and footer keep distinct spacing.\n正文区域随密度与字号调整。", 14.0, true) or >>)
s.set_label_wrapped(ids[5], true) or >>
ids.push(s.button("Open workspace") or >>)
s.set_parent(ids[4], sections.header) or >>
s.set_parent(ids[5], sections.body) or >>
s.set_parent(ids[6], sections.footer) or >>
}
if index == 32 {ids.push(s.scroll_area(widgets.AXIS_VERTICAL, 1100.0) or >>)
for row in 0:14 {id := s.button("Focusable row " + str(row + 1) + " · 滚动内容") or >>
s.set_parent(id, ids[0]) or >>
ids.push(id)}}
if index >= 33 && index <= 36 {ids.push(s.button(["Open popover", "Focus or hover for help", "Enqueue notification", "Open confirmation"][index - 33]) or >>)
anchor := ids[0]
if index == 33 {
ids.push(s.popover(anchor, "") or >>)
ids.push(s.label("Workspace preferences", 18.0, false) or >>)
ids.push(s.label("Edit a draft, then apply. Escape or clicking outside dismisses.\n编辑草稿后应用;关闭不会提交。", 13.0, true) or >>)
s.set_label_wrapped(ids[3], true) or >>
$decoration := widgets.field_decoration(&"Workspace name 工作区名称")
decoration.clearable = true
decoration.error = "名称不能为空 / Enter a name"
ids.push(s.field("XU workspace", &decoration) or >>)
ids.push(s.checkbox("Keep history 保留历史", true) or >>)
ids.push(s.button("Cancel 取消") or >>)
ids.push(s.button("Apply 应用") or >>)
s.set_button_variant(ids[7], widgets.BUTTON_PRIMARY) or >>
ids.push(s.label("Current: XU workspace · history on", 14.0, true) or >>)
for i in 2:8 {s.set_parent(ids[i], ids[1]) or >> }
}
if index == 34 {ids.push(s.tooltip(anchor, "Hover waits 500 ms; keyboard focus shows help immediately.\n鼠标离开或点击收起;Escape 抑制重复提示。") or >>)}
if index == 36 {ids.push(s.modal("Apply configuration?", "Focus stays inside this confirmation. Escape returns to the trigger.") or >>)
ids.push(s.button("Cancel") or >>)
ids.push(s.button("Apply changes") or >>)
s.set_parent(ids[2], ids[1]) or >>
s.set_parent(ids[3], ids[1]) or >> }
}
if index == 37 {ids.push(s.webview() or >>)
s.load_web_html(ids[0], "<!doctype html><html><meta charset='utf-8'><style>body{font:16px system-ui;background:#f3f2ee;color:#292c30;padding:24px}input{font:inherit;padding:12px;border:1px solid #747b83;border-radius:6px;width:80%}h2{font-weight:500}</style><h2>WebView is a component.</h2><p>Native focus, clipping and independent lifecycle.</p><input aria-label='Web content' placeholder='中文 / English / 🙂'></html>") or >> }
if index == 38 {
actions :=[widgets.button_group_item(10, "Undo"), widgets.button_group_item(20, "Redo"), widgets.button_group_item(30, "Save")]
group_choices :=[widgets.button_group_item(10, "Day"), widgets.button_group_item(20, "Week"), widgets.button_group_item(30, "Month")]
formats :=[widgets.button_group_item(10, "Bold"), widgets.button_group_item(20, "Italic"), widgets.button_group_item(30, "Underline")]
ids.push(s.button_group(&actions, widgets.BUTTON_GROUP_ACTIONS) or >>)
ids.push(s.button_group(&group_choices, widgets.BUTTON_GROUP_SINGLE) or >>)
ids.push(s.button_group(&formats, widgets.BUTTON_GROUP_MULTIPLE) or >>)
ids.push(s.label("Actions / 独立操作", 12.0, true) or >>)
ids.push(s.label("Single / 单选", 12.0, true) or >>)
ids.push(s.label("Multiple / 多选", 12.0, true) or >>)
}
if index == 39 {
ids.push(s.chart() or >>)
row0 :=[widgets.button_group_item(1, "Line"), widgets.button_group_item(2, "Area"), widgets.button_group_item(3, "Bar"), widgets.button_group_item(4, "Scatter"), widgets.button_group_item(5, "Donut")]
row1 :=[widgets.button_group_item(6, "Step"), widgets.button_group_item(7, "StackArea"), widgets.button_group_item(8, "StackBar"), widgets.button_group_item(9, "H-Bar"), widgets.button_group_item(10, "Pie")]
row2 :=[widgets.button_group_item(11, "Rose"), widgets.button_group_item(12, "Radar"), widgets.button_group_item(13, "Gauge"), widgets.button_group_item(14, "Bubble"), widgets.button_group_item(15, "Histogram")]
row3 :=[widgets.button_group_item(16, "Boxplot"), widgets.button_group_item(17, "Heatmap"), widgets.button_group_item(18, "Candle"), widgets.button_group_item(19, "Waterfall"), widgets.button_group_item(20, "Funnel")]
row4 :=[widgets.button_group_item(21, "Spline"), widgets.button_group_item(22, "SplineArea"), widgets.button_group_item(23, "PolarBar"), widgets.button_group_item(24, "Treemap"), widgets.button_group_item(25, "Sankey")]
row5 :=[widgets.button_group_item(26, "Violin"), widgets.button_group_item(27, "Bullet"), widgets.button_group_item(28, "Lollipop"), widgets.button_group_item(29, "Dumbbell"), widgets.button_group_item(30, "Pareto")]
$selector := widgets.button_group_appearance()
selector.equal_width = true
selector.allow_empty = true
rows :=[row0, row1, row2, row3, row4, row5]
for r in 0:6 {
gid := s.button_group(&rows[r], widgets.BUTTON_GROUP_SINGLE) or >>
s.set_button_group_appearance(gid, &selector) or >>
ids.push(gid)
}
series := chart_data(widgets.CHART_LINE, 0)
s.set_chart_series(ids[0], &series) or >>
}
if index == 40 {
ids.push(s.range_slider(0.0, 100.0, 20.0, 80.0) or >>)
ids.push(s.label("20 – 80", 18.0, false) or >>)
ids.push(s.label("Drag either thumb or the selected band. Tab visits both thumbs. Escape cancels a pending edit.\n拖动端点或整段;Tab 访问两个端点。", 14.0, true) or >>)
s.set_label_wrapped(ids[2], true) or >>
}
if index == 41 {
ids.push(s.split_view(0.4) or >>)
split := ids[0]
ids.push(s.split_pane(split, 0) or >>)
ids.push(s.split_pane(split, 1) or >>)
ids.push(s.label("Workspace / 工作区\nPane content follows the available size.", 16.0, false) or >>)
ids.push(s.label("Preview / 预览\nDrag the handle; arrows adjust, Shift accelerates.", 16.0, false) or >>)
ids.push(s.button("Open workspace") or >>)
ids.push(s.button("Refresh preview") or >>)
for i in 0:2 {s.set_label_wrapped(ids[3 + i], true) or >>
s.set_parent(ids[3 + i], ids[1 + i]) or >>
s.set_parent(ids[5 + i], ids[1 + i]) or >> }
}
if index >= 42 && index <= 44 {
mode :=[widgets.MENU_DROPDOWN, widgets.MENU_CONTEXT, widgets.MENU_SPLIT][index - 42]
label :=["Actions", "Right click here · 右键打开菜单", "Save"][index - 42]
ids.push(s.menu(label, &workshop_menu_items(true), mode, 100) or >>)
ids.push(s.label("Choose an action · 选择操作", 16.0, false) or >>)
ids.push(s.label("Check and radio items preserve their state. Navigate submenus with arrows; Escape returns one level.\n操作文案与快捷键由应用配置。", 14.0, true) or >>)
s.set_label_wrapped(ids[1], true) or >>
s.set_label_wrapped(ids[2], true) or >>
}
if index == 45 {
ids.push(s.password_input("Xu-密码🙂") or >>)
ids.push(s.checkbox("Show password 显示密码", false) or >>)
ids.push(s.label("Password 密码", 15.0, false) or >>)
ids.push(s.label("Paste is supported. Copy and cut are blocked even when revealed.\n支持粘贴、选择和中英文输入;显隐切换保留内容与光标。", 14.0, true) or >>)
s.set_label_wrapped(ids[3], true) or >>
}
for i in 0:ids.len{
// Card slots and scroll children retain their content parent.
if index == 30 &&(i == 0 || i == 3) { -> }
if index == 31 && i > 0 { -> }
if index == 41 && i > 0 { -> }
if index == 32 && i > 0 { -> }
if index == 36 && i > 1 { -> }
if index == 33 && i >= 2 && i <= 7 { -> }
s.set_parent(ids[i], group) or >>
}
s.set_visible(group, false) or >>
<< Page{group: group, ids: ids}
}
fn description(index int) string { << description_locale(index, false) }
fn description_locale(index int, english bool) string {
if english {
if index == 45 { << "Unicode grapheme masking; reveal toggle, native editing, read-only and disabled states; copy/cut blocked."}
if index == 40 { << "Dual-thumb range: step, minimum distance, clamp/push, band dragging; independent focus and commit."}
if index == 41 { << "Resizable split panes: minimum constraints, collapse/restore, keyboard adjustment; content clipped per pane."}
if index >= 42 && index <= 44 { << "Action / check / radio / submenu items; keyboard navigation, edge flipping, shortcuts and per-item feedback."}
if index == 38 { << "Actions / single / multiple selection; per-item disable, arrow navigation, Enter or Space activation."}
if index == 39 { << "Native interactive charts (30 types): stable-ID transitions, hover/select, legend; Ctrl/⌘ + wheel zoom, drag pan, double-click reset."}
en :=["Layered body, heading and muted text; native line wrapping and font overrides.",
"Leading / trailing / above / below icons; independent size steppers and content-width wrapping.",
"Standalone hit target and action label; keyboard focus also triggers tooltip help.",
"Native single-line editing: selection, copy, paste and IME composition.",
"Native multi-line editing: paragraphs, internal scrolling and IME candidate placement.",
"Floating / fixed labels and three border variants; soft counter never truncates input.",
"Multi-line Field: min 3 rows, max 6 rows; character counter and stable helper region.",
"Hierarchy guides, vector arrows, icons, metadata, filtering and node actions.",
"Real compute batches drive progress; task ID rejects stale callbacks.",
"Full-row click target; indeterminate mixed state; interruptible check animation.",
"Track and thumb transition; interruptible rapid toggling; read-only preserves focus.",
"Single radio item and selection animation; full label hit target.",
"Arrow keys manage mutual exclusion; Tab enters the group once.",
"11 ticks, step-10 snapping, value readout; commit on release.",
"Hold to repeat and accelerate; stops cleanly at bounds.",
"Typed groups and disabled options; arrow keys skip non-selectable rows.",
"Local match highlighting and empty state; configurable free-text input.",
"Candidate filtering, removable tags, select-all and clear actions.",
"Today / Clear actions; Page Up/Down switches months, Shift switches years.",
"12/24-hour clock format; stores explicit typed time values.",
"RGBA channels, exact HEX input, swatches and recent color history.",
"Variable-width tabs; arrow keys move focus, Enter activates manually.",
"Segmented selection plate and container semantics distinct from Tabs.",
"Icon / primary & secondary text / trailing detail; hit testing scales with font size.",
"Resizable columns, horizontal & vertical scrolling, and data status messages.",
"First, last and ellipsis items; fast page jumping for large datasets.",
"Preserves current path; middle segments collapse into an interactive menu.",
"Determinate progress and buffer shown separately without fabricated percentages.",
"Configurable size, stroke width and period; static feedback under reduced motion.",
"Subtle divider paired with section heading; unified horizontal and vertical spec.",
"Badges in context: unread count, avatar status dot and status tags.",
"Header / body / footer content slots; actions use standalone Buttons.",
"True child clipping, wheel bubbling, track dragging and keyboard focus scroll-into-view.",
"Anchor placement and edge flipping; outside click or Escape dismisses.",
"Hover delay and immediate focus help; Escape suppresses repeated tooltips.",
"Up to three visible notices; queueing, deduplication, priority and undo action.",
"Modal focus loop and restoration; safe action receives initial focus.",
"Native webview child component with clipping and independent lifecycle."]
<< en[index]
}
if index == 45 { << "按 Unicode 字素掩码;显隐切换、原生编辑、只读与禁用,禁止复制或剪切密码。"}
if index == 40 { << "双端区间:步进、最小间距、端点推挤、整段拖动;独立焦点与提交。"}
if index == 41 { << "可调整分栏:尺寸约束、折叠恢复、键盘调整;内容保持在各自面板内。"}
if index >= 42 && index <= 44 { << "动作 / 勾选 / 单选 / 子菜单;键盘、边缘翻转、快捷键与可定制的逐项反馈。"}
if index == 38 { << "独立操作 / 单选 / 多选;逐项禁用,方向键导航,Enter 或空格激活。"}
if index == 39 { << "原生交互图表(30 种类型):稳定 ID 数据过渡、悬停/选中、图例;Ctrl/⌘ + 滚轮缩放,拖动平移,双击复位。"}
descriptions :=["正文、标题与辅助文字分层;原生换行与字体覆盖。",
"图标左 / 右 / 上 / 下;各自调节尺寸,按钮按内容宽度自动换行。",
"独立点击目标与动作名称;键盘焦点也能查看提示。",
"原生单行编辑:选区、复制、粘贴与 IME。",
"原生多行编辑:段落、内部滚动与输入法候选定位。",
"浮动标签 / 固定标签 / 三种边框;软计数不截断输入。",
"多行 Field:最小 3 行、最大 6 行;计数与稳定辅助区。",
"层级引导、矢量箭头、图标、元数据、筛选和节点动作。",
"真实计算批次驱动进度;任务 ID 拒绝旧回调。",
"整行点击;混合态;可中断的勾选显现。",
"轨道与圆钮过渡;快速切换可中断;只读保留焦点。",
"单项选择与选中动效;完整标签点击目标。",
"方向键管理互斥;Tab 只进入一次。",
"11 个刻度、10 步吸附、数值提示;松开才提交。",
"按住连续增加并加速;到达边界停止。",
"有类型的分组 / 禁用选项;方向键跳过不可选行。",
"本地匹配高亮与无结果;可控制是否接受自由输入。",
"候选筛选、可移除标签、全选和清空。",
"今天 / 清空;Page Up/Down 快速翻月,Shift 切年。",
"12/24 小时可选;存储保持明确的时间值。",
"RGBA 通道、HEX 精确输入、色板与最近颜色。",
"可变宽标签;方向键移动,Enter 手动激活。",
"与 Tabs 分开的选中底板和容器语义。",
"图标 / 主副文本 / 尾部信息;字体放大后命中保持一致。",
"拖动调整列宽;横向与纵向滚动;数据状态文字。",
"首页、末页与省略项;大页数仍可快速定位。",
"保留当前路径;中间段收进可交互的菜单。",
"真实确定进度与缓冲区分别显示,不伪造百分比。",
"大小 / 粗细 / 周期可配置;减少动效显示静态反馈。",
"弱分隔与章节文字组合;水平和垂直使用同一规范。",
"Badge 放入真实上下文:未读计数、头像状态点与列表标签。",
"Header / body / footer 内容槽;动作使用独立 Button。",
"真实子控件裁剪、滚轮冒泡、轨道拖动与键盘焦点滚入。",
"锚点定位、边缘翻转;外点 / Escape 关闭。",
"Hover 延迟、focus 立即显示;Escape 抑制重复提示。",
"最多三条可见通知;队列、去重、优先级与撤销动作。",
"模态焦点循环与恢复;安全动作先获得焦点。",
"原生网页子视图作为 Screen 组件,支持裁剪与独立生命周期。"]
<< descriptions[index]
}
fn tool_labels(index int)[]string { << tool_labels_locale(index, false) }
fn tool_labels_locale(index int, english bool)[]string {
if english {
if index == 45 { <<["Clear", "Reset sample", "Focus input"]}
if index == 40 { <<["Clamp / push", "Commit mode", "Orientation"]}
if index == 41 { <<["Orientation", "Collapse / restore", "Reset ratio"]}
if index >= 42 && index <= 44 { <<["Open menu", "Keep open", "Disable export"]}
if index == 38 { <<["Disable middle", "Orientation", "Joined / gap"]}
if index == 39 { <<["Update data", "Reset zoom", "Pause / resume"]}
if index == 0 { <<["Long text", "Short text", ""]}
if index == 1 || index == 2 { <<["Select", "Clear selection", ""]}
if index == 3 || index == 4 { <<["Clear", "Long text", ""]}
if index == 5 || index == 6 { <<["Clear", "Long text", "Appearance"]}
if index == 7 { <<["Guides", "Reveal last", "Clear filter"]}
if index == 8 { <<["Progress mode", "Fail next", "Cancel"]}
if index == 9 { <<["Mixed", "Checked", "Unchecked"]}
if index == 10 { <<["Pending", "Resolve", "Fail"]}
if index == 11 { <<["Select", "Deselect", ""]}
if index == 13 { <<["Apply input", "Commit only", "Live updates"]}
if index == 15 { <<["Open", "Disable option", ""]}
if index == 16 { <<["Allow custom", "Options only", "Clear"]}
if index == 17 { <<["Select all", "Clear", ""]}
if index == 18 { <<["Clear", "Set today", ""]}
if index == 19 { <<["12 hour", "24 hour", "Hide seconds"]}
if index == 20 { <<["Apply HEX", "Cinnabar", "Transparent"]}
if index == 24 { <<["Data", "Loading", "Error"]}
if index == 25 { <<["Jump", "Last page", "Empty / full"]}
if index == 27 { <<["0%", "42%", "100%"]}
if index == 28 { <<["Start", "Stop", "Large size"]}
if index == 30 { <<["+1 unread", "Clear", "99+ overflow"]}
if index == 32 { <<["Scroll top", "Scroll bottom", "Focus last"]}
if index == 33 { <<["Open", "Close", "Placement"]}
if index == 34 { <<["Focus help", "Blur", "Placement"]}
if index == 35 { <<["Enqueue", "Undo", "Burst 3"]}
if index == 36 { <<["Open", "Close", ""]}
if index == 37 { <<["Reload", "Hide", "Show"]}
<<["", "", ""]
}
if index == 45 { <<["清空", "重置示例", "聚焦输入"]}
if index == 40 { <<["端点限制 / 推挤", "提交模式", "切换方向"]}
if index == 41 { <<["切换方向", "折叠 / 恢复", "复位比例"]}
if index >= 42 && index <= 44 { <<["打开菜单", "保持展开", "禁用导出"]}
if index == 38 { <<["逐项禁用", "切换方向", "拼接 / 间距"]}
if index == 39 { <<["更新数据", "复位缩放", "暂停 / 继续"]}
if index == 0 { <<["切换长文", "切换短文", ""]}
if index == 1 || index == 2 { <<["设为选中", "取消选中", ""]}
if index == 3 || index == 4 { <<["清空内容", "填充长文", ""]}
if index == 5 || index == 6 { <<["清空内容", "填充长文", "切换外观"]}
if index == 7 { <<["引导线", "定位末项", "清空筛选"]}
if index == 8 { <<["进度外观", "下次失败", "取消任务"]}
if index == 9 { <<["混合态", "勾选", "取消勾选"]}
if index == 10 { <<["等待态", "完成切换", "失败恢复"]}
if index == 11 { <<["选中", "取消选中", ""]}
if index == 13 { <<["应用输入", "松开提交", "实时更新"]}
if index == 15 { <<["展开候选", "禁用选项", ""]}
if index == 16 { <<["允许自由输入", "仅限选项", "清空"]}
if index == 17 { <<["全选", "清空", ""]}
if index == 18 { <<["清空日期", "设为今天", ""]}
if index == 19 { <<["12 小时制", "24 小时制", "隐藏秒数"]}
if index == 20 { <<["应用 HEX", "朱砂色", "半透明"]}
if index == 24 { <<["正常数据", "正在加载", "加载错误"]}
if index == 25 { <<["页码跳转", "跳至末页", "空 / 满数据"]}
if index == 27 { <<["0%", "42%", "100%"]}
if index == 28 { <<["开始旋转", "停止旋转", "切换大号"]}
if index == 30 { <<["+1 未读", "清零未读", "99+ 溢出"]}
if index == 32 { <<["滚至顶部", "滚至底部", "聚焦末项"]}
if index == 33 { <<["打开浮层", "关闭浮层", "切换方位"]}
if index == 34 { <<["聚焦提示", "移出隐藏", "切换方位"]}
if index == 35 { <<["发送通知", "撤销通知", "连发三条"]}
if index == 36 { <<["打开确认框", "关闭确认框", ""]}
if index == 37 { <<["重新加载", "隐藏视图", "恢复显示"]}
<<["", "", ""]
}
fn workshop_menu_items(english bool)[]widgets.MenuItem{
labels :=["Open workspace", "Show grid", "Export", "PNG image", "SVG image", "Unavailable", "Save", "View density", "Compact", "Comfortable"]
$translated := labels
if !english{translated =["打开工作区", "显示网格", "导出", "PNG 图片", "SVG 图片", "暂不可用", "保存", "视图密度", "紧凑", "舒适"]}
$grid := widgets.menu_item(20, translated[1])
grid.kind = widgets.MENU_CHECK
$export := widgets.menu_item(30, translated[2])
export.kind = widgets.MENU_SUBMENU
$png := widgets.menu_item(31, translated[3])
png.parent = 30
$svg := widgets.menu_item(32, translated[4])
svg.parent = 30
$unavailable := widgets.menu_item(40, translated[5])
unavailable.enabled = false
$save := widgets.menu_item(50, translated[6])
save.shortcut_key = 115
save.shortcut_modifiers = ui.MOD_META
save.shortcut_label = "⌘S"
$separator := widgets.menu_item(60, "")
separator.kind = widgets.MENU_SEPARATOR
$heading := widgets.menu_item(70, translated[7])
heading.kind = widgets.MENU_HEADING
$compact := widgets.menu_item(80, translated[8])
compact.kind = widgets.MENU_RADIO
compact.radio_group = 1
$comfortable := widgets.menu_item(81, translated[9])
comfortable.kind = widgets.MENU_RADIO
comfortable.radio_group = 1
comfortable.checked = true
<<[widgets.menu_item(10, translated[0]), grid, export, png, svg, unavailable, save, separator, heading, compact, comfortable]
}
fn chart_data(kind int, revision int)[]chart.ChartSeries{
<< chart_data_locale(kind, revision, true)
}
fn chart_data_locale(kind int, revision int, english bool)[]chart.ChartSeries{
$result :=[]chart.ChartSeries{}
$series_count := 2
single := kind == widgets.CHART_DONUT || kind == widgets.CHART_PIE || kind == widgets.CHART_ROSE ||
kind == widgets.CHART_GAUGE || kind == widgets.CHART_HISTOGRAM || kind == widgets.CHART_BOXPLOT ||
kind == widgets.CHART_CANDLESTICK || kind == widgets.CHART_WATERFALL || kind == widgets.CHART_FUNNEL ||
(kind >= widgets.CHART_POLAR_BAR && kind <= widgets.CHART_SANKEY) || kind == widgets.CHART_VIOLIN ||
kind == widgets.CHART_BULLET || kind == widgets.CHART_DUMBBELL || kind == widgets.CHART_PARETO
if single{series_count = 1}
if kind == widgets.CHART_HEATMAP{series_count = 3}
for si in 0:series_count{
$name := "构建"
if si == 1 {name = "索引"}
if si == 2 {name = "绘制"}
if single{name = "工作量"}
if english {
name = "Build"
if si == 1 {name = "Index"}
if si == 2 {name = "Render"}
if single{name = "Workload"}
}
$series := chart.chart_series(si + 1, name, kind)
series.smooth = kind == widgets.CHART_LINE || kind == widgets.CHART_AREA || kind == widgets.CHART_STACKED_AREA ||
kind == widgets.CHART_SMOOTH_LINE || kind == widgets.CHART_SMOOTH_AREA
$count := 12 - revision % 2
if kind == widgets.CHART_SCATTER{count = 64}
else if kind == widgets.CHART_BUBBLE{count = 16}
else if kind == widgets.CHART_DONUT || kind == widgets.CHART_PIE || kind == widgets.CHART_ROSE ||
kind == widgets.CHART_FUNNEL || kind == widgets.CHART_TREEMAP || kind == widgets.CHART_SANKEY{count = 5}
else if kind == widgets.CHART_RADAR || kind == widgets.CHART_PARETO{count = 6}
else if kind == widgets.CHART_GAUGE{count = 3}
else if kind == widgets.CHART_POLAR_BAR{count = 4}
else if kind == widgets.CHART_HORIZONTAL_BAR || kind == widgets.CHART_HEATMAP || kind == widgets.CHART_BULLET ||
kind == widgets.CHART_LOLLIPOP || kind == widgets.CHART_DUMBBELL || kind == widgets.CHART_VIOLIN{count = 8}
else if kind == widgets.CHART_WATERFALL{count = 7}
for i in 0:count{
x := f64(i + 1)
phase := f64(revision) * 0.9 + f64(si) * 1.7
$y := 48.0 + f64(si) * 20.0 + math.sin(x * 0.55 + phase) * 20.0 + math.cos(x * 0.17 + phase) * 7.0
if kind == widgets.CHART_FUNNEL || kind == widgets.CHART_PARETO || kind == widgets.CHART_TREEMAP || kind == widgets.CHART_SANKEY{
y = f64((count - i) * 22 + (revision % 3) * 4)
} else if kind == widgets.CHART_GAUGE || kind == widgets.CHART_POLAR_BAR{
y = math.max(12.0, math.min(96.0, 34.0 + f64(i) * 18.0 + math.sin(phase + x) * 14.0))
} else if kind == widgets.CHART_WATERFALL{
deltas :=[42.0, 18.0, 0.0 - 14.0, 24.0, 0.0 - 11.0, 16.0, 0.0]
y = deltas[i] + math.sin(phase) * 3.0
if i == count - 1 {y = 0.0}
}
$point := chart.chart_point(i + 1, x, y)
if kind == widgets.CHART_BUBBLE{
point = chart.chart_bubble_point(i + 1, x, y, 12.0 + math.abs(math.cos(x * 0.7 + phase)) * 36.0)
} else if kind == widgets.CHART_BOXPLOT || kind == widgets.CHART_CANDLESTICK ||
kind == widgets.CHART_VIOLIN || kind == widgets.CHART_DUMBBELL || kind == widgets.CHART_BULLET{
$close := y + math.sin(x * 0.9 + phase) * 12.0
if (kind == widgets.CHART_BOXPLOT || kind == widgets.CHART_VIOLIN || kind == widgets.CHART_DUMBBELL || kind == widgets.CHART_BULLET) && close < y{
close = y + 10.0
}
low := math.min(y, close) - 8.0 - math.abs(math.cos(x + phase)) * 6.0
high := math.max(y, close) + 8.0 + math.abs(math.sin(x + phase)) * 6.0
point = chart.chart_range_point(i + 1, x, y, low, high, close)
} else if kind == widgets.CHART_WATERFALL && i == count - 1 {
point.size = 1.0
}
if english {
point.label = "Sample " + str(i + 1)
if kind == widgets.CHART_DONUT || kind == widgets.CHART_PIE || kind == widgets.CHART_ROSE ||
kind == widgets.CHART_FUNNEL || kind == widgets.CHART_TREEMAP || kind == widgets.CHART_SANKEY{
point.label =["Compile", "Index", "Render", "I/O", "Other"][i]
} else if kind == widgets.CHART_RADAR{
point.label =["Throughput", "Latency", "Memory", "Startup", "Cache", "Binary"][i]
} else if kind == widgets.CHART_GAUGE{
point.label =["CPU", "Memory", "Cache"][i]
} else if kind == widgets.CHART_POLAR_BAR{
point.label =["Core 0", "Core 1", "Core 2", "Core 3"][i]
} else if kind == widgets.CHART_WATERFALL && i == count - 1 {
point.label = "Total"
}
} else {
point.label = "样本 " + str(i + 1)
if kind == widgets.CHART_DONUT || kind == widgets.CHART_PIE || kind == widgets.CHART_ROSE ||
kind == widgets.CHART_FUNNEL || kind == widgets.CHART_TREEMAP || kind == widgets.CHART_SANKEY{
point.label =["编译", "索引", "绘制", "输入输出", "其他"][i]
} else if kind == widgets.CHART_RADAR{
point.label =["吞吐量", "延迟", "内存", "启动", "缓存", "体积"][i]
} else if kind == widgets.CHART_GAUGE{
point.label =["处理器", "内存", "缓存"][i]
} else if kind == widgets.CHART_POLAR_BAR{
point.label =["核心 0", "核心 1", "核心 2", "核心 3"][i]
} else if kind == widgets.CHART_WATERFALL && i == count - 1 {
point.label = "总计"
}
}
series.points.push(point)
}
result.push(series)
}
<< result
}const CHART_LINEpub const CHART_LINE = 0Constant CHART_LINE, defining protocol or algorithm parameters.
const CHART_AREApub const CHART_AREA = 1Constant CHART_AREA, defining protocol or algorithm parameters.
const CHART_BARpub const CHART_BAR = 2Constant CHART_BAR, defining protocol or algorithm parameters.
const CHART_SCATTERpub const CHART_SCATTER = 3Constant CHART_SCATTER, defining protocol or algorithm parameters.
const CHART_DONUTpub const CHART_DONUT = 4Constant CHART_DONUT, defining protocol or algorithm parameters.
const CHART_STEP_LINEpub const CHART_STEP_LINE = 5Constant CHART_STEP_LINE, defining protocol or algorithm parameters.
const CHART_STACKED_AREApub const CHART_STACKED_AREA = 6Constant CHART_STACKED_AREA, defining protocol or algorithm parameters.
const CHART_STACKED_BARpub const CHART_STACKED_BAR = 7Constant CHART_STACKED_BAR, defining protocol or algorithm parameters.
const CHART_HORIZONTAL_BARpub const CHART_HORIZONTAL_BAR = 8Constant CHART_HORIZONTAL_BAR, defining protocol or algorithm parameters.
const CHART_PIEpub const CHART_PIE = 9Constant CHART_PIE, defining protocol or algorithm parameters.
const CHART_ROSEpub const CHART_ROSE = 10Constant CHART_ROSE, defining protocol or algorithm parameters.
const CHART_RADARpub const CHART_RADAR = 11Constant CHART_RADAR, defining protocol or algorithm parameters.
const CHART_GAUGEpub const CHART_GAUGE = 12Constant CHART_GAUGE, defining protocol or algorithm parameters.
const CHART_BUBBLEpub const CHART_BUBBLE = 13Constant CHART_BUBBLE, defining protocol or algorithm parameters.
const CHART_HISTOGRAMpub const CHART_HISTOGRAM = 14Constant CHART_HISTOGRAM, defining protocol or algorithm parameters.
const CHART_BOXPLOTpub const CHART_BOXPLOT = 15Constant CHART_BOXPLOT, defining protocol or algorithm parameters.
const CHART_HEATMAPpub const CHART_HEATMAP = 16Constant CHART_HEATMAP, defining protocol or algorithm parameters.
const CHART_CANDLESTICKpub const CHART_CANDLESTICK = 17Constant CHART_CANDLESTICK, defining protocol or algorithm parameters.
const CHART_WATERFALLpub const CHART_WATERFALL = 18Constant CHART_WATERFALL, defining protocol or algorithm parameters.
const CHART_FUNNELpub const CHART_FUNNEL = 19Constant CHART_FUNNEL, defining protocol or algorithm parameters.
const CHART_SMOOTH_LINEpub const CHART_SMOOTH_LINE = 20Constant CHART_SMOOTH_LINE, defining protocol or algorithm parameters.
const CHART_SMOOTH_AREApub const CHART_SMOOTH_AREA = 21Constant CHART_SMOOTH_AREA, defining protocol or algorithm parameters.
const CHART_POLAR_BARpub const CHART_POLAR_BAR = 22Constant CHART_POLAR_BAR, defining protocol or algorithm parameters.
const CHART_TREEMAPpub const CHART_TREEMAP = 23Constant CHART_TREEMAP, defining protocol or algorithm parameters.
const CHART_SANKEYpub const CHART_SANKEY = 24Constant CHART_SANKEY, defining protocol or algorithm parameters.
const CHART_VIOLINpub const CHART_VIOLIN = 25Constant CHART_VIOLIN, defining protocol or algorithm parameters.
const CHART_BULLETpub const CHART_BULLET = 26Constant CHART_BULLET, defining protocol or algorithm parameters.
const CHART_LOLLIPOPpub const CHART_LOLLIPOP = 27Constant CHART_LOLLIPOP, defining protocol or algorithm parameters.
const CHART_DUMBBELLpub const CHART_DUMBBELL = 28Constant CHART_DUMBBELL, defining protocol or algorithm parameters.
const CHART_PARETOpub const CHART_PARETO = 29Constant CHART_PARETO, defining protocol or algorithm parameters.
const ACTION_CHART_HOVERpub const ACTION_CHART_HOVER = 40Constant ACTION_CHART_HOVER, defining protocol or algorithm parameters.
const ACTION_CHART_SELECTpub const ACTION_CHART_SELECT = 41Constant ACTION_CHART_SELECT, defining protocol or algorithm parameters.
const ACTION_CHART_VIEWPORTpub const ACTION_CHART_VIEWPORT = 42Constant ACTION_CHART_VIEWPORT, defining protocol or algorithm parameters.
const ACTION_CHART_LEGENDpub const ACTION_CHART_LEGEND = 43Constant ACTION_CHART_LEGEND, defining protocol or algorithm parameters.
chart_appearancepub fn chart_appearance() chart.ChartAppearanceChart appearance.
No arguments are required.
chart.ChartAppearance — a value of this type
chart_seriespub fn chart_series(id int,name string,kind int) chart.ChartSeriesChart series.
id intname stringkind intchart.ChartSeries — a value of this type
chart_pointpub fn chart_point(id int,x f64,y f64) chart.ChartPointChart point.
id intx f64y f64chart.ChartPoint — a value of this type
chart_domainpub fn chart_domain(x_min f64,x_max f64,y_min f64,y_max f64) chart.ChartDomainChart domain.
x_min f64x_max f64y_min f64y_max f64chart.ChartDomain — a value of this type
const ACTION_NONEpub const ACTION_NONE = 0Persistent control state is separate from text shaping and frame recording. The caller owns the TextLayout and acknowledges paint only after present succeeds.
const ACTION_ACTIVATEpub const ACTION_ACTIVATE = 1Constant ACTION_ACTIVATE, defining protocol or algorithm parameters.
const ACTION_CHANGEpub const ACTION_CHANGE = 2Constant ACTION_CHANGE, defining protocol or algorithm parameters.
const ACTION_SCROLLpub const ACTION_SCROLL = 3Constant ACTION_SCROLL, defining protocol or algorithm parameters.
const ACTION_COMMITpub const ACTION_COMMIT = 8Constant ACTION_COMMIT, defining protocol or algorithm parameters.
struct Actionpub struct Action {
pub kind int
pub id int
pub needs_paint bool
pub request_focus bool
pub consumed bool
pub value f64
}Structure encapsulating kind, id, needs_paint, request_focus, consumed.
kind intid intneeds_paint boolrequest_focus boolconsumed boolvalue f64struct Themepub struct Theme {
pub normal draw.Color
pub hovered draw.Color
pub pressed draw.Color
pub disabled draw.Color
pub foreground draw.Color
pub muted draw.Color
pub accent draw.Color
pub focus draw.Color
}Structure encapsulating normal, hovered, pressed, disabled, foreground.
normal draw.Colorhovered draw.Colorpressed draw.Colordisabled draw.Colorforeground draw.Colormuted draw.Coloraccent draw.Colorfocus draw.Colordefault_themepub fn default_theme() ThemeDefault theme.
No arguments are required.
Theme — a value of this type
belongspub fn belongs(identity &ui.CanvasEvent,input &ui.InputEvent) boolExecute belongs.
identity &ui.CanvasEventinput &ui.InputEventbool — true or false
copy_rectpub fn copy_rect(bounds &layout.Rect) layout.RectCopy rectangle.
bounds &layout.Rectlayout.Rect — a value of this type
copy_identitypub fn copy_identity(identity &ui.CanvasEvent) ui.CanvasEventCopy identity.
identity &ui.CanvasEventui.CanvasEvent — a value of this type
no_actionpub fn no_action(id int,dirty bool) ActionNo action.
id intdirty boolAction — input result with kind, id, repaint and focus requests.
struct Buttonpub struct Button {
}Button context or state structure.
This type has no public fields.
buttonpub fn button(identity &ui.CanvasEvent,id int,bounds &layout.Rect) ButtonExecute button. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.RectButton — a value of this type
(&Button) idpub fn (button &Button) id() intReturn the unique integer ID of the element or control.
button &ButtonButton instance used by this call (borrow).int — a value of this type
(&Button) is_closedpub fn (button &Button) is_closed() boolOperation on &Button: whether it is closed.
button &ButtonButton instance used by this call (borrow).bool — true or false
($&Button) closepub fn (button $&Button) close()Operation on $&Button: close the resource.
button $&ButtonButton instance used by this call (exclusive borrow).This call does not return a value.
(&Button) identitypub fn (button &Button) identity() ui.CanvasEventExecute identity on &Button.
button &ButtonButton instance used by this call (borrow).ui.CanvasEvent — a value of this type
(&Button) needs_paintpub fn (button &Button) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
button &ButtonButton instance used by this call (borrow).bool — true or false
(&Button) is_focusedpub fn (button &Button) is_focused() boolReturn whether the control currently has input focus.
button &ButtonButton instance used by this call (borrow).bool — true or false
(&Button) is_enabledpub fn (button &Button) is_enabled() boolReturn whether the control is currently enabled.
button &ButtonButton instance used by this call (borrow).bool — true or false
(&Button) is_selectablepub fn (button &Button) is_selectable() boolOperation on &Button: whether it is selectable.
button &ButtonButton instance used by this call (borrow).bool — true or false
($&Button) set_selectablepub fn (button $&Button) set_selectable(selectable bool)Operation on $&Button: set selectable.
button $&ButtonButton instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Button) boundspub fn (button &Button) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
button &ButtonButton instance used by this call (borrow).layout.Rect — a value of this type
($&Button) paintedpub fn (button $&Button) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
button $&ButtonButton instance used by this call (exclusive borrow).This call does not return a value.
($&Button) invalidatepub fn (button $&Button) invalidate()Invalidate the control area, requesting a repaint on next frame.
button $&ButtonButton instance used by this call (exclusive borrow).This call does not return a value.
($&Button) cancelpub fn (button $&Button) cancel()Execute cancel on $&Button.
button $&ButtonButton instance used by this call (exclusive borrow).This call does not return a value.
($&Button) set_enabledpub fn (button $&Button) set_enabled(enabled bool)Operation on $&Button: set enabled.
button $&ButtonButton instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&Button) set_focuspub fn (button $&Button) set_focus(focused bool)Operation on $&Button: set focus.
button $&ButtonButton instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&Button) set_boundspub fn (button $&Button) set_bounds(bounds &layout.Rect) intOperation on $&Button: set bounds. Throws on failure; handle the error or propagate it to the caller.
button $&ButtonButton instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&Button) inputpub fn (button $&Button) input(input &ui.InputEvent) ActionProcess button presses, releases and keyboard activation; perform the business action on a completed activation.
button $&ButtonButton instance used by this call (exclusive borrow).input &ui.InputEventAn Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
ACTION_ACTIVATE; read-only buttons do not activate.($&Button) eventpub fn (button $&Button) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
button $&ButtonButton instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
button_sizepub fn button_size(label &draw.TextLayout) layout.SizeButton size.
label &draw.TextLayoutlayout.Size — a value of this type
(&Button) paintpub fn (button &Button) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
button &ButtonButton instance used by this call (borrow).frame $&draw.Framelabel &draw.TextLayouttheme &Themeint — a value of this type
struct Checkboxpub struct Checkbox {
}Checkbox context or state structure.
This type has no public fields.
checkboxpub fn checkbox(identity &ui.CanvasEvent,id int,bounds &layout.Rect,checked bool) CheckboxExecute checkbox. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectchecked boolCheckbox — a value of this type
($&Checkbox) set_focuspub fn (checkbox $&Checkbox) set_focus(focused bool)Operation on $&Checkbox: set focus.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&Checkbox) set_enabledpub fn (checkbox $&Checkbox) set_enabled(enabled bool)Operation on $&Checkbox: set enabled.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&Checkbox) set_boundspub fn (checkbox $&Checkbox) set_bounds(bounds &layout.Rect) intOperation on $&Checkbox: set bounds. Throws on failure; handle the error or propagate it to the caller.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Checkbox) needs_paintpub fn (checkbox &Checkbox) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
($&Checkbox) paintedpub fn (checkbox $&Checkbox) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).This call does not return a value.
(&Checkbox) is_selectablepub fn (checkbox &Checkbox) is_selectable() boolOperation on &Checkbox: whether it is selectable.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
($&Checkbox) set_selectablepub fn (checkbox $&Checkbox) set_selectable(selectable bool)Operation on $&Checkbox: set selectable.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Checkbox) valuepub fn (checkbox &Checkbox) value() boolExecute value on &Checkbox.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
(&Checkbox) is_indeterminatepub fn (checkbox &Checkbox) is_indeterminate() boolOperation on &Checkbox: whether it is indeterminate.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
($&Checkbox) set_indeterminatepub fn (checkbox $&Checkbox) set_indeterminate(mixed bool)Operation on $&Checkbox: set indeterminate.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).mixed boolThis call does not return a value.
($&Checkbox) set_valuepub fn (checkbox $&Checkbox) set_value(checked bool)Set a checkbox's checked state and clear indeterminate state from application data.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).checked boolNo return value; a state change marks repainting without generating a user input action.
($&Checkbox) inputpub fn (checkbox $&Checkbox) input(input &ui.InputEvent) ActionProcess checkbox interaction and update its checked state when activated.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).input &ui.InputEventAn Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
ACTION_CHANGE, with value 1.0 for checked or 0.0 for unchecked; activating an indeterminate box checks it.($&Checkbox) eventpub fn (checkbox $&Checkbox) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Checkbox) paintpub fn (checkbox &Checkbox) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
checkbox &CheckboxCheckbox instance used by this call (borrow).frame $&draw.Framelabel &draw.TextLayouttheme &Themeint — a value of this type
struct Progresspub struct Progress {
}Progress context or state structure.
This type has no public fields.
progresspub fn progress(bounds &layout.Rect,value f64) ProgressExecute progress. Throws on failure; handle the error or propagate it to the caller.
bounds &layout.Rectvalue f64Progress — a value of this type
(&Progress) valuepub fn (progress &Progress) value() f64Execute value on &Progress.
progress &ProgressProgress instance used by this call (borrow).f64 — a value of this type
(&Progress) needs_paintpub fn (progress &Progress) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
progress &ProgressProgress instance used by this call (borrow).bool — true or false
($&Progress) paintedpub fn (progress $&Progress) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
progress $&ProgressProgress instance used by this call (exclusive borrow).This call does not return a value.
(&Progress) is_selectablepub fn (progress &Progress) is_selectable() boolOperation on &Progress: whether it is selectable.
progress &ProgressProgress instance used by this call (borrow).bool — true or false
($&Progress) set_selectablepub fn (progress $&Progress) set_selectable(selectable bool)Operation on $&Progress: set selectable.
progress $&ProgressProgress instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
($&Progress) set_valuepub fn (progress $&Progress) set_value(value f64) intOperation on $&Progress: set value. Throws on failure; handle the error or propagate it to the caller.
progress $&ProgressProgress instance used by this call (exclusive borrow).value f64int — a value of this type
($&Progress) set_boundspub fn (progress $&Progress) set_bounds(bounds &layout.Rect) intOperation on $&Progress: set bounds. Throws on failure; handle the error or propagate it to the caller.
progress $&ProgressProgress instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Progress) paintpub fn (progress &Progress) paint(frame $&draw.Frame,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
progress &ProgressProgress instance used by this call (borrow).frame $&draw.Frametheme &Themeint — a value of this type
struct Hostpub struct Host {
pub context draw.Context
pub identity ui.CanvasEvent
}A widget surface uses logical coordinates and handles scrolling itself.
context draw.Contextidentity ui.CanvasEventattachpub fn attach(window &ui.Window) HostExecute attach. Throws on failure; handle the error or propagate it to the caller.
window &ui.WindowHost — a value of this type
const ROLE_NONEpub const ROLE_NONE = 0Accessibility node roles — a semantic abstraction of control type for platform providers (UIA, NSAccessibility, AT-SPI2). Each role maps directly to a platform control type or pattern.
const ROLE_WINDOWpub const ROLE_WINDOW = 1Constant ROLE_WINDOW, defining protocol or algorithm parameters.
const ROLE_GROUPpub const ROLE_GROUP = 2Constant ROLE_GROUP, defining protocol or algorithm parameters.
const ROLE_BUTTONpub const ROLE_BUTTON = 3Constant ROLE_BUTTON, defining protocol or algorithm parameters.
const ROLE_CHECKBOXpub const ROLE_CHECKBOX = 4Constant ROLE_CHECKBOX, defining protocol or algorithm parameters.
const ROLE_SWITCHpub const ROLE_SWITCH = 5Constant ROLE_SWITCH, defining protocol or algorithm parameters.
const ROLE_RADIO_BUTTONpub const ROLE_RADIO_BUTTON = 6Constant ROLE_RADIO_BUTTON, defining protocol or algorithm parameters.
const ROLE_TEXT_FIELDpub const ROLE_TEXT_FIELD = 7Constant ROLE_TEXT_FIELD, defining protocol or algorithm parameters.
const ROLE_TEXT_AREApub const ROLE_TEXT_AREA = 8Constant ROLE_TEXT_AREA, defining protocol or algorithm parameters.
const ROLE_LABELpub const ROLE_LABEL = 9Constant ROLE_LABEL, defining protocol or algorithm parameters.
const ROLE_SLIDERpub const ROLE_SLIDER = 10Constant ROLE_SLIDER, defining protocol or algorithm parameters.
const ROLE_STEPPERpub const ROLE_STEPPER = 11Constant ROLE_STEPPER, defining protocol or algorithm parameters.
const ROLE_TAB_LISTpub const ROLE_TAB_LIST = 12Constant ROLE_TAB_LIST, defining protocol or algorithm parameters.
const ROLE_TABpub const ROLE_TAB = 13Constant ROLE_TAB, defining protocol or algorithm parameters.
const ROLE_TAB_PANELpub const ROLE_TAB_PANEL = 14Constant ROLE_TAB_PANEL, defining protocol or algorithm parameters.
const ROLE_SELECTpub const ROLE_SELECT = 15Constant ROLE_SELECT, defining protocol or algorithm parameters.
const ROLE_LISTpub const ROLE_LIST = 16Constant ROLE_LIST, defining protocol or algorithm parameters.
const ROLE_LIST_ITEMpub const ROLE_LIST_ITEM = 17Constant ROLE_LIST_ITEM, defining protocol or algorithm parameters.
const ROLE_TABLEpub const ROLE_TABLE = 18Constant ROLE_TABLE, defining protocol or algorithm parameters.
const ROLE_TABLE_ROWpub const ROLE_TABLE_ROW = 19Constant ROLE_TABLE_ROW, defining protocol or algorithm parameters.
const ROLE_TABLE_CELLpub const ROLE_TABLE_CELL = 20Constant ROLE_TABLE_CELL, defining protocol or algorithm parameters.
const ROLE_TABLE_HEADERpub const ROLE_TABLE_HEADER = 21Constant ROLE_TABLE_HEADER, defining protocol or algorithm parameters.
const ROLE_TREEpub const ROLE_TREE = 22Constant ROLE_TREE, defining protocol or algorithm parameters.
const ROLE_TREE_ITEMpub const ROLE_TREE_ITEM = 23Constant ROLE_TREE_ITEM, defining protocol or algorithm parameters.
const ROLE_PROGRESS_BARpub const ROLE_PROGRESS_BAR = 24Constant ROLE_PROGRESS_BAR, defining protocol or algorithm parameters.
const ROLE_SEPARATORpub const ROLE_SEPARATOR = 25Constant ROLE_SEPARATOR, defining protocol or algorithm parameters.
const ROLE_MENUpub const ROLE_MENU = 26Constant ROLE_MENU, defining protocol or algorithm parameters.
const ROLE_MENU_ITEMpub const ROLE_MENU_ITEM = 27Constant ROLE_MENU_ITEM, defining protocol or algorithm parameters.
const ROLE_DIALOGpub const ROLE_DIALOG = 28Constant ROLE_DIALOG, defining protocol or algorithm parameters.
const ROLE_TOOLTIPpub const ROLE_TOOLTIP = 29Constant ROLE_TOOLTIP, defining protocol or algorithm parameters.
const ROLE_TOOLBARpub const ROLE_TOOLBAR = 30Constant ROLE_TOOLBAR, defining protocol or algorithm parameters.
const ROLE_SCROLL_BARpub const ROLE_SCROLL_BAR = 31Constant ROLE_SCROLL_BAR, defining protocol or algorithm parameters.
const ROLE_BREADCRUMBpub const ROLE_BREADCRUMB = 32Constant ROLE_BREADCRUMB, defining protocol or algorithm parameters.
const ROLE_LINKpub const ROLE_LINK = 33Constant ROLE_LINK, defining protocol or algorithm parameters.
const ROLE_BADGEpub const ROLE_BADGE = 34Constant ROLE_BADGE, defining protocol or algorithm parameters.
const ROLE_CARDpub const ROLE_CARD = 35Constant ROLE_CARD, defining protocol or algorithm parameters.
const ROLE_CHARTpub const ROLE_CHART = 36Constant ROLE_CHART, defining protocol or algorithm parameters.
const ROLE_COLOR_PICKERpub const ROLE_COLOR_PICKER = 37Constant ROLE_COLOR_PICKER, defining protocol or algorithm parameters.
const ROLE_DATE_PICKERpub const ROLE_DATE_PICKER = 38Constant ROLE_DATE_PICKER, defining protocol or algorithm parameters.
const ROLE_TIME_PICKERpub const ROLE_TIME_PICKER = 39Constant ROLE_TIME_PICKER, defining protocol or algorithm parameters.
const ROLE_SPINNERpub const ROLE_SPINNER = 40Constant ROLE_SPINNER, defining protocol or algorithm parameters.
const ROLE_COMBOBOXpub const ROLE_COMBOBOX = 41Constant ROLE_COMBOBOX, defining protocol or algorithm parameters.
const ROLE_SPLIT_VIEWpub const ROLE_SPLIT_VIEW = 42Constant ROLE_SPLIT_VIEW, defining protocol or algorithm parameters.
const ROLE_WEBVIEWpub const ROLE_WEBVIEW = 43Constant ROLE_WEBVIEW, defining protocol or algorithm parameters.
const ROLE_PASSWORD_FIELDpub const ROLE_PASSWORD_FIELD = 44Constant ROLE_PASSWORD_FIELD, defining protocol or algorithm parameters.
const ROLE_POPOVERpub const ROLE_POPOVER = 45Constant ROLE_POPOVER, defining protocol or algorithm parameters.
const ROLE_TOASTpub const ROLE_TOAST = 46Constant ROLE_TOAST, defining protocol or algorithm parameters.
const ACC_STATE_DISABLEDpub const ACC_STATE_DISABLED = 1Accessibility node states — a bitmask of boolean properties. States are orthogonal and not role-dependent at the node model layer.
const ACC_STATE_FOCUSEDpub const ACC_STATE_FOCUSED = 2Constant ACC_STATE_FOCUSED, defining protocol or algorithm parameters.
const ACC_STATE_SELECTEDpub const ACC_STATE_SELECTED = 4Constant ACC_STATE_SELECTED, defining protocol or algorithm parameters.
const ACC_STATE_CHECKEDpub const ACC_STATE_CHECKED = 8Constant ACC_STATE_CHECKED, defining protocol or algorithm parameters.
const ACC_STATE_EXPANDEDpub const ACC_STATE_EXPANDED = 16Constant ACC_STATE_EXPANDED, defining protocol or algorithm parameters.
const ACC_STATE_COLLAPSEDpub const ACC_STATE_COLLAPSED = 32Constant ACC_STATE_COLLAPSED, defining protocol or algorithm parameters.
const ACC_STATE_READ_ONLYpub const ACC_STATE_READ_ONLY = 64Constant ACC_STATE_READ_ONLY, defining protocol or algorithm parameters.
const ACC_STATE_REQUIREDpub const ACC_STATE_REQUIRED = 128Constant ACC_STATE_REQUIRED, defining protocol or algorithm parameters.
const ACC_STATE_INVALIDpub const ACC_STATE_INVALID = 256Constant ACC_STATE_INVALID, defining protocol or algorithm parameters.
const ACC_STATE_BUSYpub const ACC_STATE_BUSY = 512Constant ACC_STATE_BUSY, defining protocol or algorithm parameters.
const ACC_STATE_PRESSEDpub const ACC_STATE_PRESSED = 1024Constant ACC_STATE_PRESSED, defining protocol or algorithm parameters.
const ACC_STATE_MODALpub const ACC_STATE_MODAL = 2048Constant ACC_STATE_MODAL, defining protocol or algorithm parameters.
const ACC_STATE_HIDDENpub const ACC_STATE_HIDDEN = 4096Constant ACC_STATE_HIDDEN, defining protocol or algorithm parameters.
const ACC_STATE_INDETERMINATEpub const ACC_STATE_INDETERMINATE = 8192Constant ACC_STATE_INDETERMINATE, defining protocol or algorithm parameters.
const ACC_STATE_PASSWORDpub const ACC_STATE_PASSWORD = 16384Constant ACC_STATE_PASSWORD, defining protocol or algorithm parameters.
const ACC_STATE_MULTILINEpub const ACC_STATE_MULTILINE = 32768Constant ACC_STATE_MULTILINE, defining protocol or algorithm parameters.
const LIVE_OFFpub const LIVE_OFF = 0Live region semantics for status announcements.
const LIVE_POLITEpub const LIVE_POLITE = 1Constant LIVE_POLITE, defining protocol or algorithm parameters.
const LIVE_ASSERTIVEpub const LIVE_ASSERTIVE = 2Constant LIVE_ASSERTIVE, defining protocol or algorithm parameters.
const MAX_ACCESSIBILITY_NODESpub const MAX_ACCESSIBILITY_NODES = 512Constant MAX_ACCESSIBILITY_NODES, defining protocol or algorithm parameters.
const MAX_ACCESSIBILITY_TEXTpub const MAX_ACCESSIBILITY_TEXT = 65536Constant MAX_ACCESSIBILITY_TEXT, defining protocol or algorithm parameters.
struct AccessibilityNodepub struct AccessibilityNode {
pub id int
pub role int
pub parent int
pub name string
pub description string
pub value string
pub selected_text string
pub copy_enabled bool
pub states int
pub live int
pub x f64
pub y f64
pub width f64
pub height f64
pub value_min f64
pub value_max f64
pub value_now f64
pub row_index int
pub row_count int
pub column_index int
pub column_count int
pub level int
pub children []int
}An AccessibilityNode captures the semantic information a platform accessibility provider (UIA, NSAccessibility, AT-SPI2) needs to describe a single element to assistive technology. It is a value type — providers receive a snapshot, not a mutable reference.
id introle intparent intname stringdescription stringvalue stringselected_text stringcopy_enabled boolstates intlive intx f64y f64width f64height f64value_min f64value_max f64value_now f64row_index introw_count intcolumn_index intcolumn_count intlevel intchildren []int($&Screen) accessibility_treepub fn (s $&Screen) accessibility_tree() []AccessibilityNodeaccessibility_tree builds a snapshot of semantic accessibility nodes from the Screen's current xacp_tree. This is the bridge between the widget tree (XACP) and platform-specific accessibility providers. The caller passes the result to a platform adapter (UIA provider, NSAccessibility, AT-SPI2) which holds a reference until the next update. The tree is rebuilt on each layout pass; providers compare against the previous snapshot to fire change notifications. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).[]AccessibilityNode — slice result
(&AccessibilityNode) clonepub fn (node &AccessibilityNode) clone() AccessibilityNodeCopy the control or style snapshot into an independent AccessibilityNode value.
node &AccessibilityNodeAccessibilityNode instance used by this call (borrow).AccessibilityNode — a value of this type
accessibility_node_by_idpub fn accessibility_node_by_id(tree &[]AccessibilityNode, id int) AccessibilityNodeaccessibility_node_by_id returns the node with the given id, or throws. Throws on failure; handle the error or propagate it to the caller.
tree &[]AccessibilityNodeid intAccessibilityNode — a value of this type
(&AccessibilityNode) has_statepub fn (node &AccessibilityNode) has_state(state int) boolhas_state checks whether a specific state bit is set on a node.
node &AccessibilityNodeAccessibilityNode instance used by this call (borrow).state intbool — true or false
role_namepub fn role_name(role int) stringrole_name returns a human-readable string for a role constant. Platform providers use this for debugging; screen readers use their own localized role names.
role intstring — result string
const CHANGE_ADDEDpub const CHANGE_ADDED = 1Constant CHANGE_ADDED, defining protocol or algorithm parameters.
const CHANGE_REMOVEDpub const CHANGE_REMOVED = 2Constant CHANGE_REMOVED, defining protocol or algorithm parameters.
const CHANGE_NAMEpub const CHANGE_NAME = 4Constant CHANGE_NAME, defining protocol or algorithm parameters.
const CHANGE_VALUEpub const CHANGE_VALUE = 8Constant CHANGE_VALUE, defining protocol or algorithm parameters.
const CHANGE_STATESpub const CHANGE_STATES = 16Constant CHANGE_STATES, defining protocol or algorithm parameters.
const CHANGE_BOUNDSpub const CHANGE_BOUNDS = 32Constant CHANGE_BOUNDS, defining protocol or algorithm parameters.
const CHANGE_FOCUSpub const CHANGE_FOCUS = 64Constant CHANGE_FOCUS, defining protocol or algorithm parameters.
const CHANGE_CHILDRENpub const CHANGE_CHILDREN = 128Constant CHANGE_CHILDREN, defining protocol or algorithm parameters.
const CHANGE_ROLEpub const CHANGE_ROLE = 256Constant CHANGE_ROLE, defining protocol or algorithm parameters.
const CHANGE_LIVE_REGIONpub const CHANGE_LIVE_REGION = 512Constant CHANGE_LIVE_REGION, defining protocol or algorithm parameters.
struct AccessibilityChangepub struct AccessibilityChange {
pub id int
pub kind int
pub role int
pub name string
}Structure encapsulating id, kind, role, name.
id intkind introle intname stringdiff_accessibility_treespub fn diff_accessibility_trees(old &[]AccessibilityNode, new &[]AccessibilityNode) []AccessibilityChangediff_accessibility_trees compares two snapshots and returns a list of changes. Platform providers use this to fire targeted notifications. This is deliberately conservative: it compares all fields a screen reader uses. If a change is detected that does not map to a platform notification, it is still included so adapters can choose to rebuild.
old &[]AccessibilityNodenew &[]AccessibilityNode[]AccessibilityChange — slice result
focused_nodepub fn focused_node(tree &[]AccessibilityNode) intfocused_node returns the id of the currently focused accessibility node, or 0 if no node is focused.
tree &[]AccessibilityNodeint — a value of this type
(&AccessibilityChange) has_changepub fn (change &AccessibilityChange) has_change(flag int) boolhas_change checks whether a specific change type is included.
change &AccessibilityChangeAccessibilityChange instance used by this call (borrow).flag intbool — true or false
const ANIMATION_IDLEpub const ANIMATION_IDLE = 0Constant ANIMATION_IDLE, defining protocol or algorithm parameters.
const ANIMATION_RUNNINGpub const ANIMATION_RUNNING = 1Constant ANIMATION_RUNNING, defining protocol or algorithm parameters.
const ANIMATION_PAUSEDpub const ANIMATION_PAUSED = 2Constant ANIMATION_PAUSED, defining protocol or algorithm parameters.
const ANIMATION_FINISHEDpub const ANIMATION_FINISHED = 3Constant ANIMATION_FINISHED, defining protocol or algorithm parameters.
struct AnimationOptionspub struct AnimationOptions {
pub duration time.Duration
pub delay time.Duration
pub iterations int
pub alternate bool
pub curve int
pub rate f64
}A clock-driven, reusable timeline. Zero iterations means repeat indefinitely. The owner schedules next_tick and applies value to its own visual state.
duration time.Durationdelay time.Durationiterations intalternate boolcurve intrate f64animation_optionspub fn animation_options() AnimationOptionsAnimation options.
No arguments are required.
AnimationOptions — a value of this type
(&AnimationOptions) validatepub fn (options &AnimationOptions) validate() intExecute validate on &AnimationOptions. Throws on failure; handle the error or propagate it to the caller.
options &AnimationOptionsAnimationOptions instance used by this call (borrow).int — a value of this type
struct AnimationControllerpub struct AnimationController {
pub options AnimationOptions
pub stamp time.Instant
}Structure encapsulating options, stamp.
options AnimationOptionsstamp time.Instantanimation_controllerpub fn animation_controller(options &AnimationOptions) AnimationControllerAnimation controller. Throws on failure; handle the error or propagate it to the caller.
options &AnimationOptionsAnimationController — a value of this type
(&AnimationController) statepub fn (a &AnimationController) state() intExecute state on &AnimationController.
a &AnimationControllerAnimationController instance used by this call (borrow).int — a value of this type
(&AnimationController) is_runningpub fn (a &AnimationController) is_running() boolOperation on &AnimationController: whether it is running.
a &AnimationControllerAnimationController instance used by this call (borrow).bool — true or false
(&AnimationController) progresspub fn (a &AnimationController) progress() f64Execute progress on &AnimationController.
a &AnimationControllerAnimationController instance used by this call (borrow).f64 — a value of this type
(&AnimationController) valuepub fn (a &AnimationController) value() f64Execute value on &AnimationController.
a &AnimationControllerAnimationController instance used by this call (borrow).f64 — a value of this type
($&AnimationController) playpub fn (a $&AnimationController) play(now time.Instant,reduced_motion bool) intExecute play on $&AnimationController.
a $&AnimationControllerAnimationController instance used by this call (exclusive borrow).now time.Instantreduced_motion boolint — a value of this type
($&AnimationController) finishpub fn (a $&AnimationController) finish()Execute finish on $&AnimationController.
a $&AnimationControllerAnimationController instance used by this call (exclusive borrow).This call does not return a value.
($&AnimationController) cancelpub fn (a $&AnimationController) cancel()Execute cancel on $&AnimationController.
a $&AnimationControllerAnimationController instance used by this call (exclusive borrow).This call does not return a value.
($&AnimationController) advancepub fn (a $&AnimationController) advance(now time.Instant,reduced_motion bool) boolExecute advance on $&AnimationController.
a $&AnimationControllerAnimationController instance used by this call (exclusive borrow).now time.Instantreduced_motion boolbool — true or false
($&AnimationController) pausepub fn (a $&AnimationController) pause(now time.Instant) intExecute pause on $&AnimationController. Throws on failure; handle the error or propagate it to the caller.
a $&AnimationControllerAnimationController instance used by this call (exclusive borrow).now time.Instantint — a value of this type
($&AnimationController) resumepub fn (a $&AnimationController) resume(now time.Instant)Execute resume on $&AnimationController.
a $&AnimationControllerAnimationController instance used by this call (exclusive borrow).now time.InstantThis call does not return a value.
($&AnimationController) reversepub fn (a $&AnimationController) reverse(now time.Instant) intOperation on $&AnimationController: reverse. Throws on failure; handle the error or propagate it to the caller.
a $&AnimationControllerAnimationController instance used by this call (exclusive borrow).now time.Instantint — a value of this type
($&AnimationController) seekpub fn (a $&AnimationController) seek(progress f64,now time.Instant) intOperation on $&AnimationController: move the read position. whence 0/1/2 = absolute / relative / from end. Throws on failure; handle the error or propagate it to the caller.
a $&AnimationControllerAnimationController instance used by this call (exclusive borrow).progress f64now time.Instantint — a value of this type
(&AnimationController) next_tickpub fn (a &AnimationController) next_tick(now time.Instant) time.InstantOperation on &AnimationController: next tick. Throws on failure; handle the error or propagate it to the caller.
a &AnimationControllerAnimationController instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
motion_easepub fn motion_ease(curve int,fraction f64) f64Shared by widget tweens, data transitions and application-owned timelines.
curve intfraction f64f64 — a value of this type
motion_lerppub fn motion_lerp(from f64,to f64,progress f64) f64Motion lerp.
from f64to f64progress f64f64 — a value of this type
const BUTTON_PRIMARYpub const BUTTON_PRIMARY = 0Constant BUTTON_PRIMARY, defining protocol or algorithm parameters.
const BUTTON_SECONDARYpub const BUTTON_SECONDARY = 1Constant BUTTON_SECONDARY, defining protocol or algorithm parameters.
const BUTTON_OUTLINEpub const BUTTON_OUTLINE = 2Constant BUTTON_OUTLINE, defining protocol or algorithm parameters.
const BUTTON_GHOSTpub const BUTTON_GHOST = 3Constant BUTTON_GHOST, defining protocol or algorithm parameters.
const BUTTON_DANGERpub const BUTTON_DANGER = 4Constant BUTTON_DANGER, defining protocol or algorithm parameters.
const BUTTON_SUBTLEpub const BUTTON_SUBTLE = 5Constant BUTTON_SUBTLE, defining protocol or algorithm parameters.
(&Styles) button_variantpub fn (styles &Styles) button_variant(variant int) ControlStyleAppearance helpers return independent values. They preserve the existing Styles/ControlStyle wire format and all three levels of theme inheritance. Throws on failure; handle the error or propagate it to the caller.
styles &StylesStyles instance used by this call (borrow).variant intControlStyle — a value of this type
(&Styles) tree_stylepub fn (styles &Styles) tree_style() ControlStyleOperation on &Styles: tree style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) table_stylepub fn (styles &Styles) table_style() ControlStyleOperation on &Styles: table style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) overlay_stylepub fn (styles &Styles) overlay_style() ControlStyleOperation on &Styles: overlay style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) overlay_scrimpub fn (styles &Styles) overlay_scrim() draw.ColorModal backdrop scrim color matched to Paper/Obsidian overlay tokens.
styles &StylesStyles instance used by this call (borrow).draw.Color — a value of this type
const TREE_ICON_NONEpub const TREE_ICON_NONE = 0Constant TREE_ICON_NONE, defining protocol or algorithm parameters.
const TREE_ICON_AUTOpub const TREE_ICON_AUTO = 1Constant TREE_ICON_AUTO, defining protocol or algorithm parameters.
const TREE_ICON_FOLDERpub const TREE_ICON_FOLDER = 2Constant TREE_ICON_FOLDER, defining protocol or algorithm parameters.
const TREE_ICON_FILEpub const TREE_ICON_FILE = 3Constant TREE_ICON_FILE, defining protocol or algorithm parameters.
struct TreeAppearancepub struct TreeAppearance {
pub indent f64
pub row_height f64
pub guides bool
pub icons bool
pub selection_mark bool
pub guide_opacity f64
pub action_width f64
}Structure encapsulating indent, row_height, guides, icons, selection_mark.
indent f64row_height f64guides boolicons boolselection_mark boolguide_opacity f64action_width f64tree_appearancepub fn tree_appearance() TreeAppearanceTree appearance.
No arguments are required.
TreeAppearance — a value of this type
(&TreeAppearance) validatepub fn (a &TreeAppearance) validate() intExecute validate on &TreeAppearance. Throws on failure; handle the error or propagate it to the caller.
a &TreeAppearanceTreeAppearance instance used by this call (borrow).int — a value of this type
const BADGE_NEUTRALpub const BADGE_NEUTRAL = 0Constant BADGE_NEUTRAL, defining protocol or algorithm parameters.
const BADGE_INFOpub const BADGE_INFO = 1Constant BADGE_INFO, defining protocol or algorithm parameters.
const BADGE_SUCCESSpub const BADGE_SUCCESS = 2Constant BADGE_SUCCESS, defining protocol or algorithm parameters.
const BADGE_WARNINGpub const BADGE_WARNING = 3Constant BADGE_WARNING, defining protocol or algorithm parameters.
const BADGE_ERRORpub const BADGE_ERROR = 4Constant BADGE_ERROR, defining protocol or algorithm parameters.
(&Styles) badge_variantpub fn (styles &Styles) badge_variant(tone int) ControlStyleOperation on &Styles: badge variant.
styles &StylesStyles instance used by this call (borrow).tone intControlStyle — a value of this type
const BADGE_STATUSpub const BADGE_STATUS = 0Constant BADGE_STATUS, defining protocol or algorithm parameters.
const BADGE_COUNTpub const BADGE_COUNT = 1Constant BADGE_COUNT, defining protocol or algorithm parameters.
const BADGE_DOTpub const BADGE_DOT = 2Constant BADGE_DOT, defining protocol or algorithm parameters.
(&Badge) variantpub fn (badge &Badge) variant() intExecute variant on &Badge.
badge &BadgeBadge instance used by this call (borrow).int — a value of this type
($&Badge) set_variantpub fn (badge $&Badge) set_variant(variant int) intOperation on $&Badge: set variant. Throws on failure; handle the error or propagate it to the caller.
badge $&BadgeBadge instance used by this call (exclusive borrow).variant intint — a value of this type
($&Screen) badge_onpub fn (s $&Screen) badge_on(anchor int,text string,variant int) intA passive adornment follows its anchor's bounds, scale, visibility and scroll. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).anchor inttext stringvariant intint — a value of this type
($&Screen) set_badge_variantpub fn (s $&Screen) set_badge_variant(id int,variant int) intOperation on $&Screen: set badge variant. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvariant intint — a value of this type
($&Screen) set_badge_anchorpub fn (s $&Screen) set_badge_anchor(id int,anchor int,x f64,y f64) intOperation on $&Screen: set badge anchor. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intanchor intx f64y f64int — a value of this type
($&Screen) badge_sizepub fn (s $&Screen) badge_size(id int) layout.SizeOperation on $&Screen: badge size. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intlayout.Size — a value of this type
(&Breadcrumbs) overflow_boundspub fn (crumbs &Breadcrumbs) overflow_bounds() layout.RectOperation on &Breadcrumbs: overflow bounds.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).layout.Rect — a value of this type
(&Breadcrumbs) popup_boundspub fn (crumbs &Breadcrumbs) popup_bounds() layout.RectOperation on &Breadcrumbs: popup bounds.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).layout.Rect — a value of this type
($&Breadcrumbs) set_popup_abovepub fn (crumbs $&Breadcrumbs) set_popup_above(above bool)Operation on $&Breadcrumbs: set popup above.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).above boolThis call does not return a value.
($&Breadcrumbs) paint_popup_styledpub fn (crumbs $&Breadcrumbs) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Breadcrumbs: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
struct Breadcrumbspub struct Breadcrumbs {
}The last item is the current location; earlier items activate navigation. Long paths are clipped consistently with hit testing, not silently wrapped.
This type has no public fields.
breadcrumbspub fn breadcrumbs(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,items &[]string) BreadcrumbsExecute breadcrumbs. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectitems &[]stringBreadcrumbs — a value of this type
(&Breadcrumbs) idpub fn (crumbs &Breadcrumbs) id() intReturn the unique integer ID of the element or control.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).int — a value of this type
(&Breadcrumbs) boundspub fn (crumbs &Breadcrumbs) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).layout.Rect — a value of this type
(&Breadcrumbs) countpub fn (crumbs &Breadcrumbs) count() intReturn the number of items in this control.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).int — a value of this type
(&Breadcrumbs) is_selectablepub fn (crumbs &Breadcrumbs) is_selectable() boolOperation on &Breadcrumbs: whether it is selectable.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).bool — true or false
($&Breadcrumbs) set_selectablepub fn (crumbs $&Breadcrumbs) set_selectable(selectable bool)Operation on $&Breadcrumbs: set selectable.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Breadcrumbs) needs_paintpub fn (crumbs &Breadcrumbs) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).bool — true or false
(&Breadcrumbs) visual_statepub fn (crumbs &Breadcrumbs) visual_state() intOperation on &Breadcrumbs: visual state.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).int — a value of this type
(&Breadcrumbs) style_orpub fn (crumbs &Breadcrumbs) style_or(styles &Styles) ControlStyleOperation on &Breadcrumbs: style or.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Breadcrumbs) set_stylepub fn (crumbs $&Breadcrumbs) set_style(style &ControlStyle) intOperation on $&Breadcrumbs: set style. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Breadcrumbs) set_enabledpub fn (crumbs $&Breadcrumbs) set_enabled(enabled bool)Operation on $&Breadcrumbs: set enabled.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&Breadcrumbs) set_read_onlypub fn (crumbs $&Breadcrumbs) set_read_only(read_only bool) intOperation on $&Breadcrumbs: set read only. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).read_only boolint — a value of this type
($&Breadcrumbs) set_boundspub fn (crumbs $&Breadcrumbs) set_bounds(bounds &layout.Rect) intOperation on $&Breadcrumbs: set bounds. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&Breadcrumbs) set_focuspub fn (crumbs $&Breadcrumbs) set_focus(focused bool)Operation on $&Breadcrumbs: set focus.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&Breadcrumbs) set_textpub fn (crumbs $&Breadcrumbs) set_text(index int,text &string) intOperation on $&Breadcrumbs: set text. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).index inttext &stringint — a value of this type
($&Breadcrumbs) apply_stylespub fn (crumbs $&Breadcrumbs) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
($&Breadcrumbs) measure_styledpub fn (crumbs $&Breadcrumbs) measure_styled(styles &Styles) layout.SizeOperation on $&Breadcrumbs: measure styled. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
(&Breadcrumbs) item_boundspub fn (crumbs &Breadcrumbs) item_bounds(index int) layout.RectOperation on &Breadcrumbs: item bounds. Throws on failure; handle the error or propagate it to the caller.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).index intlayout.Rect — a value of this type
(&Breadcrumbs) cursor_atpub fn (crumbs &Breadcrumbs) cursor_at(x f64,y f64) intOperation on &Breadcrumbs: cursor at. Throws on failure; handle the error or propagate it to the caller.
crumbs &BreadcrumbsBreadcrumbs instance used by this call (borrow).x f64y f64int — a value of this type
($&Breadcrumbs) inputpub fn (crumbs $&Breadcrumbs) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Breadcrumbs) routepub fn (crumbs $&Breadcrumbs) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Breadcrumbs) paint_styledpub fn (crumbs $&Breadcrumbs) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Breadcrumbs: paint styled. Throws on failure; handle the error or propagate it to the caller.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Breadcrumbs) disposepub fn (crumbs $&Breadcrumbs) dispose()Release and dispose native resources and underlying handles.
crumbs $&BreadcrumbsBreadcrumbs instance used by this call (exclusive borrow).This call does not return a value.
const BUTTON_GROUP_ACTIONSpub const BUTTON_GROUP_ACTIONS = 0Constant BUTTON_GROUP_ACTIONS, defining protocol or algorithm parameters.
const BUTTON_GROUP_SINGLEpub const BUTTON_GROUP_SINGLE = 1Constant BUTTON_GROUP_SINGLE, defining protocol or algorithm parameters.
const BUTTON_GROUP_MULTIPLEpub const BUTTON_GROUP_MULTIPLE = 2Constant BUTTON_GROUP_MULTIPLE, defining protocol or algorithm parameters.
struct ButtonGroupItempub struct ButtonGroupItem {
pub key int
pub label string
pub enabled bool
pub selected bool
pub variant int
}Structure encapsulating key, label, enabled, selected, variant.
key intlabel stringenabled boolselected boolvariant intbutton_group_itempub fn button_group_item(key int,label string) ButtonGroupItemButton group item.
key intlabel stringButtonGroupItem — a value of this type
struct ButtonGroupAppearancepub struct ButtonGroupAppearance {
pub vertical bool
pub joined bool
pub equal_width bool
pub allow_empty bool
pub gap f64
pub min_item_width f64
}Structure encapsulating vertical, joined, equal_width, allow_empty, gap.
vertical booljoined boolequal_width boolallow_empty boolgap f64min_item_width f64button_group_appearancepub fn button_group_appearance() ButtonGroupAppearanceButton group appearance.
No arguments are required.
ButtonGroupAppearance — a value of this type
(&ButtonGroupAppearance) validatepub fn (a &ButtonGroupAppearance) validate() intExecute validate on &ButtonGroupAppearance. Throws on failure; handle the error or propagate it to the caller.
a &ButtonGroupAppearanceButtonGroupAppearance instance used by this call (borrow).int — a value of this type
struct ButtonGrouppub struct ButtonGroup {
}ButtonGroup context or state structure.
This type has no public fields.
button_grouppub fn button_group(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,items &[]ButtonGroupItem,mode int) ButtonGroupButton group. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectitems &[]ButtonGroupItemmode intButtonGroup — a value of this type
(&ButtonGroup) idpub fn (g &ButtonGroup) id() intReturn the unique integer ID of the element or control.
g &ButtonGroupButtonGroup instance used by this call (borrow).int — a value of this type
(&ButtonGroup) boundspub fn (g &ButtonGroup) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
g &ButtonGroupButtonGroup instance used by this call (borrow).layout.Rect — a value of this type
(&ButtonGroup) needs_paintpub fn (g &ButtonGroup) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
g &ButtonGroupButtonGroup instance used by this call (borrow).bool — true or false
($&ButtonGroup) paintedpub fn (g $&ButtonGroup) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).This call does not return a value.
(&ButtonGroup) is_enabledpub fn (g &ButtonGroup) is_enabled() boolReturn whether the control is currently enabled.
g &ButtonGroupButtonGroup instance used by this call (borrow).bool — true or false
(&ButtonGroup) is_selectablepub fn (g &ButtonGroup) is_selectable() boolOperation on &ButtonGroup: whether it is selectable.
g &ButtonGroupButtonGroup instance used by this call (borrow).bool — true or false
($&ButtonGroup) set_selectablepub fn (g $&ButtonGroup) set_selectable(selectable bool)Operation on $&ButtonGroup: set selectable.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&ButtonGroup) is_focusedpub fn (g &ButtonGroup) is_focused() boolReturn whether the control currently has input focus.
g &ButtonGroupButtonGroup instance used by this call (borrow).bool — true or false
(&ButtonGroup) active_keypub fn (g &ButtonGroup) active_key() intOperation on &ButtonGroup: active key.
g &ButtonGroupButtonGroup instance used by this call (borrow).int — a value of this type
(&ButtonGroup) valuespub fn (g &ButtonGroup) values() []intReturn a slice containing all values in the collection.
g &ButtonGroupButtonGroup instance used by this call (borrow).[]int — slice result
($&ButtonGroup) set_itemspub fn (g $&ButtonGroup) set_items(items &[]ButtonGroupItem) intOperation on $&ButtonGroup: set items. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).items &[]ButtonGroupItemint — a value of this type
($&ButtonGroup) set_appearancepub fn (g $&ButtonGroup) set_appearance(a &ButtonGroupAppearance) intOperation on $&ButtonGroup: set appearance. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).a &ButtonGroupAppearanceint — a value of this type
($&ButtonGroup) set_item_enabledpub fn (g $&ButtonGroup) set_item_enabled(key int,enabled bool) intOperation on $&ButtonGroup: set item enabled. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).key intenabled boolint — a value of this type
($&ButtonGroup) set_item_labelpub fn (g $&ButtonGroup) set_item_label(key int,label string) intOperation on $&ButtonGroup: set item label. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).key intlabel stringint — a value of this type
($&ButtonGroup) set_checkedpub fn (g $&ButtonGroup) set_checked(key int,selected bool) intOperation on $&ButtonGroup: set checked. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).key intselected boolint — a value of this type
($&ButtonGroup) set_focuspub fn (g $&ButtonGroup) set_focus(value bool)Operation on $&ButtonGroup: set focus.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&ButtonGroup) cancelpub fn (g $&ButtonGroup) cancel()Execute cancel on $&ButtonGroup.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).This call does not return a value.
($&ButtonGroup) set_enabledpub fn (g $&ButtonGroup) set_enabled(value bool)Operation on $&ButtonGroup: set enabled.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&ButtonGroup) set_read_onlypub fn (g $&ButtonGroup) set_read_only(value bool)Operation on $&ButtonGroup: set read only.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&ButtonGroup) set_boundspub fn (g $&ButtonGroup) set_bounds(bounds &layout.Rect) intOperation on $&ButtonGroup: set bounds. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&ButtonGroup) set_stylepub fn (g $&ButtonGroup) set_style(style &ControlStyle) intOperation on $&ButtonGroup: set style. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&ButtonGroup) clear_stylepub fn (g $&ButtonGroup) clear_style()Operation on $&ButtonGroup: clear style.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).This call does not return a value.
($&ButtonGroup) set_motionpub fn (g $&ButtonGroup) set_motion(spec &MotionSpec) intOperation on $&ButtonGroup: set motion. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&ButtonGroup) apply_stylespub fn (g $&ButtonGroup) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&ButtonGroup) item_boundspub fn (g &ButtonGroup) item_bounds(key int) layout.RectOperation on &ButtonGroup: item bounds. Throws on failure; handle the error or propagate it to the caller.
g &ButtonGroupButtonGroup instance used by this call (borrow).key intlayout.Rect — a value of this type
($&ButtonGroup) inputpub fn (g $&ButtonGroup) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&ButtonGroup) routepub fn (g $&ButtonGroup) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&ButtonGroup) tickpub fn (g $&ButtonGroup) tick(styles &Styles,now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).styles &Stylesnow time.Instantreduced boolbool — true or false
(&ButtonGroup) next_tickpub fn (g &ButtonGroup) next_tick(now time.Instant) time.InstantOperation on &ButtonGroup: next tick. Throws on failure; handle the error or propagate it to the caller.
g &ButtonGroupButtonGroup instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&ButtonGroup) paint_styledpub fn (g $&ButtonGroup) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&ButtonGroup: paint styled. Throws on failure; handle the error or propagate it to the caller.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&ButtonGroup) disposepub fn (g $&ButtonGroup) dispose()Release and dispose native resources and underlying handles.
g $&ButtonGroupButtonGroup instance used by this call (exclusive borrow).This call does not return a value.
(&Button) measure_icon_styledpub fn (button &Button) measure_icon_styled(label $&StyledLabel,styles &Styles) layout.SizeMeasure the icon, label, gap and padding. icon_size=0 removes icon spacing.
button &ButtonButton instance used by this call (borrow).label $&StyledLabelstyles &Stylesintrinsic logical size
(&Button) paint_icon_styledpub fn (button &Button) paint_icon_styled(frame $&draw.Frame,label $&StyledLabel,image &draw.Image,styles &Styles) intPaint an image icon and label using styles. The icon preserves aspect ratio; the caller owns the Image.
button &ButtonButton instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelimage &draw.Imagestyles &Styles0 on success; throws on failure
struct CardRegionspub struct CardRegions {
pub header layout.Rect
pub body layout.Rect
pub footer layout.Rect
}Structure encapsulating header, body, footer.
header layout.Rectbody layout.Rectfooter layout.Rect(&Card) regionspub fn (card &Card) regions(styles &Styles,header_height f64,footer_height f64) CardRegionsExecute regions on &Card. Throws on failure; handle the error or propagate it to the caller.
card &CardCard instance used by this call (borrow).styles &Stylesheader_height f64footer_height f64CardRegions — a value of this type
struct CardSectionspub struct CardSections {
pub header int
pub body int
pub footer int
}Structure encapsulating header, body, footer.
header intbody intfooter int($&Screen) card_sectionspub fn (s $&Screen) card_sections(id int,header_height f64,footer_height f64) CardSectionsOperation on $&Screen: card sections. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intheader_height f64footer_height f64CardSections — a value of this type
badge_count_textpub fn badge_count_text(count int,maximum int) stringCounts remain separate from tone; zero can hide an optional numeric badge. Throws on failure; handle the error or propagate it to the caller.
count intmaximum intstring — result string
($&Screen) set_badge_countpub fn (s $&Screen) set_badge_count(id int,count int,maximum int,show_zero bool) intOperation on $&Screen: set badge count. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intcount intmaximum intshow_zero boolint — a value of this type
(&Locale) badge_countpub fn (locale &Locale) badge_count(count int,maximum int) stringOperation on &Locale: badge count. Throws on failure; handle the error or propagate it to the caller.
locale &LocaleLocale instance used by this call (borrow).count intmaximum intstring — result string
struct ColorPickerpub struct ColorPicker {
}Inline RGBA picker: four quantized 0..255 channels and a checkerboard alpha preview. Up/Down selects a channel; Left/Right, Home/End and Page keys adjust it. Each channel is also a draggable Slider. This is deliberately a small RGB editor rather than an HSV spectrum, OS eyedropper or color-profile tool.
This type has no public fields.
color_pickerpub fn color_picker(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value draw.Color) ColorPickerColor picker. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectvalue draw.ColorColorPicker — a value of this type
(&ColorPicker) idpub fn (picker &ColorPicker) id() intReturn the unique integer ID of the element or control.
picker &ColorPickerColorPicker instance used by this call (borrow).int — a value of this type
(&ColorPicker) boundspub fn (picker &ColorPicker) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
picker &ColorPickerColorPicker instance used by this call (borrow).layout.Rect — a value of this type
(&ColorPicker) is_enabledpub fn (picker &ColorPicker) is_enabled() boolReturn whether the control is currently enabled.
picker &ColorPickerColorPicker instance used by this call (borrow).bool — true or false
(&ColorPicker) is_selectablepub fn (picker &ColorPicker) is_selectable() boolOperation on &ColorPicker: whether it is selectable.
picker &ColorPickerColorPicker instance used by this call (borrow).bool — true or false
($&ColorPicker) set_selectablepub fn (picker $&ColorPicker) set_selectable(selectable bool)Operation on $&ColorPicker: set selectable.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&ColorPicker) is_focusedpub fn (picker &ColorPicker) is_focused() boolReturn whether the control currently has input focus.
picker &ColorPickerColorPicker instance used by this call (borrow).bool — true or false
(&ColorPicker) active_channelpub fn (picker &ColorPicker) active_channel() intOperation on &ColorPicker: active channel.
picker &ColorPickerColorPicker instance used by this call (borrow).int — a value of this type
(&ColorPicker) needs_paintpub fn (picker &ColorPicker) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
picker &ColorPickerColorPicker instance used by this call (borrow).bool — true or false
(&ColorPicker) channelpub fn (picker &ColorPicker) channel(index int) intExecute channel on &ColorPicker. Throws on failure; handle the error or propagate it to the caller.
picker &ColorPickerColorPicker instance used by this call (borrow).index intint — a value of this type
(&ColorPicker) valuepub fn (picker &ColorPicker) value() draw.ColorRead the color assembled from the four current channels for painting or storage.
picker &ColorPickerColorPicker instance used by this call (borrow).A draw.Color with red, green, blue and alpha.
($&ColorPicker) set_channelpub fn (picker $&ColorPicker) set_channel(index int,value int) intUpdate one RGBA channel, for example from a numeric field.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).index int0 red, 1 green, 2 blue, 3 alpha.value int0..255; alpha 0 is transparent and 255 is opaque.Returns 0 on success; failure throws rather than returning a nonzero status.
($&ColorPicker) set_valuepub fn (picker $&ColorPicker) set_value(value draw.Color) intSet an RGBA color and synchronize all four channel sliders.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).value draw.Colordraw.Color, including alpha.Returns 0 on success; failure throws rather than returning a nonzero status.
(&ColorPicker) style_orpub fn (picker &ColorPicker) style_or(styles &Styles) ControlStyleOperation on &ColorPicker: style or.
picker &ColorPickerColorPicker instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&ColorPicker) set_stylepub fn (picker $&ColorPicker) set_style(style &ControlStyle) intOperation on $&ColorPicker: set style. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&ColorPicker) set_enabledpub fn (picker $&ColorPicker) set_enabled(enabled bool)Operation on $&ColorPicker: set enabled.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&ColorPicker) set_read_onlypub fn (picker $&ColorPicker) set_read_only(read_only bool) intOperation on $&ColorPicker: set read only. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).read_only boolint — a value of this type
($&ColorPicker) set_invalidpub fn (picker $&ColorPicker) set_invalid(invalid bool)Operation on $&ColorPicker: set invalid.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&ColorPicker) set_focuspub fn (picker $&ColorPicker) set_focus(focused bool)Operation on $&ColorPicker: set focus.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&ColorPicker) preview_boundspub fn (picker &ColorPicker) preview_bounds() layout.RectOperation on &ColorPicker: preview bounds.
picker &ColorPickerColorPicker instance used by this call (borrow).layout.Rect — a value of this type
(&ColorPicker) channel_boundspub fn (picker &ColorPicker) channel_bounds(index int) layout.RectOperation on &ColorPicker: channel bounds. Throws on failure; handle the error or propagate it to the caller.
picker &ColorPickerColorPicker instance used by this call (borrow).index intlayout.Rect — a value of this type
($&ColorPicker) set_boundspub fn (picker $&ColorPicker) set_bounds(bounds &layout.Rect) intOperation on $&ColorPicker: set bounds. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&ColorPicker) apply_stylespub fn (picker $&ColorPicker) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
($&ColorPicker) inputpub fn (picker $&ColorPicker) input(event &ui.InputEvent) ActionRoute input to the active RGBA channel and report color changes or commits.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).event &ui.InputEventAn Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
Action.value contains the packed color number, and value() returns a draw.Color.($&ColorPicker) routepub fn (picker $&ColorPicker) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&ColorPicker) eventpub fn (picker $&ColorPicker) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
($&ColorPicker) measure_styledpub fn (picker $&ColorPicker) measure_styled(styles &Styles) layout.SizeOperation on $&ColorPicker: measure styled. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&ColorPicker) paint_styledpub fn (picker $&ColorPicker) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&ColorPicker: paint styled. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&ColorPicker) disposepub fn (picker $&ColorPicker) dispose()Release and dispose native resources and underlying handles.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).This call does not return a value.
(&ColorPicker) hexpub fn (picker &ColorPicker) hex() stringExecute hex on &ColorPicker.
picker &ColorPickerColorPicker instance used by this call (borrow).string — result string
($&ColorPicker) set_hexpub fn (picker $&ColorPicker) set_hex(text &string) intOperation on $&ColorPicker: set hex. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).text &stringint — a value of this type
($&ColorPicker) set_swatchespub fn (picker $&ColorPicker) set_swatches(colors &[]draw.Color) intOperation on $&ColorPicker: set swatches. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).colors &[]draw.Colorint — a value of this type
($&ColorPicker) rememberpub fn (picker $&ColorPicker) remember()Execute remember on $&ColorPicker.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).This call does not return a value.
(&ColorPicker) recent_colorspub fn (picker &ColorPicker) recent_colors() []draw.ColorOperation on &ColorPicker: recent colors.
picker &ColorPickerColorPicker instance used by this call (borrow).[]draw.Color — slice result
(&ColorPicker) swatch_boundspub fn (picker &ColorPicker) swatch_bounds(index int) layout.RectOperation on &ColorPicker: swatch bounds. Throws on failure; handle the error or propagate it to the caller.
picker &ColorPickerColorPicker instance used by this call (borrow).index intlayout.Rect — a value of this type
($&ColorPicker) set_show_swatchespub fn (picker $&ColorPicker) set_show_swatches(visible bool)Operation on $&ColorPicker: set show swatches.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).visible boolThis call does not return a value.
struct ComboBoxpub struct ComboBox {
}Editable choice field. Text is owned by Editor and travels through the native TextInput revision/IME protocol, including composition, clipboard and Unicode. Call event for native events and place_combo_box after each View layout. route receives node-local input; input receives canvas coordinates, which lets the scene intercept an open popup before dispatching an outside press. paint_styled paints locally like Editor; paint_popup_styled is canvas-space.
This type has no public fields.
combo_boxpub fn combo_box(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,options &[]string,value &string) ComboBoxCombo box. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectoptions &[]stringvalue &stringComboBox — a value of this type
(&ComboBox) idpub fn (combo &ComboBox) id() intReturn the unique integer ID of the element or control.
combo &ComboBoxComboBox instance used by this call (borrow).int — a value of this type
(&ComboBox) boundspub fn (combo &ComboBox) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
combo &ComboBoxComboBox instance used by this call (borrow).layout.Rect — a value of this type
(&ComboBox) valuepub fn (combo &ComboBox) value() stringExecute value on &ComboBox.
combo &ComboBoxComboBox instance used by this call (borrow).string — result string
(&ComboBox) selected_textpub fn (combo &ComboBox) selected_text() stringOperation on &ComboBox: selected text.
combo &ComboBoxComboBox instance used by this call (borrow).string — result string
(&ComboBox) selectedpub fn (combo &ComboBox) selected() intRead the original option index matching the current text, to check whether it corresponds to an existing choice.
combo &ComboBoxComboBox instance used by this call (borrow).Original matching option index, or -1 when the text matches no option.
(&ComboBox) countpub fn (combo &ComboBox) count() intReturn the number of items in this control.
combo &ComboBoxComboBox instance used by this call (borrow).int — a value of this type
(&ComboBox) filtered_countpub fn (combo &ComboBox) filtered_count() intOperation on &ComboBox: filtered count.
combo &ComboBoxComboBox instance used by this call (borrow).int — a value of this type
(&ComboBox) is_openpub fn (combo &ComboBox) is_open() boolReturn whether the overlay, menu or dialog is currently open.
combo &ComboBoxComboBox instance used by this call (borrow).bool — true or false
(&ComboBox) has_popup_openpub fn (combo &ComboBox) has_popup_open() boolOperation on &ComboBox: whether it has popup open.
combo &ComboBoxComboBox instance used by this call (borrow).bool — true or false
(&ComboBox) is_selectablepub fn (combo &ComboBox) is_selectable() boolOperation on &ComboBox: whether it is selectable.
combo &ComboBoxComboBox instance used by this call (borrow).bool — true or false
(&ComboBox) is_focusedpub fn (combo &ComboBox) is_focused() boolReturn whether the control currently has input focus.
combo &ComboBoxComboBox instance used by this call (borrow).bool — true or false
(&ComboBox) is_enabledpub fn (combo &ComboBox) is_enabled() boolReturn whether the control is currently enabled.
combo &ComboBoxComboBox instance used by this call (borrow).bool — true or false
(&ComboBox) needs_paintpub fn (combo &ComboBox) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
combo &ComboBoxComboBox instance used by this call (borrow).bool — true or false
($&ComboBox) set_placeholderpub fn (combo $&ComboBox) set_placeholder(value &string) intOperation on $&ComboBox: set placeholder. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).value &stringint — a value of this type
(&ComboBox) style_orpub fn (combo &ComboBox) style_or(styles &Styles) ControlStyleOperation on &ComboBox: style or.
combo &ComboBoxComboBox instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&ComboBox) set_stylepub fn (combo $&ComboBox) set_style(style &ControlStyle) intOperation on $&ComboBox: set style. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&ComboBox) set_enabledpub fn (combo $&ComboBox) set_enabled(enabled bool) intOperation on $&ComboBox: set enabled. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).enabled boolint — a value of this type
($&ComboBox) set_read_onlypub fn (combo $&ComboBox) set_read_only(read_only bool) intOperation on $&ComboBox: set read only. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).read_only boolint — a value of this type
($&ComboBox) set_selectablepub fn (combo $&ComboBox) set_selectable(selectable bool) intOperation on $&ComboBox: set selectable. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).selectable boolint — a value of this type
($&ComboBox) set_viewportpub fn (combo $&ComboBox) set_viewport(viewport &layout.Rect)Operation on $&ComboBox: set viewport.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&ComboBox) set_invalidpub fn (combo $&ComboBox) set_invalid(invalid bool)Operation on $&ComboBox: set invalid.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&ComboBox) focus_sessionpub fn (combo $&ComboBox) focus_session(focused bool) intOperation on $&ComboBox: focus session. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).focused boolint — a value of this type
($&ComboBox) set_boundspub fn (combo $&ComboBox) set_bounds(bounds &layout.Rect) intOperation on $&ComboBox: set bounds. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
place_combo_boxpub fn place_combo_box(view $&View,combo $&ComboBox) intPlace combo box. Throws on failure; handle the error or propagate it to the caller.
view $&Viewcombo $&ComboBoxint — a value of this type
($&ComboBox) set_valuepub fn (combo $&ComboBox) set_value(value &string) intProgrammatically replace editable combo-box text and refresh its query state.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).value &stringReturns 0 on success; failure throws rather than returning a nonzero status.
($&ComboBox) set_selectedpub fn (combo $&ComboBox) set_selected(index int) intSelect an existing choice, copy its text into the editor and close the list.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).index intReturns 0 on success; failure throws rather than returning a nonzero status.
widgets: combo choice out of range; replacing text during IME composition can also throw.($&ComboBox) set_openpub fn (combo $&ComboBox) set_open(open bool)Set whether the option list is open.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).open booltrue requests opening and false closes it; disabled or read-only controls remain closed.No return value; read the resulting state with is_open().
paint_popup_styled in an appropriate overlay pass.($&ComboBox) set_popup_abovepub fn (combo $&ComboBox) set_popup_above(above bool)Operation on $&ComboBox: set popup above.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).above boolThis call does not return a value.
($&ComboBox) apply_stylespub fn (combo $&ComboBox) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&ComboBox) popup_boundspub fn (combo &ComboBox) popup_bounds() layout.RectRead the option-list rectangle in canvas coordinates for overlay hit testing or layout.
combo &ComboBoxComboBox instance used by this call (borrow).The list's layout.Rect; reading it does not open the list, so also check is_open().
(&ComboBox) option_boundspub fn (combo &ComboBox) option_bounds(index int) layout.RectOperation on &ComboBox: option bounds. Throws on failure; handle the error or propagate it to the caller.
combo &ComboBoxComboBox instance used by this call (borrow).index intlayout.Rect — a value of this type
(&ComboBox) toggle_boundspub fn (combo &ComboBox) toggle_bounds() layout.RectOperation on &ComboBox: toggle bounds.
combo &ComboBoxComboBox instance used by this call (borrow).layout.Rect — a value of this type
($&ComboBox) inputpub fn (combo $&ComboBox) input(event &ui.InputEvent) ActionProcess editable combo-box choice selection, its toggle and editor input.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).event &ui.InputEventAn Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
ACTION_CHANGE with its original option index in value; Enter and arrows remain with the editor during IME composition.($&ComboBox) routepub fn (combo $&ComboBox) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&ComboBox) eventpub fn (combo $&ComboBox) event(event &ui.Event) ActionReceive native window events, routing input to input and other events to the internal editor or base control.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).event &ui.Eventui.Event; use this entry point for IME, blur and lifecycle handling.An Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
($&ComboBox) tickpub fn (combo $&ComboBox) tick(now time.Instant,reduced_motion bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).now time.Instantreduced_motion boolbool — true or false
(&ComboBox) next_caret_tickpub fn (combo &ComboBox) next_caret_tick(now time.Instant,reduced_motion bool) time.InstantOperation on &ComboBox: next caret tick. Throws on failure; handle the error or propagate it to the caller.
combo &ComboBoxComboBox instance used by this call (borrow).now time.Instantreduced_motion booltime.Instant — a value of this type
($&ComboBox) measure_styledpub fn (combo $&ComboBox) measure_styled(styles &Styles) layout.SizeOperation on $&ComboBox: measure styled. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&ComboBox) paint_styledpub fn (combo $&ComboBox) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&ComboBox: paint styled. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&ComboBox) paint_popup_styledpub fn (combo $&ComboBox) paint_popup_styled(frame $&draw.Frame,styles &Styles) intPaint the expanded option list separately from the field so it can appear above other controls.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).frame $&draw.Framestyles &StylesReturns 0 on success; failure throws rather than returning a nonzero status.
($&ComboBox) disposepub fn (combo $&ComboBox) dispose()Release and dispose native resources and underlying handles.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).This call does not return a value.
($&ComboBox) set_allow_custompub fn (combo $&ComboBox) set_allow_custom(allowed bool)Operation on $&ComboBox: set allow custom.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).allowed boolThis call does not return a value.
(&ComboBox) is_valid_choicepub fn (combo &ComboBox) is_valid_choice() boolOperation on &ComboBox: whether it is valid choice.
combo &ComboBoxComboBox instance used by this call (borrow).bool — true or false
(&Button) clonepub fn (b &Button) clone() ButtonCopy the control or style snapshot into an independent Button value.
b &ButtonButton instance used by this call (borrow).Button — a value of this type
(&Radio) clonepub fn (r &Radio) clone() RadioCopy the control or style snapshot into an independent Radio value.
r &RadioRadio instance used by this call (borrow).Radio — a value of this type
(&Checkbox) clonepub fn (c &Checkbox) clone() CheckboxCopy the control or style snapshot into an independent Checkbox value.
c &CheckboxCheckbox instance used by this call (borrow).Checkbox — a value of this type
(&Switch) clonepub fn (value &Switch) clone() SwitchCopy the control or style snapshot into an independent Switch value.
value &SwitchSwitch instance used by this call (borrow).Switch — a value of this type
(&Slider) clonepub fn (value &Slider) clone() SliderCopy the control or style snapshot into an independent Slider value.
value &SliderSlider instance used by this call (borrow).Slider — a value of this type
(&Stepper) clonepub fn (value &Stepper) clone() StepperCopy the control or style snapshot into an independent Stepper value.
value &StepperStepper instance used by this call (borrow).Stepper — a value of this type
(&Tabs) clonepub fn (value &Tabs) clone() TabsCopy the control or style snapshot into an independent Tabs value.
value &TabsTabs instance used by this call (borrow).Tabs — a value of this type
(&Select) clonepub fn (value &Select) clone() SelectCopy the control or style snapshot into an independent Select value.
value &SelectSelect instance used by this call (borrow).Select — a value of this type
(&ListBox) clonepub fn (value &ListBox) clone() ListBoxCopy the control or style snapshot into an independent ListBox value.
value &ListBoxListBox instance used by this call (borrow).ListBox — a value of this type
(&Progress) clonepub fn (value &Progress) clone() ProgressCopy the control or style snapshot into an independent Progress value.
value &ProgressProgress instance used by this call (borrow).Progress — a value of this type
(&Divider) clonepub fn (value &Divider) clone() DividerCopy the control or style snapshot into an independent Divider value.
value &DividerDivider instance used by this call (borrow).Divider — a value of this type
(&Badge) clonepub fn (value &Badge) clone() BadgeCopy the control or style snapshot into an independent Badge value.
value &BadgeBadge instance used by this call (borrow).Badge — a value of this type
(&Card) clonepub fn (value &Card) clone() CardCopy the control or style snapshot into an independent Card value.
value &CardCard instance used by this call (borrow).Card — a value of this type
(&Scroll) clonepub fn (value &Scroll) clone() ScrollCopy the control or style snapshot into an independent Scroll value.
value &ScrollScroll instance used by this call (borrow).Scroll — a value of this type
($&DatePicker) set_localepub fn (picker $&DatePicker) set_locale(locale &Locale) intOperation on $&DatePicker: set locale. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&TimePicker) set_localepub fn (picker $&TimePicker) set_locale(locale &Locale) intOperation on $&TimePicker: set locale. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&Table) set_localepub fn (table $&Table) set_locale(locale &Locale) intOperation on $&Table: set locale. Throws on failure; handle the error or propagate it to the caller.
table $&TableTable instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&Pagination) set_localepub fn (page $&Pagination) set_locale(locale &Locale) intOperation on $&Pagination: set locale. Throws on failure; handle the error or propagate it to the caller.
page $&PaginationPagination instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&ColorPicker) set_localepub fn (picker $&ColorPicker) set_locale(locale &Locale) intOperation on $&ColorPicker: set locale. Throws on failure; handle the error or propagate it to the caller.
picker $&ColorPickerColorPicker instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&Slider) set_localepub fn (slider $&Slider) set_locale(locale &Locale) intOperation on $&Slider: set locale. Throws on failure; handle the error or propagate it to the caller.
slider $&SliderSlider instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&Stepper) set_localepub fn (stepper $&Stepper) set_locale(locale &Locale) intOperation on $&Stepper: set locale. Throws on failure; handle the error or propagate it to the caller.
stepper $&StepperStepper instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&Field) set_localepub fn (field $&Field) set_locale(locale &Locale) intOperation on $&Field: set locale. Throws on failure; handle the error or propagate it to the caller.
field $&FieldField instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&TaskButton) set_localepub fn (task $&TaskButton) set_locale(locale &Locale) intOperation on $&TaskButton: set locale. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&TaskButton) use_locale_labelspub fn (task $&TaskButton) use_locale_labels() intOperation on $&TaskButton: use locale labels. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).int — a value of this type
(&TaskButton) label_textpub fn (task &TaskButton) label_text() stringOperation on &TaskButton: label text. Throws on failure; handle the error or propagate it to the caller.
task &TaskButtonTaskButton instance used by this call (borrow).string — result string
($&MultiSelect) set_localepub fn (multi $&MultiSelect) set_locale(locale &Locale) intOperation on $&MultiSelect: set locale. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&ComboBox) set_localepub fn (combo $&ComboBox) set_locale(locale &Locale) intOperation on $&ComboBox: set locale. Throws on failure; handle the error or propagate it to the caller.
combo $&ComboBoxComboBox instance used by this call (exclusive borrow).locale &Localeint — a value of this type
(&MultiSelect) selection_textpub fn (multi &MultiSelect) selection_text() stringOperation on &MultiSelect: selection text. Throws on failure; handle the error or propagate it to the caller.
multi &MultiSelectMultiSelect instance used by this call (borrow).string — result string
(&Stepper) value_textpub fn (stepper &Stepper) value_text() stringOperation on &Stepper: value text. Throws on failure; handle the error or propagate it to the caller.
stepper &StepperStepper instance used by this call (borrow).string — result string
($&TimePicker) use_locale_clockpub fn (picker $&TimePicker) use_locale_clock()Operation on $&TimePicker: use locale clock.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).This call does not return a value.
(&DatePicker) display_textpub fn (picker &DatePicker) display_text() stringOperation on &DatePicker: display text. Throws on failure; handle the error or propagate it to the caller.
picker &DatePickerDatePicker instance used by this call (borrow).string — result string
struct Switchpub struct Switch {
}Switch context or state structure.
This type has no public fields.
switch_controlpub fn switch_control(identity &ui.CanvasEvent,id int,bounds &layout.Rect,checked bool) SwitchSwitch control. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectchecked boolSwitch — a value of this type
(&Switch) idpub fn (sw &Switch) id() intReturn the unique integer ID of the element or control.
sw &SwitchSwitch instance used by this call (borrow).int — a value of this type
(&Switch) boundspub fn (sw &Switch) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
sw &SwitchSwitch instance used by this call (borrow).layout.Rect — a value of this type
(&Switch) needs_paintpub fn (sw &Switch) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
($&Switch) paintedpub fn (sw $&Switch) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
sw $&SwitchSwitch instance used by this call (exclusive borrow).This call does not return a value.
($&Switch) invalidatepub fn (sw $&Switch) invalidate()Invalidate the control area, requesting a repaint on next frame.
sw $&SwitchSwitch instance used by this call (exclusive borrow).This call does not return a value.
($&Switch) cancelpub fn (sw $&Switch) cancel()Execute cancel on $&Switch.
sw $&SwitchSwitch instance used by this call (exclusive borrow).This call does not return a value.
(&Switch) is_enabledpub fn (sw &Switch) is_enabled() boolReturn whether the control is currently enabled.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
(&Switch) is_selectablepub fn (sw &Switch) is_selectable() boolOperation on &Switch: whether it is selectable.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
($&Switch) set_selectablepub fn (sw $&Switch) set_selectable(selectable bool)Operation on $&Switch: set selectable.
sw $&SwitchSwitch instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
($&Switch) set_enabledpub fn (sw $&Switch) set_enabled(enabled bool)Operation on $&Switch: set enabled.
sw $&SwitchSwitch instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Switch) is_focusedpub fn (sw &Switch) is_focused() boolReturn whether the control currently has input focus.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
($&Switch) set_focuspub fn (sw $&Switch) set_focus(focused bool)Operation on $&Switch: set focus.
sw $&SwitchSwitch instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&Switch) is_hoveredpub fn (sw &Switch) is_hovered() boolOperation on &Switch: whether it is hovered.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
(&Switch) is_pressedpub fn (sw &Switch) is_pressed() boolOperation on &Switch: whether it is pressed.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
(&Switch) is_invalidpub fn (sw &Switch) is_invalid() boolOperation on &Switch: whether it is invalid.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
($&Switch) set_invalidpub fn (sw $&Switch) set_invalid(invalid bool)Operation on $&Switch: set invalid.
sw $&SwitchSwitch instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Switch) is_read_onlypub fn (sw &Switch) is_read_only() boolOperation on &Switch: whether it is read only.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
($&Switch) set_read_onlypub fn (sw $&Switch) set_read_only(read_only bool)Operation on $&Switch: set read only.
sw $&SwitchSwitch instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
($&Switch) set_boundspub fn (sw $&Switch) set_bounds(bounds &layout.Rect) intOperation on $&Switch: set bounds. Throws on failure; handle the error or propagate it to the caller.
sw $&SwitchSwitch instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Switch) valuepub fn (sw &Switch) value() boolExecute value on &Switch.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
($&Switch) set_valuepub fn (sw $&Switch) set_value(checked bool)Operation on $&Switch: set value.
sw $&SwitchSwitch instance used by this call (exclusive borrow).checked boolThis call does not return a value.
(&Switch) visual_statepub fn (sw &Switch) visual_state() intOperation on &Switch: visual state.
sw &SwitchSwitch instance used by this call (borrow).int — a value of this type
(&Switch) has_stylepub fn (sw &Switch) has_style() boolOperation on &Switch: whether it has style.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
(&Switch) style_orpub fn (sw &Switch) style_or(styles &Styles) ControlStyleOperation on &Switch: style or.
sw &SwitchSwitch instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Switch) set_stylepub fn (sw $&Switch) set_style(style &ControlStyle) intOperation on $&Switch: set style. Throws on failure; handle the error or propagate it to the caller.
sw $&SwitchSwitch instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Switch) clear_stylepub fn (sw $&Switch) clear_style()Operation on $&Switch: clear style.
sw $&SwitchSwitch instance used by this call (exclusive borrow).This call does not return a value.
($&Switch) inputpub fn (sw $&Switch) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
sw $&SwitchSwitch instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Switch) eventpub fn (sw $&Switch) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
sw $&SwitchSwitch instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Switch) paintpub fn (sw &Switch) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
sw &SwitchSwitch instance used by this call (borrow).frame $&draw.Framelabel &draw.TextLayouttheme &Themeint — a value of this type
(&Switch) measure_styledpub fn (sw &Switch) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeOperation on &Switch: measure styled. Throws on failure; handle the error or propagate it to the caller.
sw &SwitchSwitch instance used by this call (borrow).label $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&Switch) paint_styledpub fn (sw &Switch) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Switch: paint styled. Throws on failure; handle the error or propagate it to the caller.
sw &SwitchSwitch instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
(&Switch) paint_position_styledpub fn (sw &Switch) paint_position_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles,position f64) intOperation on &Switch: paint position styled. Throws on failure; handle the error or propagate it to the caller.
sw &SwitchSwitch instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesposition f64int — a value of this type
struct Radiopub struct Radio {
}Radio context or state structure.
This type has no public fields.
radiopub fn radio(identity &ui.CanvasEvent,id int,bounds &layout.Rect,option_value int,selected bool) RadioExecute radio. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectoption_value intselected boolRadio — a value of this type
(&Radio) idpub fn (r &Radio) id() intReturn the unique integer ID of the element or control.
r &RadioRadio instance used by this call (borrow).int — a value of this type
(&Radio) boundspub fn (r &Radio) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
r &RadioRadio instance used by this call (borrow).layout.Rect — a value of this type
(&Radio) optionpub fn (r &Radio) option() intExecute option on &Radio.
r &RadioRadio instance used by this call (borrow).int — a value of this type
(&Radio) valuepub fn (r &Radio) value() boolExecute value on &Radio.
r &RadioRadio instance used by this call (borrow).bool — true or false
($&Radio) set_valuepub fn (r $&Radio) set_value(selected bool)Operation on $&Radio: set value.
r $&RadioRadio instance used by this call (exclusive borrow).selected boolThis call does not return a value.
(&Radio) needs_paintpub fn (r &Radio) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
r &RadioRadio instance used by this call (borrow).bool — true or false
($&Radio) paintedpub fn (r $&Radio) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
r $&RadioRadio instance used by this call (exclusive borrow).This call does not return a value.
($&Radio) invalidatepub fn (r $&Radio) invalidate()Invalidate the control area, requesting a repaint on next frame.
r $&RadioRadio instance used by this call (exclusive borrow).This call does not return a value.
($&Radio) cancelpub fn (r $&Radio) cancel()Execute cancel on $&Radio.
r $&RadioRadio instance used by this call (exclusive borrow).This call does not return a value.
(&Radio) is_enabledpub fn (r &Radio) is_enabled() boolReturn whether the control is currently enabled.
r &RadioRadio instance used by this call (borrow).bool — true or false
(&Radio) is_selectablepub fn (r &Radio) is_selectable() boolOperation on &Radio: whether it is selectable.
r &RadioRadio instance used by this call (borrow).bool — true or false
($&Radio) set_selectablepub fn (r $&Radio) set_selectable(selectable bool)Operation on $&Radio: set selectable.
r $&RadioRadio instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
($&Radio) set_enabledpub fn (r $&Radio) set_enabled(enabled bool)Operation on $&Radio: set enabled.
r $&RadioRadio instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Radio) is_focusedpub fn (r &Radio) is_focused() boolReturn whether the control currently has input focus.
r &RadioRadio instance used by this call (borrow).bool — true or false
($&Radio) set_focuspub fn (r $&Radio) set_focus(focused bool)Operation on $&Radio: set focus.
r $&RadioRadio instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&Radio) is_hoveredpub fn (r &Radio) is_hovered() boolOperation on &Radio: whether it is hovered.
r &RadioRadio instance used by this call (borrow).bool — true or false
(&Radio) is_pressedpub fn (r &Radio) is_pressed() boolOperation on &Radio: whether it is pressed.
r &RadioRadio instance used by this call (borrow).bool — true or false
(&Radio) is_invalidpub fn (r &Radio) is_invalid() boolOperation on &Radio: whether it is invalid.
r &RadioRadio instance used by this call (borrow).bool — true or false
($&Radio) set_invalidpub fn (r $&Radio) set_invalid(invalid bool)Operation on $&Radio: set invalid.
r $&RadioRadio instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Radio) is_read_onlypub fn (r &Radio) is_read_only() boolOperation on &Radio: whether it is read only.
r &RadioRadio instance used by this call (borrow).bool — true or false
($&Radio) set_read_onlypub fn (r $&Radio) set_read_only(read_only bool)Operation on $&Radio: set read only.
r $&RadioRadio instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
($&Radio) set_boundspub fn (r $&Radio) set_bounds(bounds &layout.Rect) intOperation on $&Radio: set bounds. Throws on failure; handle the error or propagate it to the caller.
r $&RadioRadio instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Radio) visual_statepub fn (r &Radio) visual_state() intOperation on &Radio: visual state.
r &RadioRadio instance used by this call (borrow).int — a value of this type
(&Radio) has_stylepub fn (r &Radio) has_style() boolOperation on &Radio: whether it has style.
r &RadioRadio instance used by this call (borrow).bool — true or false
(&Radio) style_orpub fn (r &Radio) style_or(styles &Styles) ControlStyleOperation on &Radio: style or.
r &RadioRadio instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Radio) set_stylepub fn (r $&Radio) set_style(style &ControlStyle) intOperation on $&Radio: set style. Throws on failure; handle the error or propagate it to the caller.
r $&RadioRadio instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Radio) clear_stylepub fn (r $&Radio) clear_style()Operation on $&Radio: clear style.
r $&RadioRadio instance used by this call (exclusive borrow).This call does not return a value.
($&Radio) inputpub fn (r $&Radio) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
r $&RadioRadio instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Radio) eventpub fn (r $&Radio) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
r $&RadioRadio instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Radio) paintpub fn (r &Radio) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
r &RadioRadio instance used by this call (borrow).frame $&draw.Framelabel &draw.TextLayouttheme &Themeint — a value of this type
(&Radio) measure_styledpub fn (r &Radio) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeOperation on &Radio: measure styled. Throws on failure; handle the error or propagate it to the caller.
r &RadioRadio instance used by this call (borrow).label $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&Radio) paint_styledpub fn (r &Radio) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Radio: paint styled. Throws on failure; handle the error or propagate it to the caller.
r &RadioRadio instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
struct Sliderpub struct Slider {
}Slider context or state structure.
This type has no public fields.
sliderpub fn slider(identity &ui.CanvasEvent,id int,bounds &layout.Rect,min f64,max f64,value f64) SliderExecute slider. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectmin f64max f64value f64Slider — a value of this type
(&Slider) idpub fn (s &Slider) id() intReturn the unique integer ID of the element or control.
s &SliderSlider instance used by this call (borrow).int — a value of this type
(&Slider) is_selectablepub fn (s &Slider) is_selectable() boolOperation on &Slider: whether it is selectable.
s &SliderSlider instance used by this call (borrow).bool — true or false
($&Slider) set_selectablepub fn (s $&Slider) set_selectable(selectable bool)Operation on $&Slider: set selectable.
s $&SliderSlider instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Slider) boundspub fn (s &Slider) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
s &SliderSlider instance used by this call (borrow).layout.Rect — a value of this type
(&Slider) valuepub fn (s &Slider) value() f64Execute value on &Slider.
s &SliderSlider instance used by this call (borrow).f64 — a value of this type
(&Slider) minpub fn (s &Slider) min() f64Operation on &Slider: return the smaller of two numeric values.
s &SliderSlider instance used by this call (borrow).f64 — a value of this type
(&Slider) maxpub fn (s &Slider) max() f64Operation on &Slider: return the larger of two numeric values.
s &SliderSlider instance used by this call (borrow).f64 — a value of this type
(&Slider) steppub fn (s &Slider) step() f64Execute step on &Slider.
s &SliderSlider instance used by this call (borrow).f64 — a value of this type
(&Slider) ratiopub fn (s &Slider) ratio() f64Execute ratio on &Slider.
s &SliderSlider instance used by this call (borrow).f64 — a value of this type
(&Slider) needs_paintpub fn (s &Slider) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
s &SliderSlider instance used by this call (borrow).bool — true or false
($&Slider) paintedpub fn (s $&Slider) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
s $&SliderSlider instance used by this call (exclusive borrow).This call does not return a value.
($&Slider) invalidatepub fn (s $&Slider) invalidate()Invalidate the control area, requesting a repaint on next frame.
s $&SliderSlider instance used by this call (exclusive borrow).This call does not return a value.
($&Slider) cancelpub fn (s $&Slider) cancel()Execute cancel on $&Slider.
s $&SliderSlider instance used by this call (exclusive borrow).This call does not return a value.
(&Slider) is_enabledpub fn (s &Slider) is_enabled() boolReturn whether the control is currently enabled.
s &SliderSlider instance used by this call (borrow).bool — true or false
($&Slider) set_enabledpub fn (s $&Slider) set_enabled(enabled bool)Operation on $&Slider: set enabled.
s $&SliderSlider instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Slider) is_focusedpub fn (s &Slider) is_focused() boolReturn whether the control currently has input focus.
s &SliderSlider instance used by this call (borrow).bool — true or false
($&Slider) set_focuspub fn (s $&Slider) set_focus(focused bool)Operation on $&Slider: set focus.
s $&SliderSlider instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&Slider) is_hoveredpub fn (s &Slider) is_hovered() boolOperation on &Slider: whether it is hovered.
s &SliderSlider instance used by this call (borrow).bool — true or false
(&Slider) is_draggingpub fn (s &Slider) is_dragging() boolOperation on &Slider: whether it is dragging.
s &SliderSlider instance used by this call (borrow).bool — true or false
(&Slider) is_invalidpub fn (s &Slider) is_invalid() boolOperation on &Slider: whether it is invalid.
s &SliderSlider instance used by this call (borrow).bool — true or false
($&Slider) set_invalidpub fn (s $&Slider) set_invalid(invalid bool)Operation on $&Slider: set invalid.
s $&SliderSlider instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Slider) is_read_onlypub fn (s &Slider) is_read_only() boolOperation on &Slider: whether it is read only.
s &SliderSlider instance used by this call (borrow).bool — true or false
($&Slider) set_read_onlypub fn (s $&Slider) set_read_only(read_only bool)Operation on $&Slider: set read only.
s $&SliderSlider instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
($&Slider) set_valuepub fn (s $&Slider) set_value(value f64) intSet a slider value, constrained by its configured range and step.
s $&SliderSlider instance used by this call (exclusive borrow).value f64Returns 0 on success; failure throws rather than returning a nonzero status.
NaN or infinity throws widgets: invalid slider value.($&Slider) set_rangepub fn (s $&Slider) set_range(min f64,max f64) intOperation on $&Slider: set range. Throws on failure; handle the error or propagate it to the caller.
s $&SliderSlider instance used by this call (exclusive borrow).min f64max f64int — a value of this type
($&Slider) set_steppub fn (s $&Slider) set_step(step f64) intOperation on $&Slider: set step. Throws on failure; handle the error or propagate it to the caller.
s $&SliderSlider instance used by this call (exclusive borrow).step f64int — a value of this type
($&Slider) set_boundspub fn (s $&Slider) set_bounds(bounds &layout.Rect) intOperation on $&Slider: set bounds. Throws on failure; handle the error or propagate it to the caller.
s $&SliderSlider instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Slider) visual_statepub fn (s &Slider) visual_state() intOperation on &Slider: visual state.
s &SliderSlider instance used by this call (borrow).int — a value of this type
(&Slider) has_stylepub fn (s &Slider) has_style() boolOperation on &Slider: whether it has style.
s &SliderSlider instance used by this call (borrow).bool — true or false
(&Slider) style_orpub fn (s &Slider) style_or(styles &Styles) ControlStyleOperation on &Slider: style or.
s &SliderSlider instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Slider) set_stylepub fn (s $&Slider) set_style(style &ControlStyle) intOperation on $&Slider: set style. Throws on failure; handle the error or propagate it to the caller.
s $&SliderSlider instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Slider) clear_stylepub fn (s $&Slider) clear_style()Operation on $&Slider: clear style.
s $&SliderSlider instance used by this call (exclusive borrow).This call does not return a value.
($&Slider) inputpub fn (s $&Slider) input(input &ui.InputEvent) ActionHandle dragging and keyboard adjustments, distinguishing live changes from a final commit.
s $&SliderSlider instance used by this call (exclusive borrow).input &ui.InputEventAn Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
ACTION_CHANGE reports live changes; ACTION_COMMIT completes an interaction that changed the value. value is current; set_commit_only suppresses live change actions.($&Slider) eventpub fn (s $&Slider) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
s $&SliderSlider instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Slider) paintpub fn (s &Slider) paint(frame $&draw.Frame,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
s &SliderSlider instance used by this call (borrow).frame $&draw.Frametheme &Themeint — a value of this type
(&Slider) measure_styledpub fn (s &Slider) measure_styled(styles &Styles) layout.SizeOperation on &Slider: measure styled.
s &SliderSlider instance used by this call (borrow).styles &Styleslayout.Size — a value of this type
(&Slider) paint_styledpub fn (s &Slider) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on &Slider: paint styled. Throws on failure; handle the error or propagate it to the caller.
s &SliderSlider instance used by this call (borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Slider) set_commit_onlypub fn (s $&Slider) set_commit_only(enabled bool)Emit only final commit actions when applying changes is expensive.
s $&SliderSlider instance used by this call (exclusive borrow).enabled booltrue suppresses live ACTION_CHANGE while retaining the final ACTION_COMMIT.No return value; setting this clears the current pending-commit flag.
($&Switch) set_motionpub fn (sw $&Switch) set_motion(spec &MotionSpec) intOperation on $&Switch: set motion. Throws on failure; handle the error or propagate it to the caller.
sw $&SwitchSwitch instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&Switch) tickpub fn (sw $&Switch) tick(now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
sw $&SwitchSwitch instance used by this call (exclusive borrow).now time.Instantreduced boolbool — true or false
(&Switch) next_tickpub fn (sw &Switch) next_tick(now time.Instant) time.InstantOperation on &Switch: next tick. Throws on failure; handle the error or propagate it to the caller.
sw &SwitchSwitch instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&Slider) apply_stylespub fn (s $&Slider) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
s $&SliderSlider instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
struct Stepperpub struct Stepper {
}Stepper context or state structure.
This type has no public fields.
stepperpub fn stepper(identity &ui.CanvasEvent,id int,bounds &layout.Rect,min f64,max f64,step f64,value f64) StepperExecute stepper. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectmin f64max f64step f64value f64Stepper — a value of this type
(&Stepper) idpub fn (st &Stepper) id() intReturn the unique integer ID of the element or control.
st &StepperStepper instance used by this call (borrow).int — a value of this type
(&Stepper) is_selectablepub fn (st &Stepper) is_selectable() boolOperation on &Stepper: whether it is selectable.
st &StepperStepper instance used by this call (borrow).bool — true or false
($&Stepper) set_selectablepub fn (st $&Stepper) set_selectable(selectable bool)Operation on $&Stepper: set selectable.
st $&StepperStepper instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Stepper) boundspub fn (st &Stepper) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
st &StepperStepper instance used by this call (borrow).layout.Rect — a value of this type
(&Stepper) valuepub fn (st &Stepper) value() f64Execute value on &Stepper.
st &StepperStepper instance used by this call (borrow).f64 — a value of this type
(&Stepper) minpub fn (st &Stepper) min() f64Operation on &Stepper: return the smaller of two numeric values.
st &StepperStepper instance used by this call (borrow).f64 — a value of this type
(&Stepper) maxpub fn (st &Stepper) max() f64Operation on &Stepper: return the larger of two numeric values.
st &StepperStepper instance used by this call (borrow).f64 — a value of this type
(&Stepper) steppub fn (st &Stepper) step() f64Execute step on &Stepper.
st &StepperStepper instance used by this call (borrow).f64 — a value of this type
(&Stepper) can_decrementpub fn (st &Stepper) can_decrement() boolOperation on &Stepper: can decrement.
st &StepperStepper instance used by this call (borrow).bool — true or false
(&Stepper) can_incrementpub fn (st &Stepper) can_increment() boolOperation on &Stepper: can increment.
st &StepperStepper instance used by this call (borrow).bool — true or false
(&Stepper) needs_paintpub fn (st &Stepper) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
st &StepperStepper instance used by this call (borrow).bool — true or false
($&Stepper) paintedpub fn (st $&Stepper) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
st $&StepperStepper instance used by this call (exclusive borrow).This call does not return a value.
($&Stepper) invalidatepub fn (st $&Stepper) invalidate()Invalidate the control area, requesting a repaint on next frame.
st $&StepperStepper instance used by this call (exclusive borrow).This call does not return a value.
($&Stepper) cancelpub fn (st $&Stepper) cancel()Execute cancel on $&Stepper.
st $&StepperStepper instance used by this call (exclusive borrow).This call does not return a value.
(&Stepper) is_enabledpub fn (st &Stepper) is_enabled() boolReturn whether the control is currently enabled.
st &StepperStepper instance used by this call (borrow).bool — true or false
($&Stepper) set_enabledpub fn (st $&Stepper) set_enabled(enabled bool)Operation on $&Stepper: set enabled.
st $&StepperStepper instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Stepper) is_focusedpub fn (st &Stepper) is_focused() boolReturn whether the control currently has input focus.
st &StepperStepper instance used by this call (borrow).bool — true or false
($&Stepper) set_focuspub fn (st $&Stepper) set_focus(focused bool)Operation on $&Stepper: set focus.
st $&StepperStepper instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&Stepper) is_hoveredpub fn (st &Stepper) is_hovered() boolOperation on &Stepper: whether it is hovered.
st &StepperStepper instance used by this call (borrow).bool — true or false
(&Stepper) is_invalidpub fn (st &Stepper) is_invalid() boolOperation on &Stepper: whether it is invalid.
st &StepperStepper instance used by this call (borrow).bool — true or false
($&Stepper) set_invalidpub fn (st $&Stepper) set_invalid(invalid bool)Operation on $&Stepper: set invalid.
st $&StepperStepper instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Stepper) is_read_onlypub fn (st &Stepper) is_read_only() boolOperation on &Stepper: whether it is read only.
st &StepperStepper instance used by this call (borrow).bool — true or false
($&Stepper) set_read_onlypub fn (st $&Stepper) set_read_only(read_only bool)Operation on $&Stepper: set read only.
st $&StepperStepper instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
($&Stepper) set_valuepub fn (st $&Stepper) set_value(value f64) intOperation on $&Stepper: set value. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).value f64int — a value of this type
($&Stepper) set_rangepub fn (st $&Stepper) set_range(min f64,max f64,step f64) intOperation on $&Stepper: set range. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).min f64max f64step f64int — a value of this type
($&Stepper) set_boundspub fn (st $&Stepper) set_bounds(bounds &layout.Rect) intOperation on $&Stepper: set bounds. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Stepper) visual_statepub fn (st &Stepper) visual_state() intOperation on &Stepper: visual state.
st &StepperStepper instance used by this call (borrow).int — a value of this type
(&Stepper) has_stylepub fn (st &Stepper) has_style() boolOperation on &Stepper: whether it has style.
st &StepperStepper instance used by this call (borrow).bool — true or false
(&Stepper) style_orpub fn (st &Stepper) style_or(styles &Styles) ControlStyleOperation on &Stepper: style or.
st &StepperStepper instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Stepper) set_stylepub fn (st $&Stepper) set_style(style &ControlStyle) intOperation on $&Stepper: set style. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Stepper) clear_stylepub fn (st $&Stepper) clear_style()Operation on $&Stepper: clear style.
st $&StepperStepper instance used by this call (exclusive borrow).This call does not return a value.
($&Stepper) inputpub fn (st $&Stepper) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Stepper) eventpub fn (st $&Stepper) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Stepper) paintpub fn (st &Stepper) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
st &StepperStepper instance used by this call (borrow).frame $&draw.Framelabel &draw.TextLayouttheme &Themeint — a value of this type
(&Stepper) measure_styledpub fn (st &Stepper) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeOperation on &Stepper: measure styled. Throws on failure; handle the error or propagate it to the caller.
st &StepperStepper instance used by this call (borrow).label $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&Stepper) paint_styledpub fn (st &Stepper) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Stepper: paint styled. Throws on failure; handle the error or propagate it to the caller.
st &StepperStepper instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
struct ListBoxpub struct ListBox {
}ListBox context or state structure.
This type has no public fields.
list_boxpub fn list_box(identity &ui.CanvasEvent,id int,bounds &layout.Rect,count int,selected int) ListBoxList box. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectcount intselected intListBox — a value of this type
(&ListBox) idpub fn (lb &ListBox) id() intReturn the unique integer ID of the element or control.
lb &ListBoxListBox instance used by this call (borrow).int — a value of this type
(&ListBox) boundspub fn (lb &ListBox) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
lb &ListBoxListBox instance used by this call (borrow).layout.Rect — a value of this type
(&ListBox) countpub fn (lb &ListBox) count() intReturn the number of items in this control.
lb &ListBoxListBox instance used by this call (borrow).int — a value of this type
(&ListBox) selectedpub fn (lb &ListBox) selected() intGet or test the currently selected index, node, or state.
lb &ListBoxListBox instance used by this call (borrow).int — a value of this type
(&ListBox) hovered_itempub fn (lb &ListBox) hovered_item() intOperation on &ListBox: hovered item.
lb &ListBoxListBox instance used by this call (borrow).int — a value of this type
(&ListBox) scroll_offsetpub fn (lb &ListBox) scroll_offset() f64Operation on &ListBox: scroll offset.
lb &ListBoxListBox instance used by this call (borrow).f64 — a value of this type
(&ListBox) is_selectablepub fn (lb &ListBox) is_selectable() boolOperation on &ListBox: whether it is selectable.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
($&ListBox) set_selectablepub fn (lb $&ListBox) set_selectable(selectable bool)Operation on $&ListBox: set selectable.
lb $&ListBoxListBox instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&ListBox) has_popup_openpub fn (lb &ListBox) has_popup_open() boolOperation on &ListBox: whether it has popup open.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
(&ListBox) popup_boundspub fn (lb &ListBox) popup_bounds() layout.RectOperation on &ListBox: popup bounds.
lb &ListBoxListBox instance used by this call (borrow).layout.Rect — a value of this type
(&ListBox) cursorpub fn (lb &ListBox) cursor() intExecute cursor on &ListBox.
lb &ListBoxListBox instance used by this call (borrow).int — a value of this type
($&ListBox) set_localepub fn (lb $&ListBox) set_locale(locale &Locale) intOperation on $&ListBox: set locale. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&ListBox) set_viewportpub fn (lb $&ListBox) set_viewport(viewport &layout.Rect,context &draw.Context)Operation on $&ListBox: set viewport.
lb $&ListBoxListBox instance used by this call (exclusive borrow).viewport &layout.Rectcontext &draw.ContextThis call does not return a value.
($&ListBox) paint_popup_styledpub fn (lb $&ListBox) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&ListBox: paint popup styled.
lb $&ListBoxListBox instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&ListBox) dispose_auxpub fn (lb $&ListBox) dispose_aux()Operation on $&ListBox: dispose aux.
lb $&ListBoxListBox instance used by this call (exclusive borrow).This call does not return a value.
($&ListBox) set_styles_cachepub fn (lb $&ListBox) set_styles_cache(styles &Styles)Operation on $&ListBox: set styles cache.
lb $&ListBoxListBox instance used by this call (exclusive borrow).styles &StylesThis call does not return a value.
(&ListBox) style_snapshotpub fn (lb &ListBox) style_snapshot() StylesOperation on &ListBox: style snapshot.
lb &ListBoxListBox instance used by this call (borrow).Styles — a value of this type
(&ListBox) has_selection_for_rowpub fn (lb &ListBox) has_selection_for_row(row int) boolOperation on &ListBox: whether it has selection for row.
lb &ListBoxListBox instance used by this call (borrow).row intbool — true or false
(&ListBox) row_sel_anchorpub fn (lb &ListBox) row_sel_anchor() intOperation on &ListBox: row sel anchor.
lb &ListBoxListBox instance used by this call (borrow).int — a value of this type
(&ListBox) row_sel_focuspub fn (lb &ListBox) row_sel_focus() intOperation on &ListBox: row sel focus.
lb &ListBoxListBox instance used by this call (borrow).int — a value of this type
(&ListBox) selected_textpub fn (lb &ListBox) selected_text() stringOperation on &ListBox: selected text.
lb &ListBoxListBox instance used by this call (borrow).string — result string
($&ListBox) route_popuppub fn (lb $&ListBox) route_popup(event &ui.InputEvent) ActionOperation on $&ListBox: route popup.
lb $&ListBoxListBox instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&ListBox) handle_text_keypub fn (lb $&ListBox) handle_text_key(event &ui.InputEvent) ActionOperation on $&ListBox: handle text key.
lb $&ListBoxListBox instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&ListBox) ensure_row_textpub fn (lb $&ListBox) ensure_row_text(row int,col int,text &string,row_text &string)Operation on $&ListBox: ensure row text.
lb $&ListBoxListBox instance used by this call (exclusive borrow).row intcol inttext &stringrow_text &stringThis call does not return a value.
($&ListBox) open_row_menupub fn (lb $&ListBox) open_row_menu(context &draw.Context,x f64,y f64,text &string,row_text &string,row int,col int,show_row bool) boolOperation on $&ListBox: open row menu.
lb $&ListBoxListBox instance used by this call (exclusive borrow).context &draw.Contextx f64y f64text &stringrow_text &stringrow intcol intshow_row boolbool — true or false
($&ListBox) begin_row_pointerpub fn (lb $&ListBox) begin_row_pointer(text &string,row_text &string,idx int,row int,col int,event &ui.InputEvent) boolOperation on $&ListBox: begin row pointer.
lb $&ListBoxListBox instance used by this call (exclusive borrow).text &stringrow_text &stringidx introw intcol intevent &ui.InputEventbool — true or false
($&ListBox) should_begin_row_dragpub fn (lb $&ListBox) should_begin_row_drag(x f64,y f64,density f64) boolOperation on $&ListBox: should begin row drag.
lb $&ListBoxListBox instance used by this call (exclusive borrow).x f64y f64density f64bool — true or false
($&ListBox) drag_row_pointerpub fn (lb $&ListBox) drag_row_pointer(idx int) boolOperation on $&ListBox: drag row pointer.
lb $&ListBoxListBox instance used by this call (exclusive borrow).idx intbool — true or false
($&ListBox) end_row_pointerpub fn (lb $&ListBox) end_row_pointer()Operation on $&ListBox: end row pointer.
lb $&ListBoxListBox instance used by this call (exclusive borrow).This call does not return a value.
($&ListBox) clear_text_selectionpub fn (lb $&ListBox) clear_text_selection()Operation on $&ListBox: clear text selection.
lb $&ListBoxListBox instance used by this call (exclusive borrow).This call does not return a value.
(&ListBox) needs_paintpub fn (lb &ListBox) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
($&ListBox) paintedpub fn (lb $&ListBox) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
lb $&ListBoxListBox instance used by this call (exclusive borrow).This call does not return a value.
($&ListBox) invalidatepub fn (lb $&ListBox) invalidate()Invalidate the control area, requesting a repaint on next frame.
lb $&ListBoxListBox instance used by this call (exclusive borrow).This call does not return a value.
($&ListBox) cancelpub fn (lb $&ListBox) cancel()Execute cancel on $&ListBox.
lb $&ListBoxListBox instance used by this call (exclusive borrow).This call does not return a value.
(&ListBox) is_enabledpub fn (lb &ListBox) is_enabled() boolReturn whether the control is currently enabled.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
($&ListBox) set_enabledpub fn (lb $&ListBox) set_enabled(enabled bool)Operation on $&ListBox: set enabled.
lb $&ListBoxListBox instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&ListBox) is_focusedpub fn (lb &ListBox) is_focused() boolReturn whether the control currently has input focus.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
($&ListBox) set_focuspub fn (lb $&ListBox) set_focus(focused bool)Operation on $&ListBox: set focus.
lb $&ListBoxListBox instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&ListBox) is_hoveredpub fn (lb &ListBox) is_hovered() boolOperation on &ListBox: whether it is hovered.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
(&ListBox) is_invalidpub fn (lb &ListBox) is_invalid() boolOperation on &ListBox: whether it is invalid.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
($&ListBox) set_invalidpub fn (lb $&ListBox) set_invalid(invalid bool)Operation on $&ListBox: set invalid.
lb $&ListBoxListBox instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&ListBox) is_read_onlypub fn (lb &ListBox) is_read_only() boolOperation on &ListBox: whether it is read only.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
($&ListBox) set_read_onlypub fn (lb $&ListBox) set_read_only(read_only bool)Operation on $&ListBox: set read only.
lb $&ListBoxListBox instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
($&ListBox) set_scroll_offsetpub fn (lb $&ListBox) set_scroll_offset(offset f64) intOperation on $&ListBox: set scroll offset. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).offset f64int — a value of this type
($&ListBox) ensure_visiblepub fn (lb $&ListBox) ensure_visible(index int)Operation on $&ListBox: ensure visible.
lb $&ListBoxListBox instance used by this call (exclusive borrow).index intThis call does not return a value.
($&ListBox) set_countpub fn (lb $&ListBox) set_count(count int) intOperation on $&ListBox: set count. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).count intint — a value of this type
($&ListBox) set_selectedpub fn (lb $&ListBox) set_selected(index int) intOperation on $&ListBox: set selected. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).index intint — a value of this type
($&ListBox) set_boundspub fn (lb $&ListBox) set_bounds(bounds &layout.Rect) intOperation on $&ListBox: set bounds. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&ListBox) visual_statepub fn (lb &ListBox) visual_state() intOperation on &ListBox: visual state.
lb &ListBoxListBox instance used by this call (borrow).int — a value of this type
(&ListBox) item_visual_statepub fn (lb &ListBox) item_visual_state(index int) intOperation on &ListBox: item visual state.
lb &ListBoxListBox instance used by this call (borrow).index intint — a value of this type
(&ListBox) has_stylepub fn (lb &ListBox) has_style() boolOperation on &ListBox: whether it has style.
lb &ListBoxListBox instance used by this call (borrow).bool — true or false
(&ListBox) style_orpub fn (lb &ListBox) style_or(styles &Styles) ControlStyleOperation on &ListBox: style or.
lb &ListBoxListBox instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&ListBox) set_stylepub fn (lb $&ListBox) set_style(style &ControlStyle) intOperation on $&ListBox: set style. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&ListBox) clear_stylepub fn (lb $&ListBox) clear_style()Operation on $&ListBox: clear style.
lb $&ListBoxListBox instance used by this call (exclusive borrow).This call does not return a value.
($&ListBox) apply_stylespub fn (lb $&ListBox) apply_styles(styles &Styles) intApply resolved metrics before routing input, just as Scroll and Editor do. Painting, scrolling and pointer hit testing must share the same row geometry. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&ListBox) hit_rowpub fn (lb &ListBox) hit_row(x f64,y f64) intOperation on &ListBox: hit row.
lb &ListBoxListBox instance used by this call (borrow).x f64y f64int — a value of this type
($&ListBox) inputpub fn (lb $&ListBox) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&ListBox) eventpub fn (lb $&ListBox) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&ListBox) paintpub fn (lb &ListBox) paint(frame $&draw.Frame,labels &[]draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
lb &ListBoxListBox instance used by this call (borrow).frame $&draw.Framelabels &[]draw.TextLayouttheme &Themeint — a value of this type
(&ListBox) measure_styledpub fn (lb &ListBox) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeOperation on &ListBox: measure styled. Throws on failure; handle the error or propagate it to the caller.
lb &ListBoxListBox instance used by this call (borrow).label $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&ListBox) paint_box_styledpub fn (lb &ListBox) paint_box_styled(frame $&draw.Frame,styles &Styles) intOperation on &ListBox: paint box styled. Throws on failure; handle the error or propagate it to the caller.
lb &ListBoxListBox instance used by this call (borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&ListBox) paint_item_styledpub fn (lb &ListBox) paint_item_styled(frame $&draw.Frame,index int,label $&StyledLabel,styles &Styles) intOperation on &ListBox: paint item styled. Throws on failure; handle the error or propagate it to the caller.
lb &ListBoxListBox instance used by this call (borrow).frame $&draw.Frameindex intlabel $&StyledLabelstyles &Stylesint — a value of this type
(&ListBox) paint_styledpub fn (lb &ListBox) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &ListBox: paint styled. Throws on failure; handle the error or propagate it to the caller.
lb &ListBoxListBox instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
($&Stepper) set_repeatpub fn (st $&Stepper) set_repeat(enabled bool,delay time.Duration,interval time.Duration) intOperation on $&Stepper: set repeat. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).enabled booldelay time.Durationinterval time.Durationint — a value of this type
($&Stepper) apply_stylespub fn (st $&Stepper) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&Stepper) next_tickpub fn (st &Stepper) next_tick(now time.Instant) time.InstantOperation on &Stepper: next tick. Throws on failure; handle the error or propagate it to the caller.
st &StepperStepper instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&Stepper) tickpub fn (st $&Stepper) tick(now time.Instant) ActionAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).now time.InstantAction — input result with kind, id, repaint and focus requests.
struct Dividerpub struct Divider {
}Divider context or state structure.
This type has no public fields.
dividerpub fn divider(bounds &layout.Rect,axis int) DividerExecute divider. Throws on failure; handle the error or propagate it to the caller.
bounds &layout.Rectaxis intDivider — a value of this type
(&Divider) is_selectablepub fn (div &Divider) is_selectable() boolOperation on &Divider: whether it is selectable.
div &DividerDivider instance used by this call (borrow).bool — true or false
($&Divider) set_selectablepub fn (div $&Divider) set_selectable(selectable bool)Operation on $&Divider: set selectable.
div $&DividerDivider instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Divider) axispub fn (div &Divider) axis() intExecute axis on &Divider.
div &DividerDivider instance used by this call (borrow).int — a value of this type
($&Divider) set_axispub fn (div $&Divider) set_axis(axis int) intOperation on $&Divider: set axis. Throws on failure; handle the error or propagate it to the caller.
div $&DividerDivider instance used by this call (exclusive borrow).axis intint — a value of this type
(&Divider) boundspub fn (div &Divider) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
div &DividerDivider instance used by this call (borrow).layout.Rect — a value of this type
($&Divider) set_boundspub fn (div $&Divider) set_bounds(bounds &layout.Rect) intOperation on $&Divider: set bounds. Throws on failure; handle the error or propagate it to the caller.
div $&DividerDivider instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Divider) needs_paintpub fn (div &Divider) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
div &DividerDivider instance used by this call (borrow).bool — true or false
($&Divider) paintedpub fn (div $&Divider) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
div $&DividerDivider instance used by this call (exclusive borrow).This call does not return a value.
($&Divider) invalidatepub fn (div $&Divider) invalidate()Invalidate the control area, requesting a repaint on next frame.
div $&DividerDivider instance used by this call (exclusive borrow).This call does not return a value.
(&Divider) is_enabledpub fn (div &Divider) is_enabled() boolReturn whether the control is currently enabled.
div &DividerDivider instance used by this call (borrow).bool — true or false
($&Divider) set_enabledpub fn (div $&Divider) set_enabled(enabled bool)Operation on $&Divider: set enabled.
div $&DividerDivider instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Divider) is_invalidpub fn (div &Divider) is_invalid() boolOperation on &Divider: whether it is invalid.
div &DividerDivider instance used by this call (borrow).bool — true or false
($&Divider) set_invalidpub fn (div $&Divider) set_invalid(invalid bool)Operation on $&Divider: set invalid.
div $&DividerDivider instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Divider) is_selectedpub fn (div &Divider) is_selected() boolOperation on &Divider: whether it is selected.
div &DividerDivider instance used by this call (borrow).bool — true or false
($&Divider) set_selectedpub fn (div $&Divider) set_selected(selected bool)Operation on $&Divider: set selected.
div $&DividerDivider instance used by this call (exclusive borrow).selected boolThis call does not return a value.
(&Divider) visual_statepub fn (div &Divider) visual_state() intOperation on &Divider: visual state.
div &DividerDivider instance used by this call (borrow).int — a value of this type
(&Divider) has_stylepub fn (div &Divider) has_style() boolOperation on &Divider: whether it has style.
div &DividerDivider instance used by this call (borrow).bool — true or false
(&Divider) style_orpub fn (div &Divider) style_or(styles &Styles) ControlStyleOperation on &Divider: style or.
div &DividerDivider instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Divider) set_stylepub fn (div $&Divider) set_style(style &ControlStyle) intOperation on $&Divider: set style. Throws on failure; handle the error or propagate it to the caller.
div $&DividerDivider instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Divider) clear_stylepub fn (div $&Divider) clear_style()Operation on $&Divider: clear style.
div $&DividerDivider instance used by this call (exclusive borrow).This call does not return a value.
(&Divider) paintpub fn (div &Divider) paint(frame $&draw.Frame,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
div &DividerDivider instance used by this call (borrow).frame $&draw.Frametheme &Themeint — a value of this type
(&Divider) measure_styledpub fn (div &Divider) measure_styled(styles &Styles) layout.SizeOperation on &Divider: measure styled.
div &DividerDivider instance used by this call (borrow).styles &Styleslayout.Size — a value of this type
(&Divider) measure_labeled_styledpub fn (div &Divider) measure_labeled_styled(label $&StyledLabel,styles &Styles) layout.SizeOperation on &Divider: measure labeled styled. Throws on failure; handle the error or propagate it to the caller.
div &DividerDivider instance used by this call (borrow).label $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&Divider) paint_styledpub fn (div &Divider) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on &Divider: paint styled. Throws on failure; handle the error or propagate it to the caller.
div &DividerDivider instance used by this call (borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&Divider) paint_labeled_styledpub fn (div &Divider) paint_labeled_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Divider: paint labeled styled. Throws on failure; handle the error or propagate it to the caller.
div &DividerDivider instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
struct Badgepub struct Badge {
}Badge context or state structure.
This type has no public fields.
badgepub fn badge(bounds &layout.Rect) BadgeExecute badge. Throws on failure; handle the error or propagate it to the caller.
bounds &layout.RectBadge — a value of this type
(&Badge) is_selectablepub fn (bg &Badge) is_selectable() boolOperation on &Badge: whether it is selectable.
bg &BadgeBadge instance used by this call (borrow).bool — true or false
($&Badge) set_selectablepub fn (bg $&Badge) set_selectable(selectable bool)Operation on $&Badge: set selectable.
bg $&BadgeBadge instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Badge) boundspub fn (bg &Badge) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
bg &BadgeBadge instance used by this call (borrow).layout.Rect — a value of this type
($&Badge) set_boundspub fn (bg $&Badge) set_bounds(bounds &layout.Rect) intOperation on $&Badge: set bounds. Throws on failure; handle the error or propagate it to the caller.
bg $&BadgeBadge instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Badge) needs_paintpub fn (bg &Badge) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
bg &BadgeBadge instance used by this call (borrow).bool — true or false
($&Badge) paintedpub fn (bg $&Badge) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
bg $&BadgeBadge instance used by this call (exclusive borrow).This call does not return a value.
($&Badge) invalidatepub fn (bg $&Badge) invalidate()Invalidate the control area, requesting a repaint on next frame.
bg $&BadgeBadge instance used by this call (exclusive borrow).This call does not return a value.
(&Badge) is_enabledpub fn (bg &Badge) is_enabled() boolReturn whether the control is currently enabled.
bg &BadgeBadge instance used by this call (borrow).bool — true or false
($&Badge) set_enabledpub fn (bg $&Badge) set_enabled(enabled bool)Operation on $&Badge: set enabled.
bg $&BadgeBadge instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Badge) is_selectedpub fn (bg &Badge) is_selected() boolOperation on &Badge: whether it is selected.
bg &BadgeBadge instance used by this call (borrow).bool — true or false
($&Badge) set_selectedpub fn (bg $&Badge) set_selected(selected bool)Operation on $&Badge: set selected.
bg $&BadgeBadge instance used by this call (exclusive borrow).selected boolThis call does not return a value.
(&Badge) is_invalidpub fn (bg &Badge) is_invalid() boolOperation on &Badge: whether it is invalid.
bg &BadgeBadge instance used by this call (borrow).bool — true or false
($&Badge) set_invalidpub fn (bg $&Badge) set_invalid(invalid bool)Operation on $&Badge: set invalid.
bg $&BadgeBadge instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Badge) is_focusedpub fn (bg &Badge) is_focused() boolReturn whether the control currently has input focus.
bg &BadgeBadge instance used by this call (borrow).bool — true or false
($&Badge) set_focuspub fn (bg $&Badge) set_focus(focused bool)Operation on $&Badge: set focus.
bg $&BadgeBadge instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&Badge) is_hoveredpub fn (bg &Badge) is_hovered() boolOperation on &Badge: whether it is hovered.
bg &BadgeBadge instance used by this call (borrow).bool — true or false
($&Badge) set_hoveredpub fn (bg $&Badge) set_hovered(hovered bool)Operation on $&Badge: set hovered.
bg $&BadgeBadge instance used by this call (exclusive borrow).hovered boolThis call does not return a value.
(&Badge) visual_statepub fn (bg &Badge) visual_state() intOperation on &Badge: visual state.
bg &BadgeBadge instance used by this call (borrow).int — a value of this type
(&Badge) has_stylepub fn (bg &Badge) has_style() boolOperation on &Badge: whether it has style.
bg &BadgeBadge instance used by this call (borrow).bool — true or false
(&Badge) style_orpub fn (bg &Badge) style_or(styles &Styles) ControlStyleOperation on &Badge: style or.
bg &BadgeBadge instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Badge) set_stylepub fn (bg $&Badge) set_style(style &ControlStyle) intOperation on $&Badge: set style. Throws on failure; handle the error or propagate it to the caller.
bg $&BadgeBadge instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Badge) clear_stylepub fn (bg $&Badge) clear_style()Operation on $&Badge: clear style.
bg $&BadgeBadge instance used by this call (exclusive borrow).This call does not return a value.
(&Badge) paintpub fn (bg &Badge) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
bg &BadgeBadge instance used by this call (borrow).frame $&draw.Framelabel &draw.TextLayouttheme &Themeint — a value of this type
(&Badge) measure_styledpub fn (bg &Badge) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeOperation on &Badge: measure styled. Throws on failure; handle the error or propagate it to the caller.
bg &BadgeBadge instance used by this call (borrow).label $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&Badge) paint_styledpub fn (bg &Badge) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Badge: paint styled. Throws on failure; handle the error or propagate it to the caller.
bg &BadgeBadge instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
struct Cardpub struct Card {
}Card context or state structure.
This type has no public fields.
cardpub fn card(bounds &layout.Rect) CardExecute card. Throws on failure; handle the error or propagate it to the caller.
bounds &layout.RectCard — a value of this type
(&Card) is_selectablepub fn (cd &Card) is_selectable() boolOperation on &Card: whether it is selectable.
cd &CardCard instance used by this call (borrow).bool — true or false
($&Card) set_selectablepub fn (cd $&Card) set_selectable(selectable bool)Operation on $&Card: set selectable.
cd $&CardCard instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Card) boundspub fn (cd &Card) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
cd &CardCard instance used by this call (borrow).layout.Rect — a value of this type
($&Card) set_boundspub fn (cd $&Card) set_bounds(bounds &layout.Rect) intOperation on $&Card: set bounds. Throws on failure; handle the error or propagate it to the caller.
cd $&CardCard instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Card) content_boundspub fn (cd &Card) content_bounds(styles &Styles) layout.RectOperation on &Card: content bounds.
cd &CardCard instance used by this call (borrow).styles &Styleslayout.Rect — a value of this type
(&Card) needs_paintpub fn (cd &Card) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
cd &CardCard instance used by this call (borrow).bool — true or false
($&Card) paintedpub fn (cd $&Card) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
cd $&CardCard instance used by this call (exclusive borrow).This call does not return a value.
($&Card) invalidatepub fn (cd $&Card) invalidate()Invalidate the control area, requesting a repaint on next frame.
cd $&CardCard instance used by this call (exclusive borrow).This call does not return a value.
(&Card) is_enabledpub fn (cd &Card) is_enabled() boolReturn whether the control is currently enabled.
cd &CardCard instance used by this call (borrow).bool — true or false
($&Card) set_enabledpub fn (cd $&Card) set_enabled(enabled bool)Operation on $&Card: set enabled.
cd $&CardCard instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Card) is_selectedpub fn (cd &Card) is_selected() boolOperation on &Card: whether it is selected.
cd &CardCard instance used by this call (borrow).bool — true or false
($&Card) set_selectedpub fn (cd $&Card) set_selected(selected bool)Operation on $&Card: set selected.
cd $&CardCard instance used by this call (exclusive borrow).selected boolThis call does not return a value.
(&Card) is_invalidpub fn (cd &Card) is_invalid() boolOperation on &Card: whether it is invalid.
cd &CardCard instance used by this call (borrow).bool — true or false
($&Card) set_invalidpub fn (cd $&Card) set_invalid(invalid bool)Operation on $&Card: set invalid.
cd $&CardCard instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Card) is_focusedpub fn (cd &Card) is_focused() boolReturn whether the control currently has input focus.
cd &CardCard instance used by this call (borrow).bool — true or false
($&Card) set_focuspub fn (cd $&Card) set_focus(focused bool)Operation on $&Card: set focus.
cd $&CardCard instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&Card) is_hoveredpub fn (cd &Card) is_hovered() boolOperation on &Card: whether it is hovered.
cd &CardCard instance used by this call (borrow).bool — true or false
($&Card) set_hoveredpub fn (cd $&Card) set_hovered(hovered bool)Operation on $&Card: set hovered.
cd $&CardCard instance used by this call (exclusive borrow).hovered boolThis call does not return a value.
(&Card) visual_statepub fn (cd &Card) visual_state() intOperation on &Card: visual state.
cd &CardCard instance used by this call (borrow).int — a value of this type
(&Card) has_stylepub fn (cd &Card) has_style() boolOperation on &Card: whether it has style.
cd &CardCard instance used by this call (borrow).bool — true or false
(&Card) style_orpub fn (cd &Card) style_or(styles &Styles) ControlStyleOperation on &Card: style or.
cd &CardCard instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Card) set_stylepub fn (cd $&Card) set_style(style &ControlStyle) intOperation on $&Card: set style. Throws on failure; handle the error or propagate it to the caller.
cd $&CardCard instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Card) clear_stylepub fn (cd $&Card) clear_style()Operation on $&Card: clear style.
cd $&CardCard instance used by this call (exclusive borrow).This call does not return a value.
(&Card) paintpub fn (cd &Card) paint(frame $&draw.Frame,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
cd &CardCard instance used by this call (borrow).frame $&draw.Frametheme &Themeint — a value of this type
(&Card) measure_styledpub fn (cd &Card) measure_styled(styles &Styles) layout.SizeOperation on &Card: measure styled.
cd &CardCard instance used by this call (borrow).styles &Styleslayout.Size — a value of this type
(&Card) measure_header_styledpub fn (cd &Card) measure_header_styled(title $&StyledLabel,styles &Styles) layout.SizeOperation on &Card: measure header styled. Throws on failure; handle the error or propagate it to the caller.
cd &CardCard instance used by this call (borrow).title $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&Card) paint_styledpub fn (cd &Card) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on &Card: paint styled. Throws on failure; handle the error or propagate it to the caller.
cd &CardCard instance used by this call (borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&Card) paint_header_styledpub fn (cd &Card) paint_header_styled(frame $&draw.Frame,title $&StyledLabel,styles &Styles) intOperation on &Card: paint header styled. Throws on failure; handle the error or propagate it to the caller.
cd &CardCard instance used by this call (borrow).frame $&draw.Frametitle $&StyledLabelstyles &Stylesint — a value of this type
($&Badge) set_tonepub fn (bg $&Badge) set_tone(tone int) intOperation on $&Badge: set tone. Throws on failure; handle the error or propagate it to the caller.
bg $&BadgeBadge instance used by this call (exclusive borrow).tone intint — a value of this type
struct Tabspub struct Tabs {
}Tabs context or state structure.
This type has no public fields.
tabspub fn tabs(identity &ui.CanvasEvent,id int,bounds &layout.Rect,count int,selected int) TabsExecute tabs. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectcount intselected intTabs — a value of this type
(&Tabs) is_selectablepub fn (t &Tabs) is_selectable() boolOperation on &Tabs: whether it is selectable.
t &TabsTabs instance used by this call (borrow).bool — true or false
($&Tabs) set_selectablepub fn (t $&Tabs) set_selectable(selectable bool)Operation on $&Tabs: set selectable.
t $&TabsTabs instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
segmentedpub fn segmented(identity &ui.CanvasEvent,id int,bounds &layout.Rect,count int,selected int) TabsExecute segmented. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectcount intselected intTabs — a value of this type
(&Tabs) idpub fn (t &Tabs) id() intReturn the unique integer ID of the element or control.
t &TabsTabs instance used by this call (borrow).int — a value of this type
(&Tabs) boundspub fn (t &Tabs) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
t &TabsTabs instance used by this call (borrow).layout.Rect — a value of this type
(&Tabs) countpub fn (t &Tabs) count() intReturn the number of items in this control.
t &TabsTabs instance used by this call (borrow).int — a value of this type
(&Tabs) selectedpub fn (t &Tabs) selected() intGet or test the currently selected index, node, or state.
t &TabsTabs instance used by this call (borrow).int — a value of this type
(&Tabs) hovered_itempub fn (t &Tabs) hovered_item() intOperation on &Tabs: hovered item.
t &TabsTabs instance used by this call (borrow).int — a value of this type
(&Tabs) needs_paintpub fn (t &Tabs) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
t &TabsTabs instance used by this call (borrow).bool — true or false
($&Tabs) paintedpub fn (t $&Tabs) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
t $&TabsTabs instance used by this call (exclusive borrow).This call does not return a value.
($&Tabs) invalidatepub fn (t $&Tabs) invalidate()Invalidate the control area, requesting a repaint on next frame.
t $&TabsTabs instance used by this call (exclusive borrow).This call does not return a value.
($&Tabs) cancelpub fn (t $&Tabs) cancel()Execute cancel on $&Tabs.
t $&TabsTabs instance used by this call (exclusive borrow).This call does not return a value.
(&Tabs) is_enabledpub fn (t &Tabs) is_enabled() boolReturn whether the control is currently enabled.
t &TabsTabs instance used by this call (borrow).bool — true or false
($&Tabs) set_enabledpub fn (t $&Tabs) set_enabled(enabled bool)Operation on $&Tabs: set enabled.
t $&TabsTabs instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Tabs) is_focusedpub fn (t &Tabs) is_focused() boolReturn whether the control currently has input focus.
t &TabsTabs instance used by this call (borrow).bool — true or false
($&Tabs) set_focuspub fn (t $&Tabs) set_focus(focused bool)Operation on $&Tabs: set focus.
t $&TabsTabs instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&Tabs) is_hoveredpub fn (t &Tabs) is_hovered() boolOperation on &Tabs: whether it is hovered.
t &TabsTabs instance used by this call (borrow).bool — true or false
(&Tabs) is_invalidpub fn (t &Tabs) is_invalid() boolOperation on &Tabs: whether it is invalid.
t &TabsTabs instance used by this call (borrow).bool — true or false
($&Tabs) set_invalidpub fn (t $&Tabs) set_invalid(invalid bool)Operation on $&Tabs: set invalid.
t $&TabsTabs instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Tabs) is_read_onlypub fn (t &Tabs) is_read_only() boolOperation on &Tabs: whether it is read only.
t &TabsTabs instance used by this call (borrow).bool — true or false
($&Tabs) set_read_onlypub fn (t $&Tabs) set_read_only(read_only bool)Operation on $&Tabs: set read only.
t $&TabsTabs instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
($&Tabs) set_countpub fn (t $&Tabs) set_count(count int) intOperation on $&Tabs: set count. Throws on failure; handle the error or propagate it to the caller.
t $&TabsTabs instance used by this call (exclusive borrow).count intint — a value of this type
($&Tabs) set_selectedpub fn (t $&Tabs) set_selected(index int) intOperation on $&Tabs: set selected. Throws on failure; handle the error or propagate it to the caller.
t $&TabsTabs instance used by this call (exclusive borrow).index intint — a value of this type
($&Tabs) set_boundspub fn (t $&Tabs) set_bounds(bounds &layout.Rect) intOperation on $&Tabs: set bounds. Throws on failure; handle the error or propagate it to the caller.
t $&TabsTabs instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Tabs) visual_statepub fn (t &Tabs) visual_state() intOperation on &Tabs: visual state.
t &TabsTabs instance used by this call (borrow).int — a value of this type
(&Tabs) item_visual_statepub fn (t &Tabs) item_visual_state(index int) intOperation on &Tabs: item visual state.
t &TabsTabs instance used by this call (borrow).index intint — a value of this type
(&Tabs) has_stylepub fn (t &Tabs) has_style() boolOperation on &Tabs: whether it has style.
t &TabsTabs instance used by this call (borrow).bool — true or false
(&Tabs) style_orpub fn (t &Tabs) style_or(styles &Styles) ControlStyleOperation on &Tabs: style or.
t &TabsTabs instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Tabs) set_stylepub fn (t $&Tabs) set_style(style &ControlStyle) intOperation on $&Tabs: set style. Throws on failure; handle the error or propagate it to the caller.
t $&TabsTabs instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Tabs) clear_stylepub fn (t $&Tabs) clear_style()Operation on $&Tabs: clear style.
t $&TabsTabs instance used by this call (exclusive borrow).This call does not return a value.
(&Tabs) item_boundspub fn (t &Tabs) item_bounds(index int,styles &Styles) layout.RectOperation on &Tabs: item bounds.
t &TabsTabs instance used by this call (borrow).index intstyles &Styleslayout.Rect — a value of this type
($&Tabs) apply_stylespub fn (t $&Tabs) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
t $&TabsTabs instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
($&Tabs) set_item_widthspub fn (t $&Tabs) set_item_widths(widths &[]f64) intOperation on $&Tabs: set item widths. Throws on failure; handle the error or propagate it to the caller.
t $&TabsTabs instance used by this call (exclusive borrow).widths &[]f64int — a value of this type
($&Tabs) set_automatic_activationpub fn (t $&Tabs) set_automatic_activation(automatic bool)Operation on $&Tabs: set automatic activation.
t $&TabsTabs instance used by this call (exclusive borrow).automatic boolThis call does not return a value.
($&Tabs) inputpub fn (t $&Tabs) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
t $&TabsTabs instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Tabs) eventpub fn (t $&Tabs) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
t $&TabsTabs instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Tabs) paintpub fn (t &Tabs) paint(frame $&draw.Frame,labels &[]draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
t &TabsTabs instance used by this call (borrow).frame $&draw.Framelabels &[]draw.TextLayouttheme &Themeint — a value of this type
(&Tabs) measure_styledpub fn (t &Tabs) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeOperation on &Tabs: measure styled. Throws on failure; handle the error or propagate it to the caller.
t &TabsTabs instance used by this call (borrow).label $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&Tabs) paint_box_styledpub fn (t &Tabs) paint_box_styled(frame $&draw.Frame,styles &Styles) intOperation on &Tabs: paint box styled. Throws on failure; handle the error or propagate it to the caller.
t &TabsTabs instance used by this call (borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&Tabs) paint_tab_styledpub fn (t &Tabs) paint_tab_styled(frame $&draw.Frame,index int,label $&StyledLabel,styles &Styles) intOperation on &Tabs: paint tab styled. Throws on failure; handle the error or propagate it to the caller.
t &TabsTabs instance used by this call (borrow).frame $&draw.Frameindex intlabel $&StyledLabelstyles &Stylesint — a value of this type
(&Tabs) paint_styledpub fn (t &Tabs) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Tabs: paint styled. Throws on failure; handle the error or propagate it to the caller.
t &TabsTabs instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
struct Selectpub struct Select {
}Select context or state structure.
This type has no public fields.
select_boxpub fn select_box(identity &ui.CanvasEvent,id int,bounds &layout.Rect,count int,selected int) SelectSelect box. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectcount intselected intSelect — a value of this type
(&Select) is_selectablepub fn (sel &Select) is_selectable() boolOperation on &Select: whether it is selectable.
sel &SelectSelect instance used by this call (borrow).bool — true or false
($&Select) set_selectablepub fn (sel $&Select) set_selectable(selectable bool)Operation on $&Select: set selectable.
sel $&SelectSelect instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Select) idpub fn (sel &Select) id() intReturn the unique integer ID of the element or control.
sel &SelectSelect instance used by this call (borrow).int — a value of this type
(&Select) boundspub fn (sel &Select) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
sel &SelectSelect instance used by this call (borrow).layout.Rect — a value of this type
(&Select) countpub fn (sel &Select) count() intReturn the number of items in this control.
sel &SelectSelect instance used by this call (borrow).int — a value of this type
(&Select) selectedpub fn (sel &Select) selected() intGet or test the currently selected index, node, or state.
sel &SelectSelect instance used by this call (borrow).int — a value of this type
(&Select) is_openpub fn (sel &Select) is_open() boolReturn whether the overlay, menu or dialog is currently open.
sel &SelectSelect instance used by this call (borrow).bool — true or false
(&Select) hovered_optionpub fn (sel &Select) hovered_option() intReturn the hovered option index, or -1 when no option is hovered.
sel &SelectSelect instance used by this call (borrow).int — a value of this type
(&Select) needs_paintpub fn (sel &Select) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
sel &SelectSelect instance used by this call (borrow).bool — true or false
($&Select) paintedpub fn (sel $&Select) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
sel $&SelectSelect instance used by this call (exclusive borrow).This call does not return a value.
($&Select) invalidatepub fn (sel $&Select) invalidate()Invalidate the control area, requesting a repaint on next frame.
sel $&SelectSelect instance used by this call (exclusive borrow).This call does not return a value.
($&Select) cancelpub fn (sel $&Select) cancel()Execute cancel on $&Select.
sel $&SelectSelect instance used by this call (exclusive borrow).This call does not return a value.
(&Select) is_enabledpub fn (sel &Select) is_enabled() boolReturn whether the control is currently enabled.
sel &SelectSelect instance used by this call (borrow).bool — true or false
($&Select) set_enabledpub fn (sel $&Select) set_enabled(enabled bool)Operation on $&Select: set enabled.
sel $&SelectSelect instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Select) is_focusedpub fn (sel &Select) is_focused() boolReturn whether the control currently has input focus.
sel &SelectSelect instance used by this call (borrow).bool — true or false
($&Select) set_focuspub fn (sel $&Select) set_focus(focused bool)Operation on $&Select: set focus.
sel $&SelectSelect instance used by this call (exclusive borrow).focused boolThis call does not return a value.
(&Select) is_hoveredpub fn (sel &Select) is_hovered() boolOperation on &Select: whether it is hovered.
sel &SelectSelect instance used by this call (borrow).bool — true or false
(&Select) is_invalidpub fn (sel &Select) is_invalid() boolOperation on &Select: whether it is invalid.
sel &SelectSelect instance used by this call (borrow).bool — true or false
($&Select) set_invalidpub fn (sel $&Select) set_invalid(invalid bool)Operation on $&Select: set invalid.
sel $&SelectSelect instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Select) is_read_onlypub fn (sel &Select) is_read_only() boolOperation on &Select: whether it is read only.
sel &SelectSelect instance used by this call (borrow).bool — true or false
($&Select) set_read_onlypub fn (sel $&Select) set_read_only(read_only bool)Operation on $&Select: set read only.
sel $&SelectSelect instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
($&Select) set_openpub fn (sel $&Select) set_open(open bool)Operation on $&Select: set open.
sel $&SelectSelect instance used by this call (exclusive borrow).open boolThis call does not return a value.
($&Select) set_countpub fn (sel $&Select) set_count(count int) intOperation on $&Select: set count. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).count intint — a value of this type
($&Select) set_selectedpub fn (sel $&Select) set_selected(index int) intOperation on $&Select: set selected. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).index intint — a value of this type
($&Select) set_boundspub fn (sel $&Select) set_bounds(bounds &layout.Rect) intOperation on $&Select: set bounds. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Select) visual_statepub fn (sel &Select) visual_state() intOperation on &Select: visual state.
sel &SelectSelect instance used by this call (borrow).int — a value of this type
(&Select) has_stylepub fn (sel &Select) has_style() boolOperation on &Select: whether it has style.
sel &SelectSelect instance used by this call (borrow).bool — true or false
(&Select) style_orpub fn (sel &Select) style_or(styles &Styles) ControlStyleOperation on &Select: style or.
sel &SelectSelect instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Select) set_stylepub fn (sel $&Select) set_style(style &ControlStyle) intOperation on $&Select: set style. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Select) clear_stylepub fn (sel $&Select) clear_style()Operation on $&Select: clear style.
sel $&SelectSelect instance used by this call (exclusive borrow).This call does not return a value.
(&Select) popup_boundspub fn (sel &Select) popup_bounds(styles &Styles) layout.RectOperation on &Select: popup bounds.
sel &SelectSelect instance used by this call (borrow).styles &Styleslayout.Rect — a value of this type
($&Select) set_popup_abovepub fn (sel $&Select) set_popup_above(above bool)Operation on $&Select: set popup above.
sel $&SelectSelect instance used by this call (exclusive borrow).above boolThis call does not return a value.
($&Select) apply_stylespub fn (sel $&Select) apply_styles(styles &Styles) intKeep the input geometry synchronized with popup_bounds/option_bounds. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&Select) option_boundspub fn (sel &Select) option_bounds(index int,styles &Styles) layout.RectOperation on &Select: option bounds.
sel &SelectSelect instance used by this call (borrow).index intstyles &Styleslayout.Rect — a value of this type
($&Select) inputpub fn (sel $&Select) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
sel $&SelectSelect instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Select) eventpub fn (sel $&Select) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Select) paintpub fn (sel &Select) paint(frame $&draw.Frame,labels &[]draw.TextLayout,theme &Theme) intPaint the control visually onto the target canvas. Throws on failure; handle the error or propagate it to the caller.
sel &SelectSelect instance used by this call (borrow).frame $&draw.Framelabels &[]draw.TextLayouttheme &Themeint — a value of this type
(&Select) measure_styledpub fn (sel &Select) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeOperation on &Select: measure styled. Throws on failure; handle the error or propagate it to the caller.
sel &SelectSelect instance used by this call (borrow).label $&StyledLabelstyles &Styleslayout.Size — a value of this type
(&Select) paint_styledpub fn (sel &Select) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Select: paint styled. Throws on failure; handle the error or propagate it to the caller.
sel &SelectSelect instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
(&Select) paint_popup_box_styledpub fn (sel &Select) paint_popup_box_styled(frame $&draw.Frame,styles &Styles) intOperation on &Select: paint popup box styled. Throws on failure; handle the error or propagate it to the caller.
sel &SelectSelect instance used by this call (borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&Select) paint_option_styledpub fn (sel &Select) paint_option_styled(frame $&draw.Frame,index int,label $&StyledLabel,styles &Styles) intOperation on &Select: paint option styled. Throws on failure; handle the error or propagate it to the caller.
sel &SelectSelect instance used by this call (borrow).frame $&draw.Frameindex intlabel $&StyledLabelstyles &Stylesint — a value of this type
(&Select) paint_popup_styledpub fn (sel &Select) paint_popup_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Select: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
sel &SelectSelect instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
($&Select) set_option_enabledpub fn (sel $&Select) set_option_enabled(index int,enabled bool) intOperation on $&Select: set option enabled. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).index intenabled boolint — a value of this type
($&Select) set_popup_rowspub fn (sel $&Select) set_popup_rows(rows int) intOperation on $&Select: set popup rows. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).rows intint — a value of this type
(&Tabs) is_automaticpub fn (t &Tabs) is_automatic() boolOperation on &Tabs: whether it is automatic.
t &TabsTabs instance used by this call (borrow).bool — true or false
struct DatePickerpub struct DatePicker {
}A date field with an overlay calendar. Time and nanoseconds are preserved dates are interpreted in UTC, matching time.Time's calendar accessors.
This type has no public fields.
date_pickerpub fn date_picker(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value time.Time) DatePickerDate picker. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectvalue time.TimeDatePicker — a value of this type
(&DatePicker) idpub fn (picker &DatePicker) id() intReturn the unique integer ID of the element or control.
picker &DatePickerDatePicker instance used by this call (borrow).int — a value of this type
(&DatePicker) boundspub fn (picker &DatePicker) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
picker &DatePickerDatePicker instance used by this call (borrow).layout.Rect — a value of this type
(&DatePicker) valuepub fn (picker &DatePicker) value() time.TimeExecute value on &DatePicker.
picker &DatePickerDatePicker instance used by this call (borrow).time.Time — a value of this type
(&DatePicker) is_openpub fn (picker &DatePicker) is_open() boolReturn whether the overlay, menu or dialog is currently open.
picker &DatePickerDatePicker instance used by this call (borrow).bool — true or false
(&DatePicker) is_selectablepub fn (picker &DatePicker) is_selectable() boolOperation on &DatePicker: whether it is selectable.
picker &DatePickerDatePicker instance used by this call (borrow).bool — true or false
($&DatePicker) set_selectablepub fn (picker $&DatePicker) set_selectable(selectable bool)Operation on $&DatePicker: set selectable.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&DatePicker) needs_paintpub fn (picker &DatePicker) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
picker &DatePickerDatePicker instance used by this call (borrow).bool — true or false
(&DatePicker) visual_statepub fn (picker &DatePicker) visual_state() intOperation on &DatePicker: visual state.
picker &DatePickerDatePicker instance used by this call (borrow).int — a value of this type
(&DatePicker) style_orpub fn (picker &DatePicker) style_or(styles &Styles) ControlStyleOperation on &DatePicker: style or.
picker &DatePickerDatePicker instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&DatePicker) set_stylepub fn (picker $&DatePicker) set_style(style &ControlStyle) intOperation on $&DatePicker: set style. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&DatePicker) set_enabledpub fn (picker $&DatePicker) set_enabled(enabled bool)Operation on $&DatePicker: set enabled.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&DatePicker) set_read_onlypub fn (picker $&DatePicker) set_read_only(read_only bool) intOperation on $&DatePicker: set read only. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).read_only boolint — a value of this type
($&DatePicker) set_invalidpub fn (picker $&DatePicker) set_invalid(invalid bool)Operation on $&DatePicker: set invalid.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&DatePicker) set_focuspub fn (picker $&DatePicker) set_focus(focused bool)Operation on $&DatePicker: set focus.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&DatePicker) set_boundspub fn (picker $&DatePicker) set_bounds(bounds &layout.Rect) intOperation on $&DatePicker: set bounds. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&DatePicker) set_valuepub fn (picker $&DatePicker) set_value(value time.Time) intOperation on $&DatePicker: set value. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).value time.Timeint — a value of this type
($&DatePicker) set_rangepub fn (picker $&DatePicker) set_range(minimum time.Time,maximum time.Time) intOperation on $&DatePicker: set range. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).minimum time.Timemaximum time.Timeint — a value of this type
($&DatePicker) set_openpub fn (picker $&DatePicker) set_open(open bool)Operation on $&DatePicker: set open.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).open boolThis call does not return a value.
($&DatePicker) set_popup_abovepub fn (picker $&DatePicker) set_popup_above(above bool)Operation on $&DatePicker: set popup above.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).above boolThis call does not return a value.
($&DatePicker) apply_stylespub fn (picker $&DatePicker) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&DatePicker) popup_boundspub fn (picker &DatePicker) popup_bounds() layout.RectOperation on &DatePicker: popup bounds.
picker &DatePickerDatePicker instance used by this call (borrow).layout.Rect — a value of this type
(&DatePicker) calendar_cellpub fn (picker &DatePicker) calendar_cell(index int) layout.Rect0..41 follow the configured first weekday; 42/43 are previous/next month. Throws on failure; handle the error or propagate it to the caller.
picker &DatePickerDatePicker instance used by this call (borrow).index intlayout.Rect — a value of this type
(&DatePicker) calendar_datepub fn (picker &DatePicker) calendar_date(index int) time.TimeOperation on &DatePicker: calendar date. Throws on failure; handle the error or propagate it to the caller.
picker &DatePickerDatePicker instance used by this call (borrow).index inttime.Time — a value of this type
($&DatePicker) inputpub fn (picker $&DatePicker) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&DatePicker) routepub fn (picker $&DatePicker) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&DatePicker) measure_styledpub fn (picker $&DatePicker) measure_styled(styles &Styles) layout.SizeOperation on $&DatePicker: measure styled. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&DatePicker) paint_styledpub fn (picker $&DatePicker) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&DatePicker: paint styled. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&DatePicker) paint_popup_styledpub fn (picker $&DatePicker) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&DatePicker: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&DatePicker) disposepub fn (picker $&DatePicker) dispose()Release and dispose native resources and underlying handles.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).This call does not return a value.
(&DatePicker) has_valuepub fn (picker &DatePicker) has_value() boolOperation on &DatePicker: whether it has value.
picker &DatePickerDatePicker instance used by this call (borrow).bool — true or false
($&DatePicker) set_clearablepub fn (picker $&DatePicker) set_clearable(enabled bool)Operation on $&DatePicker: set clearable.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&DatePicker) clearpub fn (picker $&DatePicker) clear() intClear all buffered or stored entries and internal state. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).int — a value of this type
($&DatePicker) set_todaypub fn (picker $&DatePicker) set_today(today time.Time) intThe application supplies today in its intended timezone. Throws on failure; handle the error or propagate it to the caller.
picker $&DatePickerDatePicker instance used by this call (exclusive borrow).today time.Timeint — a value of this type
const ACTION_SUBMITpub const ACTION_SUBMIT = 4Constant ACTION_SUBMIT, defining protocol or algorithm parameters.
struct Editorpub struct Editor {
}Input and TextArea share one persistent editor. Native TextInput owns edits while focused; this model owns the committed value between focus lifetimes.
This type has no public fields.
inputpub fn input(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value &string) EditorCreate a persistent single-line Editor. Text is at most 16384 UTF-8 bytes without NUL; Context must match the window identity.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectvalue &stringan owned Editor; dispose on closure
text_areapub fn text_area(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value &string) EditorCreate a persistent multiline Editor. Text is at most 16384 UTF-8 bytes without NUL; Context must match the window identity.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectvalue &stringan owned Editor; dispose on closure
(&Editor) idpub fn (editor &Editor) id() intReturn the unique integer ID of the element or control.
editor &EditorEditor instance used by this call (borrow).int — a value of this type
(&Editor) valuepub fn (editor &Editor) value() stringExecute value on &Editor.
editor &EditorEditor instance used by this call (borrow).string — result string
(&Editor) has_selectionpub fn (editor &Editor) has_selection() boolOperation on &Editor: whether it has selection.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) selection_rangepub fn (editor &Editor) selection_range() TextRangeOperation on &Editor: selection range.
editor &EditorEditor instance used by this call (borrow).TextRange — a value of this type
(&Editor) selected_textpub fn (editor &Editor) selected_text() stringOperation on &Editor: selected text.
editor &EditorEditor instance used by this call (borrow).string — result string
(&Editor) is_passwordpub fn (editor &Editor) is_password() boolOperation on &Editor: whether it is password.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) is_password_visiblepub fn (editor &Editor) is_password_visible() boolOperation on &Editor: whether it is password visible.
editor &EditorEditor instance used by this call (borrow).bool — true or false
($&Editor) set_passwordpub fn (editor $&Editor) set_password(on bool) intOperation on $&Editor: set password. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).on boolint — a value of this type
($&Editor) set_password_visiblepub fn (editor $&Editor) set_password_visible(visible bool) intOperation on $&Editor: set password visible. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).visible boolint — a value of this type
(&Editor) is_focusedpub fn (editor &Editor) is_focused() boolReturn whether the control currently has input focus.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) is_enabledpub fn (editor &Editor) is_enabled() boolReturn whether the control is currently enabled.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) is_selectablepub fn (editor &Editor) is_selectable() boolOperation on &Editor: whether it is selectable.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) has_popup_openpub fn (editor &Editor) has_popup_open() boolOperation on &Editor: whether it has popup open.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) popup_boundspub fn (editor &Editor) popup_bounds() layout.RectOperation on &Editor: popup bounds.
editor &EditorEditor instance used by this call (borrow).layout.Rect — a value of this type
(&Editor) cursorpub fn (editor &Editor) cursor() intExecute cursor on &Editor.
editor &EditorEditor instance used by this call (borrow).int — a value of this type
(&Editor) needs_paintpub fn (editor &Editor) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
editor &EditorEditor instance used by this call (borrow).bool — true or false
($&Editor) paintedpub fn (editor $&Editor) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
editor $&EditorEditor instance used by this call (exclusive borrow).This call does not return a value.
($&Editor) set_localepub fn (editor $&Editor) set_locale(locale &Locale) intOperation on $&Editor: set locale. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&Editor) set_viewportpub fn (editor $&Editor) set_viewport(viewport &layout.Rect)Operation on $&Editor: set viewport.
editor $&EditorEditor instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&Editor) set_selectablepub fn (editor $&Editor) set_selectable(selectable bool) intOperation on $&Editor: set selectable. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).selectable boolint — a value of this type
($&Editor) paint_popup_styledpub fn (editor $&Editor) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Editor: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Editor) set_placeholderpub fn (editor $&Editor) set_placeholder(value &string) intOperation on $&Editor: set placeholder. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).value &stringint — a value of this type
($&Editor) focus_sessionpub fn (editor $&Editor) focus_session(on bool) intChange editing focus and native session lifetime; committed text persists on blur.
editor $&EditorEditor instance used by this call (exclusive borrow).on bool0 on success; throws on failure
($&Editor) enablepub fn (editor $&Editor) enable(on bool) intExecute enable on $&Editor. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).on boolint — a value of this type
($&Editor) placepub fn (editor $&Editor) place(bounds &layout.Rect) intSet canvas-global bounds after layout or ancestor scrolling to synchronize native IME geometry.
editor $&EditorEditor instance used by this call (exclusive borrow).bounds &layout.Rect0 on success; throws on failure
place_editorpub fn place_editor(view $&View,editor $&Editor) intGet canvas-global editor bounds from View, synchronize IME, enable outside capture and propagate dirty state.
view $&Vieweditor $&Editor0 on success; throws on failure
($&Editor) set_valuepub fn (editor $&Editor) set_value(value &string) intOperation on $&Editor: set value. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).value &stringint — a value of this type
($&Editor) routepub fn (editor $&Editor) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Editor) eventpub fn (editor $&Editor) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
($&Editor) paintpub fn (editor $&Editor) paint(frame $&draw.Frame,theme &Theme) intRetain the layout until the containing frame has been accepted. painted acknowledges dirtiness, not native resource ownership. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).frame $&draw.Frametheme &Themeint — a value of this type
($&Editor) disposepub fn (editor $&Editor) dispose()Release and dispose native resources and underlying handles.
editor $&EditorEditor instance used by this call (exclusive borrow).This call does not return a value.
(&Editor) caret_opacitypub fn (editor &Editor) caret_opacity() f64Operation on &Editor: caret opacity.
editor &EditorEditor instance used by this call (borrow).f64 — a value of this type
(&Editor) has_caret_animationpub fn (editor &Editor) has_caret_animation() boolOperation on &Editor: whether it has caret animation.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) next_caret_tickpub fn (editor &Editor) next_caret_tick(now time.Instant,reduced_motion bool) time.InstantOperation on &Editor: next caret tick. Throws on failure; handle the error or propagate it to the caller.
editor &EditorEditor instance used by this call (borrow).now time.Instantreduced_motion booltime.Instant — a value of this type
($&Editor) tickpub fn (editor $&Editor) tick(now time.Instant,reduced_motion bool) boolCall from the owning event loop. Only the short fade phases need new frames editing/selection restarts a full visible interval and IME stays steady. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).now time.Instantreduced_motion boolbool — true or false
(&Editor) boundspub fn (editor &Editor) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
editor &EditorEditor instance used by this call (borrow).layout.Rect — a value of this type
(&Editor) is_invalidpub fn (editor &Editor) is_invalid() boolOperation on &Editor: whether it is invalid.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) is_hoveredpub fn (editor &Editor) is_hovered() boolOperation on &Editor: whether it is hovered.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) visual_statepub fn (editor &Editor) visual_state() intOperation on &Editor: visual state.
editor &EditorEditor instance used by this call (borrow).int — a value of this type
(&Editor) has_stylepub fn (editor &Editor) has_style() boolOperation on &Editor: whether it has style.
editor &EditorEditor instance used by this call (borrow).bool — true or false
(&Editor) style_orpub fn (editor &Editor) style_or(styles &Styles) ControlStyleOperation on &Editor: style or.
editor &EditorEditor instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Editor) set_stylepub fn (editor $&Editor) set_style(style &ControlStyle) intOperation on $&Editor: set style. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Editor) clear_stylepub fn (editor $&Editor) clear_style()Operation on $&Editor: clear style.
editor $&EditorEditor instance used by this call (exclusive borrow).This call does not return a value.
($&Editor) apply_stylespub fn (editor $&Editor) apply_styles(styles &Styles) intValidate and apply styles, updating layout / geometry and repainting when metrics change.
editor $&EditorEditor instance used by this call (exclusive borrow).styles &Styles0 on success; throws on failure
($&Editor) paint_motion_styledpub fn (editor $&Editor) paint_motion_styled(frame $&draw.Frame,styles &Styles,motion $&PaintTransition,now time.Instant,reduced_motion bool) intOperation on $&Editor: paint motion styled. Throws on failure; handle the error or propagate it to the caller.
editor $&EditorEditor instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesmotion $&PaintTransitionnow time.Instantreduced_motion boolint — a value of this type
($&Editor) set_invalidpub fn (editor $&Editor) set_invalid(invalid bool)Operation on $&Editor: set invalid.
editor $&EditorEditor instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Editor) is_read_onlypub fn (editor &Editor) is_read_only() boolOperation on &Editor: whether it is read only.
editor &EditorEditor instance used by this call (borrow).bool — true or false
($&Editor) set_read_onlypub fn (editor $&Editor) set_read_only(on bool) intSwitch read-only state, releasing or restarting native input. Preserve selection, navigation and copy; reject edits and late IME commits while read-only.
editor $&EditorEditor instance used by this call (exclusive borrow).on bool0 on success; throws on failure
(&Editor) is_copy_enabledpub fn (editor &Editor) is_copy_enabled() boolOperation on &Editor: whether it is copy enabled.
editor &EditorEditor instance used by this call (borrow).bool — true or false
($&Editor) set_copy_enabledpub fn (editor $&Editor) set_copy_enabled(on bool)Operation on $&Editor: set copy enabled.
editor $&EditorEditor instance used by this call (exclusive borrow).on boolThis call does not return a value.
($&Editor) measure_styledpub fn (editor $&Editor) measure_styled(styles &Styles) layout.SizeMeasure Editor with the effective font, density, content and minimum size.
editor $&EditorEditor instance used by this call (exclusive borrow).styles &Stylesintrinsic logical size; throws if native shaping fails
($&Editor) paint_styledpub fn (editor $&Editor) paint_styled(frame $&draw.Frame,styles &Styles) intPaint Editor using the complete theme; control bounds and Frame use the same local coordinates.
editor $&EditorEditor instance used by this call (exclusive borrow).frame $&draw.Framestyles &Styles0 on success; throws on failure
const FIELD_OUTLINEDpub const FIELD_OUTLINED = 0Constant FIELD_OUTLINED, defining protocol or algorithm parameters.
const FIELD_FILLEDpub const FIELD_FILLED = 1Constant FIELD_FILLED, defining protocol or algorithm parameters.
const FIELD_UNDERLINEDpub const FIELD_UNDERLINED = 2Constant FIELD_UNDERLINED, defining protocol or algorithm parameters.
const LABEL_AUTOpub const LABEL_AUTO = 0Constant LABEL_AUTO, defining protocol or algorithm parameters.
const LABEL_ALWAYSpub const LABEL_ALWAYS = 1Constant LABEL_ALWAYS, defining protocol or algorithm parameters.
const LABEL_NEVERpub const LABEL_NEVER = 2Constant LABEL_NEVER, defining protocol or algorithm parameters.
const LABEL_STATICpub const LABEL_STATIC = 3Constant LABEL_STATIC, defining protocol or algorithm parameters.
struct FieldDecorationpub struct FieldDecoration {
pub label string
pub helper string
pub error string
pub prefix string
pub suffix string
pub variant int
pub floating int
pub clearable bool
pub reserve_helper bool
}Structure encapsulating label, helper, error, prefix, suffix.
label stringhelper stringerror stringprefix stringsuffix stringvariant intfloating intclearable boolreserve_helper boolfield_decorationpub fn field_decoration(label &string) FieldDecorationField decoration.
label &stringFieldDecoration — a value of this type
(&FieldDecoration) validatepub fn (d &FieldDecoration) validate() intExecute validate on &FieldDecoration. Throws on failure; handle the error or propagate it to the caller.
d &FieldDecorationFieldDecoration instance used by this call (borrow).int — a value of this type
struct Fieldpub struct Field {
}The decorator owns an ordinary Editor. Its content geometry is independent of label animation, preserving selection, native IME and candidate placement.
This type has no public fields.
fieldpub fn field(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value &string,decoration &FieldDecoration) FieldExecute field. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectvalue &stringdecoration &FieldDecorationField — a value of this type
text_field_areapub fn text_field_area(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value &string,decoration &FieldDecoration) FieldText field area. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectvalue &stringdecoration &FieldDecorationField — a value of this type
(&Field) idpub fn (f &Field) id() intReturn the unique integer ID of the element or control.
f &FieldField instance used by this call (borrow).int — a value of this type
(&Field) boundspub fn (f &Field) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
f &FieldField instance used by this call (borrow).layout.Rect — a value of this type
(&Field) valuepub fn (f &Field) value() stringExecute value on &Field.
f &FieldField instance used by this call (borrow).string — result string
(&Field) has_selectionpub fn (f &Field) has_selection() boolOperation on &Field: whether it has selection.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) is_copy_enabledpub fn (f &Field) is_copy_enabled() boolOperation on &Field: whether it is copy enabled.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) selected_textpub fn (f &Field) selected_text() stringOperation on &Field: selected text.
f &FieldField instance used by this call (borrow).string — result string
(&Field) is_enabledpub fn (f &Field) is_enabled() boolReturn whether the control is currently enabled.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) is_focusedpub fn (f &Field) is_focused() boolReturn whether the control currently has input focus.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) is_read_onlypub fn (f &Field) is_read_only() boolOperation on &Field: whether it is read only.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) is_invalidpub fn (f &Field) is_invalid() boolOperation on &Field: whether it is invalid.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) is_selectablepub fn (f &Field) is_selectable() boolOperation on &Field: whether it is selectable.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) cursorpub fn (f &Field) cursor() intExecute cursor on &Field.
f &FieldField instance used by this call (borrow).int — a value of this type
(&Field) has_popup_openpub fn (f &Field) has_popup_open() boolOperation on &Field: whether it has popup open.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) popup_boundspub fn (f &Field) popup_bounds() layout.RectOperation on &Field: popup bounds.
f &FieldField instance used by this call (borrow).layout.Rect — a value of this type
(&Field) needs_paintpub fn (f &Field) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
f &FieldField instance used by this call (borrow).bool — true or false
($&Field) paintedpub fn (f $&Field) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
f $&FieldField instance used by this call (exclusive borrow).This call does not return a value.
(&Field) style_orpub fn (f &Field) style_or(styles &Styles) ControlStyleOperation on &Field: style or.
f &FieldField instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Field) set_stylepub fn (f $&Field) set_style(style &ControlStyle) intOperation on $&Field: set style. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Field) set_decorationpub fn (f $&Field) set_decoration(decoration &FieldDecoration) intOperation on $&Field: set decoration. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).decoration &FieldDecorationint — a value of this type
($&Field) set_motionpub fn (f $&Field) set_motion(spec &MotionSpec) intOperation on $&Field: set motion. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&Field) set_invalidpub fn (f $&Field) set_invalid(invalid bool)Operation on $&Field: set invalid.
f $&FieldField instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&Field) set_valuepub fn (f $&Field) set_value(value &string) intOperation on $&Field: set value. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).value &stringint — a value of this type
($&Field) set_read_onlypub fn (f $&Field) set_read_only(read_only bool) intOperation on $&Field: set read only. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).read_only boolint — a value of this type
($&Field) set_selectablepub fn (f $&Field) set_selectable(selectable bool) intOperation on $&Field: set selectable. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).selectable boolint — a value of this type
($&Field) set_copy_enabledpub fn (f $&Field) set_copy_enabled(on bool)Operation on $&Field: set copy enabled.
f $&FieldField instance used by this call (exclusive borrow).on boolThis call does not return a value.
($&Field) set_viewportpub fn (f $&Field) set_viewport(viewport &layout.Rect)Operation on $&Field: set viewport.
f $&FieldField instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&Field) paint_popup_styledpub fn (f $&Field) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Field: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Field) focus_sessionpub fn (f $&Field) focus_session(focused bool) intOperation on $&Field: focus session. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).focused boolint — a value of this type
($&Field) enablepub fn (f $&Field) enable(enabled bool) intExecute enable on $&Field. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).enabled boolint — a value of this type
($&Field) placepub fn (f $&Field) place(bounds &layout.Rect) intCompute and place control bounds within canvas layout. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&Field) apply_stylespub fn (f $&Field) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
($&Field) inputpub fn (f $&Field) input(input &ui.InputEvent) ActionLike Editor.route, pointer coordinates are local to bounds; input offers the canvas-coordinate entry point used by Screen and immediate applications. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Field) routepub fn (f $&Field) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Field) eventpub fn (f $&Field) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
($&Field) tickpub fn (f $&Field) tick(now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).now time.Instantreduced boolbool — true or false
(&Field) next_caret_tickpub fn (f &Field) next_caret_tick(now time.Instant,reduced bool) time.InstantOperation on &Field: next caret tick. Throws on failure; handle the error or propagate it to the caller.
f &FieldField instance used by this call (borrow).now time.Instantreduced booltime.Instant — a value of this type
($&Field) measure_styledpub fn (f $&Field) measure_styled(styles &Styles) layout.SizeOperation on $&Field: measure styled. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&Field) disposepub fn (f $&Field) dispose()Release and dispose native resources and underlying handles.
f $&FieldField instance used by this call (exclusive borrow).This call does not return a value.
($&Field) paint_styledpub fn (f $&Field) paint_styled(frame $&draw.Frame,styles &Styles) intPaint in local coordinates, matching Editor and View. The Editor still retains its canvas-global bounds for the native text session. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
struct FieldTextOptionspub struct FieldTextOptions {
pub min_rows int
pub max_rows int
pub counter bool
pub character_limit int
}Widgets Configuration parameters and options set.
min_rows intmax_rows intcounter boolcharacter_limit intfield_text_optionspub fn field_text_options() FieldTextOptionsField text options.
No arguments are required.
FieldTextOptions — a value of this type
(&FieldTextOptions) validatepub fn (options &FieldTextOptions) validate() intExecute validate on &FieldTextOptions. Throws on failure; handle the error or propagate it to the caller.
options &FieldTextOptionsFieldTextOptions instance used by this call (borrow).int — a value of this type
($&Field) set_text_optionspub fn (f $&Field) set_text_options(options &FieldTextOptions) intOperation on $&Field: set text options. Throws on failure; handle the error or propagate it to the caller.
f $&FieldField instance used by this call (exclusive borrow).options &FieldTextOptionsint — a value of this type
(&Field) text_optionspub fn (f &Field) text_options() FieldTextOptionsOperation on &Field: text options.
f &FieldField instance used by this call (borrow).FieldTextOptions — a value of this type
(&Field) character_countpub fn (f &Field) character_count() intCounts Unicode scalars without truncating text or touching IME composition. This is a soft counter; application validation decides when to reject input.
f &FieldField instance used by this call (borrow).int — a value of this type
(&Field) is_over_limitpub fn (f &Field) is_over_limit() boolOperation on &Field: whether it is over limit.
f &FieldField instance used by this call (borrow).bool — true or false
(&Field) preferred_rowspub fn (f &Field) preferred_rows() intOperation on &Field: preferred rows.
f &FieldField instance used by this call (borrow).int — a value of this type
($&StyledLabel) paint_ellipsized_styledpub fn (label $&StyledLabel) paint_ellipsized_styled(frame $&draw.Frame,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,state int) intEnd ellipsis uses shaped cluster boundaries. The label retains its full text callers can associate a Tooltip or render the full wrapped text on demand. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).frame $&draw.Framebounds &layout.Rectstyles &Stylesfallback &ControlStylestate intint — a value of this type
($&Screen) set_label_ellipsispub fn (s $&Screen) set_label_ellipsis(id int,enabled bool) intOperation on $&Screen: set label ellipsis. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intenabled boolint — a value of this type
struct ListAppearancepub struct ListAppearance {
pub row_height f64
pub leading_size f64
pub gap f64
pub detail_width f64
pub secondary bool
}Structure encapsulating row_height, leading_size, gap, detail_width, secondary.
row_height f64leading_size f64gap f64detail_width f64secondary boollist_appearancepub fn list_appearance() ListAppearanceList appearance.
No arguments are required.
ListAppearance — a value of this type
(&ListAppearance) validatepub fn (appearance &ListAppearance) validate() intExecute validate on &ListAppearance. Throws on failure; handle the error or propagate it to the caller.
appearance &ListAppearanceListAppearance instance used by this call (borrow).int — a value of this type
($&ListBox) set_appearancepub fn (lb $&ListBox) set_appearance(appearance &ListAppearance) intOperation on $&ListBox: set appearance. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).appearance &ListAppearanceint — a value of this type
(&ListBox) item_boundspub fn (lb &ListBox) item_bounds(index int,styles &Styles) layout.RectOperation on &ListBox: item bounds. Throws on failure; handle the error or propagate it to the caller.
lb &ListBoxListBox instance used by this call (borrow).index intstyles &Styleslayout.Rect — a value of this type
struct ListRowpub struct ListRow {
pub title string
pub description string
pub detail string
pub icon int
}Structure encapsulating title, description, detail, icon.
title stringdescription stringdetail stringicon intlist_rowpub fn list_row(title string) ListRowList row.
title stringListRow — a value of this type
(&ListRow) validatepub fn (row &ListRow) validate() intExecute validate on &ListRow. Throws on failure; handle the error or propagate it to the caller.
row &ListRowListRow instance used by this call (borrow).int — a value of this type
(&ListBox) hit_item_bytepub fn (lb &ListBox) hit_item_byte(index int,title $&StyledLabel,styles &Styles,has_row_layout bool,has_description bool,has_detail bool,icon int,x_pos f64,y_pos f64) intOperation on &ListBox: hit item byte.
lb &ListBoxListBox instance used by this call (borrow).index inttitle $&StyledLabelstyles &Styleshas_row_layout boolhas_description boolhas_detail boolicon intx_pos f64y_pos f64int — a value of this type
(&ListBox) paint_row_styledpub fn (lb &ListBox) paint_row_styled(frame $&draw.Frame,index int,title $&StyledLabel,description $&StyledLabel,detail $&StyledLabel,icon int,styles &Styles) intOperation on &ListBox: paint row styled. Throws on failure; handle the error or propagate it to the caller.
lb &ListBoxListBox instance used by this call (borrow).frame $&draw.Frameindex inttitle $&StyledLabeldescription $&StyledLabeldetail $&StyledLabelicon intstyles &Stylesint — a value of this type
($&Screen) set_list_rowpub fn (s $&Screen) set_list_row(id int,index int,row &ListRow) intOperation on $&Screen: set list row. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intindex introw &ListRowint — a value of this type
struct Localepub struct Locale {
}Component-owned copy and display conventions. Application text and data stay untouched.
This type has no public fields.
const TEXT_DATE_PLACEHOLDERpub const TEXT_DATE_PLACEHOLDER = 0Constant TEXT_DATE_PLACEHOLDER, defining protocol or algorithm parameters.
const TEXT_TODAYpub const TEXT_TODAY = 1Constant TEXT_TODAY, defining protocol or algorithm parameters.
const TEXT_CLEARpub const TEXT_CLEAR = 2Constant TEXT_CLEAR, defining protocol or algorithm parameters.
const TEXT_NO_OPTIONSpub const TEXT_NO_OPTIONS = 3Constant TEXT_NO_OPTIONS, defining protocol or algorithm parameters.
const TEXT_NO_MATCHESpub const TEXT_NO_MATCHES = 4Constant TEXT_NO_MATCHES, defining protocol or algorithm parameters.
const TEXT_CHOOSE_OPTIONSpub const TEXT_CHOOSE_OPTIONS = 5Constant TEXT_CHOOSE_OPTIONS, defining protocol or algorithm parameters.
const TEXT_SELECTED_COUNTpub const TEXT_SELECTED_COUNT = 6Constant TEXT_SELECTED_COUNT, defining protocol or algorithm parameters.
const TEXT_NO_RECORDSpub const TEXT_NO_RECORDS = 7Constant TEXT_NO_RECORDS, defining protocol or algorithm parameters.
const TEXT_TASK_WORKINGpub const TEXT_TASK_WORKING = 8Constant TEXT_TASK_WORKING, defining protocol or algorithm parameters.
const TEXT_TASK_DONEpub const TEXT_TASK_DONE = 9Constant TEXT_TASK_DONE, defining protocol or algorithm parameters.
const TEXT_TASK_RETRYpub const TEXT_TASK_RETRY = 10Constant TEXT_TASK_RETRY, defining protocol or algorithm parameters.
const TEXT_TASK_CANCELLINGpub const TEXT_TASK_CANCELLING = 11Constant TEXT_TASK_CANCELLING, defining protocol or algorithm parameters.
const TEXT_WEB_CONTENTpub const TEXT_WEB_CONTENT = 12Constant TEXT_WEB_CONTENT, defining protocol or algorithm parameters.
const TEXT_WEB_LOADINGpub const TEXT_WEB_LOADING = 13Constant TEXT_WEB_LOADING, defining protocol or algorithm parameters.
const TEXT_WEB_UNAVAILABLEpub const TEXT_WEB_UNAVAILABLE = 14Constant TEXT_WEB_UNAVAILABLE, defining protocol or algorithm parameters.
const TEXT_WEB_FAILEDpub const TEXT_WEB_FAILED = 15Constant TEXT_WEB_FAILED, defining protocol or algorithm parameters.
const TEXT_AMpub const TEXT_AM = 16Constant TEXT_AM, defining protocol or algorithm parameters.
const TEXT_PMpub const TEXT_PM = 17Constant TEXT_PM, defining protocol or algorithm parameters.
const TEXT_DATE_PATTERNpub const TEXT_DATE_PATTERN = 18Constant TEXT_DATE_PATTERN, defining protocol or algorithm parameters.
const TEXT_CALENDAR_PATTERNpub const TEXT_CALENDAR_PATTERN = 19Constant TEXT_CALENDAR_PATTERN, defining protocol or algorithm parameters.
const TEXT_DECIMAL_SEPARATORpub const TEXT_DECIMAL_SEPARATOR = 20Constant TEXT_DECIMAL_SEPARATOR, defining protocol or algorithm parameters.
const TEXT_GROUP_SEPARATORpub const TEXT_GROUP_SEPARATOR = 21Constant TEXT_GROUP_SEPARATOR, defining protocol or algorithm parameters.
const TEXT_PERCENT_PATTERNpub const TEXT_PERCENT_PATTERN = 22Constant TEXT_PERCENT_PATTERN, defining protocol or algorithm parameters.
const TEXT_OVERFLOW_PATTERNpub const TEXT_OVERFLOW_PATTERN = 23Constant TEXT_OVERFLOW_PATTERN, defining protocol or algorithm parameters.
const TEXT_COUNTER_PATTERNpub const TEXT_COUNTER_PATTERN = 24Constant TEXT_COUNTER_PATTERN, defining protocol or algorithm parameters.
const TEXT_TIME_SEPARATORpub const TEXT_TIME_SEPARATOR = 25Constant TEXT_TIME_SEPARATOR, defining protocol or algorithm parameters.
const TEXT_REDpub const TEXT_RED = 26Constant TEXT_RED, defining protocol or algorithm parameters.
const TEXT_GREENpub const TEXT_GREEN = 27Constant TEXT_GREEN, defining protocol or algorithm parameters.
const TEXT_BLUEpub const TEXT_BLUE = 28Constant TEXT_BLUE, defining protocol or algorithm parameters.
const TEXT_ALPHApub const TEXT_ALPHA = 29Constant TEXT_ALPHA, defining protocol or algorithm parameters.
const TEXT_SELECTED_ONEpub const TEXT_SELECTED_ONE = 30Constant TEXT_SELECTED_ONE, defining protocol or algorithm parameters.
const TEXT_PAGE_SUMMARYpub const TEXT_PAGE_SUMMARY = 63Constant TEXT_PAGE_SUMMARY, defining protocol or algorithm parameters.
const TEXT_ITEMS_PER_PAGEpub const TEXT_ITEMS_PER_PAGE = 64Constant TEXT_ITEMS_PER_PAGE, defining protocol or algorithm parameters.
locale_defaultpub fn locale_default() LocaleLocale default.
No arguments are required.
Locale — a value of this type
locale_en_uspub fn locale_en_us() LocaleLocale en us.
No arguments are required.
Locale — a value of this type
locale_zh_cnpub fn locale_zh_cn() LocaleLocale zh cn.
No arguments are required.
Locale — a value of this type
(&Locale) clonepub fn (locale &Locale) clone() LocaleCopy the control or style snapshot into an independent Locale value.
locale &LocaleLocale instance used by this call (borrow).Locale — a value of this type
(&Locale) validatepub fn (locale &Locale) validate() intExecute validate on &Locale. Throws on failure; handle the error or propagate it to the caller.
locale &LocaleLocale instance used by this call (borrow).int — a value of this type
(&Locale) textpub fn (locale &Locale) text(key int) stringOperation on &Locale: return the current text. Throws on failure; handle the error or propagate it to the caller.
locale &LocaleLocale instance used by this call (borrow).key intstring — result string
($&Locale) set_textpub fn (locale $&Locale) set_text(key int,text string) intOperation on $&Locale: set text. Throws on failure; handle the error or propagate it to the caller.
locale $&LocaleLocale instance used by this call (exclusive borrow).key inttext stringint — a value of this type
($&Locale) set_weekdayspub fn (locale $&Locale) set_weekdays(names &[]string) intOperation on $&Locale: set weekdays. Throws on failure; handle the error or propagate it to the caller.
locale $&LocaleLocale instance used by this call (exclusive borrow).names &[]stringint — a value of this type
($&Locale) set_monthspub fn (locale $&Locale) set_months(names &[]string) intOperation on $&Locale: set months. Throws on failure; handle the error or propagate it to the caller.
locale $&LocaleLocale instance used by this call (exclusive borrow).names &[]stringint — a value of this type
($&Locale) set_digitspub fn (locale $&Locale) set_digits(names &[]string) intOperation on $&Locale: set digits. Throws on failure; handle the error or propagate it to the caller.
locale $&LocaleLocale instance used by this call (exclusive borrow).names &[]stringint — a value of this type
(&Locale) weekdaypub fn (locale &Locale) weekday(column int) stringExecute weekday on &Locale. Throws on failure; handle the error or propagate it to the caller.
locale &LocaleLocale instance used by this call (borrow).column intstring — result string
(&Locale) numberpub fn (locale &Locale) number(value string,grouped bool) stringFormats a canonical ASCII number for display, never for serialization or parsing.
locale &LocaleLocale instance used by this call (borrow).value stringgrouped boolstring — result string
(&Locale) integerpub fn (locale &Locale) integer(value int) stringExecute integer on &Locale.
locale &LocaleLocale instance used by this call (borrow).value intstring — result string
(&Locale) count_textpub fn (locale &Locale) count_text(key int,count int) stringOperation on &Locale: count text. Throws on failure; handle the error or propagate it to the caller.
locale &LocaleLocale instance used by this call (borrow).key intcount intstring — result string
(&Locale) date_textpub fn (locale &Locale) date_text(value time.Time) stringOperation on &Locale: date text. Throws on failure; handle the error or propagate it to the caller.
locale &LocaleLocale instance used by this call (borrow).value time.Timestring — result string
(&Locale) calendar_titlepub fn (locale &Locale) calendar_title(value time.Time) stringOperation on &Locale: calendar title. Throws on failure; handle the error or propagate it to the caller.
locale &LocaleLocale instance used by this call (borrow).value time.Timestring — result string
(&Locale) first_weekdaypub fn (locale &Locale) first_weekday() intOperation on &Locale: first weekday.
locale &LocaleLocale instance used by this call (borrow).int — a value of this type
($&Locale) set_first_weekdaypub fn (locale $&Locale) set_first_weekday(day int) intOperation on $&Locale: set first weekday. Throws on failure; handle the error or propagate it to the caller.
locale $&LocaleLocale instance used by this call (exclusive borrow).day intint — a value of this type
(&Locale) twelve_hourpub fn (locale &Locale) twelve_hour() boolOperation on &Locale: twelve hour.
locale &LocaleLocale instance used by this call (borrow).bool — true or false
($&Locale) set_12_hourpub fn (locale $&Locale) set_12_hour(enabled bool)Operation on $&Locale: set 12 hour.
locale $&LocaleLocale instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Locale) period_beforepub fn (locale &Locale) period_before() boolOperation on &Locale: period before.
locale &LocaleLocale instance used by this call (borrow).bool — true or false
($&Locale) set_period_beforepub fn (locale $&Locale) set_period_before(before bool)Operation on $&Locale: set period before.
locale $&LocaleLocale instance used by this call (exclusive borrow).before boolThis call does not return a value.
const MENU_DROPDOWNpub const MENU_DROPDOWN = 0Constant MENU_DROPDOWN, defining protocol or algorithm parameters.
const MENU_CONTEXTpub const MENU_CONTEXT = 1Constant MENU_CONTEXT, defining protocol or algorithm parameters.
const MENU_SPLITpub const MENU_SPLIT = 2Constant MENU_SPLIT, defining protocol or algorithm parameters.
const MENU_ACTIONpub const MENU_ACTION = 0Constant MENU_ACTION, defining protocol or algorithm parameters.
const MENU_CHECKpub const MENU_CHECK = 1Constant MENU_CHECK, defining protocol or algorithm parameters.
const MENU_RADIOpub const MENU_RADIO = 2Constant MENU_RADIO, defining protocol or algorithm parameters.
const MENU_SEPARATORpub const MENU_SEPARATOR = 3Constant MENU_SEPARATOR, defining protocol or algorithm parameters.
const MENU_HEADINGpub const MENU_HEADING = 4Constant MENU_HEADING, defining protocol or algorithm parameters.
const MENU_SUBMENUpub const MENU_SUBMENU = 5Constant MENU_SUBMENU, defining protocol or algorithm parameters.
struct MenuItempub struct MenuItem {
pub key int
pub parent int
pub label string
pub shortcut_label string
pub shortcut_key int
pub shortcut_modifiers int
pub kind int
pub enabled bool
pub checked bool
pub radio_group int
}Structure encapsulating key, parent, label, shortcut_label, shortcut_key.
key intparent intlabel stringshortcut_label stringshortcut_key intshortcut_modifiers intkind intenabled boolchecked boolradio_group intmenu_itempub fn menu_item(key int,label string) MenuItemMenu item.
key intlabel stringMenuItem — a value of this type
struct MenuAppearancepub struct MenuAppearance {
pub row_height f64
pub min_width f64
pub max_width f64
pub close_on_select bool
pub hover_delay time.Duration
}Structure encapsulating row_height, min_width, max_width, close_on_select, hover_delay.
row_height f64min_width f64max_width f64close_on_select boolhover_delay time.Durationmenu_appearancepub fn menu_appearance() MenuAppearanceMenu appearance.
No arguments are required.
MenuAppearance — a value of this type
struct Menupub struct Menu {
}Menu context or state structure.
This type has no public fields.
menupub fn menu(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,label string,items &[]MenuItem,mode int,primary_key int) MenuExecute menu. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectlabel stringitems &[]MenuItemmode intprimary_key intMenu — a value of this type
(&Menu) idpub fn (m &Menu) id() intReturn the unique integer ID of the element or control.
m &MenuMenu instance used by this call (borrow).int — a value of this type
(&Menu) boundspub fn (m &Menu) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
m &MenuMenu instance used by this call (borrow).layout.Rect — a value of this type
(&Menu) is_enabledpub fn (m &Menu) is_enabled() boolReturn whether the control is currently enabled.
m &MenuMenu instance used by this call (borrow).bool — true or false
(&Menu) is_selectablepub fn (m &Menu) is_selectable() boolOperation on &Menu: whether it is selectable.
m &MenuMenu instance used by this call (borrow).bool — true or false
($&Menu) set_selectablepub fn (m $&Menu) set_selectable(selectable bool)Operation on $&Menu: set selectable.
m $&MenuMenu instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Menu) is_openpub fn (m &Menu) is_open() boolReturn whether the overlay, menu or dialog is currently open.
m &MenuMenu instance used by this call (borrow).bool — true or false
(&Menu) opacitypub fn (m &Menu) opacity() f64Execute opacity on &Menu.
m &MenuMenu instance used by this call (borrow).f64 — a value of this type
(&Menu) needs_paintpub fn (m &Menu) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
m &MenuMenu instance used by this call (borrow).bool — true or false
($&Menu) paintedpub fn (m $&Menu) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
m $&MenuMenu instance used by this call (exclusive borrow).This call does not return a value.
($&Menu) set_itemspub fn (m $&Menu) set_items(items &[]MenuItem) intOperation on $&Menu: set items. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).items &[]MenuItemint — a value of this type
($&Menu) set_item_labelpub fn (m $&Menu) set_item_label(key int,label string) intOperation on $&Menu: set item label. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).key intlabel stringint — a value of this type
($&Menu) set_labelpub fn (m $&Menu) set_label(label string)Operation on $&Menu: set label.
m $&MenuMenu instance used by this call (exclusive borrow).label stringThis call does not return a value.
(&Menu) checkedpub fn (m &Menu) checked(key int) boolExecute checked on &Menu. Throws on failure; handle the error or propagate it to the caller.
m &MenuMenu instance used by this call (borrow).key intbool — true or false
($&Menu) set_checkedpub fn (m $&Menu) set_checked(key int,value bool) intOperation on $&Menu: set checked. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).key intvalue boolint — a value of this type
($&Menu) set_item_enabledpub fn (m $&Menu) set_item_enabled(key int,value bool) intOperation on $&Menu: set item enabled. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).key intvalue boolint — a value of this type
($&Menu) set_appearancepub fn (m $&Menu) set_appearance(a &MenuAppearance) intOperation on $&Menu: set appearance. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).a &MenuAppearanceint — a value of this type
($&Menu) closepub fn (m $&Menu) close() intOperation on $&Menu: close the resource. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).int — a value of this type
($&Menu) cancelpub fn (m $&Menu) cancel()Execute cancel on $&Menu.
m $&MenuMenu instance used by this call (exclusive borrow).This call does not return a value.
($&Menu) set_focuspub fn (m $&Menu) set_focus(value bool)Operation on $&Menu: set focus.
m $&MenuMenu instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&Menu) set_enabledpub fn (m $&Menu) set_enabled(value bool)Operation on $&Menu: set enabled.
m $&MenuMenu instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&Menu) set_read_onlypub fn (m $&Menu) set_read_only(value bool)Operation on $&Menu: set read only.
m $&MenuMenu instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&Menu) set_boundspub fn (m $&Menu) set_bounds(b &layout.Rect) intOperation on $&Menu: set bounds. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).b &layout.Rectint — a value of this type
($&Menu) set_stylepub fn (m $&Menu) set_style(style &ControlStyle) intOperation on $&Menu: set style. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Menu) clear_stylepub fn (m $&Menu) clear_style()Operation on $&Menu: clear style.
m $&MenuMenu instance used by this call (exclusive borrow).This call does not return a value.
($&Menu) set_motionpub fn (m $&Menu) set_motion(spec &MotionSpec) intOperation on $&Menu: set motion. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&Menu) disposepub fn (m $&Menu) dispose()Release and dispose native resources and underlying handles.
m $&MenuMenu instance used by this call (exclusive borrow).This call does not return a value.
(&Menu) popup_boundspub fn (m &Menu) popup_bounds() layout.RectOperation on &Menu: popup bounds.
m &MenuMenu instance used by this call (borrow).layout.Rect — a value of this type
($&Menu) set_viewportpub fn (m $&Menu) set_viewport(viewport &layout.Rect) intOperation on $&Menu: set viewport. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).viewport &layout.Rectint — a value of this type
($&Menu) apply_stylespub fn (m $&Menu) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
($&Menu) tickpub fn (m $&Menu) tick(styles &Styles,now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).styles &Stylesnow time.Instantreduced boolbool — true or false
(&Menu) next_tickpub fn (m &Menu) next_tick(now time.Instant) time.InstantOperation on &Menu: next tick. Throws on failure; handle the error or propagate it to the caller.
m &MenuMenu instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&Menu) open_atpub fn (m $&Menu) open_at(x f64,y f64,context bool) intOperation on $&Menu: open at. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).x f64y f64context boolint — a value of this type
($&Menu) shortcutpub fn (m $&Menu) shortcut(event &ui.InputEvent) ActionExecute shortcut on $&Menu. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Menu) inputpub fn (m $&Menu) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Menu) routepub fn (m $&Menu) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Menu) paint_styledpub fn (m $&Menu) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Menu: paint styled. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Menu) paint_popup_styledpub fn (m $&Menu) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Menu: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
m $&MenuMenu instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
const EASE_LINEARpub const EASE_LINEAR = 0Constant EASE_LINEAR, defining protocol or algorithm parameters.
const EASE_OUT_QUARTpub const EASE_OUT_QUART = 1Constant EASE_OUT_QUART, defining protocol or algorithm parameters.
const EASE_OUT_QUINTpub const EASE_OUT_QUINT = 2Constant EASE_OUT_QUINT, defining protocol or algorithm parameters.
const EASE_IN_QUARTpub const EASE_IN_QUART = 3Constant EASE_IN_QUART, defining protocol or algorithm parameters.
const EASE_IN_OUT_CUBICpub const EASE_IN_OUT_CUBIC = 4Constant EASE_IN_OUT_CUBIC, defining protocol or algorithm parameters.
const EASE_IN_QUINTpub const EASE_IN_QUINT = 5Constant EASE_IN_QUINT, defining protocol or algorithm parameters.
struct MotionSpecpub struct MotionSpec {
pub hover time.Duration
pub press time.Duration
pub change time.Duration
pub enter time.Duration
pub exit time.Duration
pub curve int
}Structure encapsulating hover, press, change, enter, exit.
hover time.Durationpress time.Durationchange time.Durationenter time.Durationexit time.Durationcurve intmotion_specpub fn motion_spec() MotionSpecMotion spec.
No arguments are required.
MotionSpec — a value of this type
(&MotionSpec) validatepub fn (spec &MotionSpec) validate() intExecute validate on &MotionSpec. Throws on failure; handle the error or propagate it to the caller.
spec &MotionSpecMotionSpec instance used by this call (borrow).int — a value of this type
struct Tweenpub struct Tween {
}Timestamps use time.instant; durations use time.milliseconds. Passing the clock explicitly keeps interrupted transitions deterministic.
This type has no public fields.
tweenpub fn tween(value f64) TweenExecute tween. Throws on failure; handle the error or propagate it to the caller.
value f64Tween — a value of this type
($&Tween) set_curvepub fn (t $&Tween) set_curve(curve int) intOperation on $&Tween: set curve. Throws on failure; handle the error or propagate it to the caller.
t $&TweenTween instance used by this call (exclusive borrow).curve intint — a value of this type
(&Tween) valuepub fn (t &Tween) value() f64Execute value on &Tween.
t &TweenTween instance used by this call (borrow).f64 — a value of this type
(&Tween) is_animatingpub fn (t &Tween) is_animating() boolOperation on &Tween: whether it is animating.
t &TweenTween instance used by this call (borrow).bool — true or false
($&Tween) snappub fn (t $&Tween) snap(value f64) intExecute snap on $&Tween. Throws on failure; handle the error or propagate it to the caller.
t $&TweenTween instance used by this call (exclusive borrow).value f64int — a value of this type
($&Tween) advancepub fn (t $&Tween) advance(now time.Instant) boolExecute advance on $&Tween.
t $&TweenTween instance used by this call (exclusive borrow).now time.Instantbool — true or false
($&Tween) retargetpub fn (t $&Tween) retarget(value f64,now time.Instant,duration time.Duration,reduced_motion bool) intExecute retarget on $&Tween. Throws on failure; handle the error or propagate it to the caller.
t $&TweenTween instance used by this call (exclusive borrow).value f64now time.Instantduration time.Durationreduced_motion boolint — a value of this type
fade_colorpub fn fade_color(color draw.Color,opacity f64) draw.ColorFade color.
color draw.Coloropacity f64draw.Color — a value of this type
(&ControlStyle) with_opacitypub fn (base &ControlStyle) with_opacity(opacity f64) ControlStyleOperation on &ControlStyle: derive a new value with opacity. Throws on failure; handle the error or propagate it to the caller.
base &ControlStyleControlStyle instance used by this call (borrow).opacity f64ControlStyle — a value of this type
struct PaintTransitionpub struct PaintTransition {
}PaintTransition context or state structure.
This type has no public fields.
paint_transitionpub fn paint_transition() PaintTransitionPaint transition. Throws on failure; handle the error or propagate it to the caller.
No arguments are required.
PaintTransition — a value of this type
($&PaintTransition) set_specpub fn (motion $&PaintTransition) set_spec(spec &MotionSpec) intOperation on $&PaintTransition: set spec. Throws on failure; handle the error or propagate it to the caller.
motion $&PaintTransitionPaintTransition instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
(&PaintTransition) next_tickpub fn (motion &PaintTransition) next_tick(now time.Instant) time.InstantOperation on &PaintTransition: next tick. Throws on failure; handle the error or propagate it to the caller.
motion &PaintTransitionPaintTransition instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
(&PaintTransition) is_animatingpub fn (motion &PaintTransition) is_animating() boolOperation on &PaintTransition: whether it is animating.
motion &PaintTransitionPaintTransition instance used by this call (borrow).bool — true or false
($&PaintTransition) finishpub fn (motion $&PaintTransition) finish()Execute finish on $&PaintTransition.
motion $&PaintTransitionPaintTransition instance used by this call (exclusive borrow).This call does not return a value.
($&PaintTransition) advancepub fn (motion $&PaintTransition) advance(now time.Instant) boolExecute advance on $&PaintTransition. Throws on failure; handle the error or propagate it to the caller.
motion $&PaintTransitionPaintTransition instance used by this call (exclusive borrow).now time.Instantbool — true or false
($&PaintTransition) stylepub fn (motion $&PaintTransition) style(base &ControlStyle,state int,now time.Instant,reduced_motion bool) ControlStyleExecute style on $&PaintTransition. Throws on failure; handle the error or propagate it to the caller.
motion $&PaintTransitionPaintTransition instance used by this call (exclusive borrow).base &ControlStylestate intnow time.Instantreduced_motion boolControlStyle — a value of this type
($&Tween) retarget_unitpub fn (t $&Tween) retarget_unit(value f64,now time.Instant,duration time.Duration,reduced bool) intShort reversals travel a shorter distance; keep their duration proportional. Advance with the old curve before replacing it to keep the handoff continuous. Throws on failure; handle the error or propagate it to the caller.
t $&TweenTween instance used by this call (exclusive borrow).value f64now time.Instantduration time.Durationreduced boolint — a value of this type
struct MultiSelectpub struct MultiSelect {
}keyboard cursor; Escape, blur and an outside press close without clearing it.
This type has no public fields.
multi_selectpub fn multi_select(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,options &[]string) MultiSelectMulti select. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectoptions &[]stringMultiSelect — a value of this type
(&MultiSelect) idpub fn (multi &MultiSelect) id() intReturn the unique integer ID of the element or control.
multi &MultiSelectMultiSelect instance used by this call (borrow).int — a value of this type
(&MultiSelect) boundspub fn (multi &MultiSelect) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
multi &MultiSelectMultiSelect instance used by this call (borrow).layout.Rect — a value of this type
(&MultiSelect) is_openpub fn (multi &MultiSelect) is_open() boolReturn whether the overlay, menu or dialog is currently open.
multi &MultiSelectMultiSelect instance used by this call (borrow).bool — true or false
(&MultiSelect) is_enabledpub fn (multi &MultiSelect) is_enabled() boolReturn whether the control is currently enabled.
multi &MultiSelectMultiSelect instance used by this call (borrow).bool — true or false
(&MultiSelect) is_selectablepub fn (multi &MultiSelect) is_selectable() boolOperation on &MultiSelect: whether it is selectable.
multi &MultiSelectMultiSelect instance used by this call (borrow).bool — true or false
($&MultiSelect) set_selectablepub fn (multi $&MultiSelect) set_selectable(selectable bool)Operation on $&MultiSelect: set selectable.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&MultiSelect) needs_paintpub fn (multi &MultiSelect) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
multi &MultiSelectMultiSelect instance used by this call (borrow).bool — true or false
(&MultiSelect) countpub fn (multi &MultiSelect) count() intReturn the number of items in this control.
multi &MultiSelectMultiSelect instance used by this call (borrow).int — a value of this type
(&MultiSelect) selectedpub fn (multi &MultiSelect) selected(index int) boolCheck whether one option is selected, for example after receiving a change action.
multi &MultiSelectMultiSelect instance used by this call (borrow).index inttrue if checked, otherwise false.
widgets: choice index out of range.(&MultiSelect) valuespub fn (multi &MultiSelect) values() []intReturn a slice containing all values in the collection.
multi &MultiSelectMultiSelect instance used by this call (borrow).[]int — slice result
($&MultiSelect) set_selectedpub fn (multi $&MultiSelect) set_selected(index int,selected bool) intSet one option's checked state without changing other choices, for example when restoring form data.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).index intselected booltrue checks and false unchecks the option.Returns 0 on success; failure throws rather than returning a nonzero status.
0..count()-1 throws.(&MultiSelect) style_orpub fn (multi &MultiSelect) style_or(styles &Styles) ControlStyleOperation on &MultiSelect: style or.
multi &MultiSelectMultiSelect instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&MultiSelect) set_stylepub fn (multi $&MultiSelect) set_style(style &ControlStyle) intOperation on $&MultiSelect: set style. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&MultiSelect) set_enabledpub fn (multi $&MultiSelect) set_enabled(enabled bool)Operation on $&MultiSelect: set enabled.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&MultiSelect) set_read_onlypub fn (multi $&MultiSelect) set_read_only(read_only bool) intOperation on $&MultiSelect: set read only. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).read_only boolint — a value of this type
($&MultiSelect) set_invalidpub fn (multi $&MultiSelect) set_invalid(invalid bool)Operation on $&MultiSelect: set invalid.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&MultiSelect) set_focuspub fn (multi $&MultiSelect) set_focus(focused bool)Operation on $&MultiSelect: set focus.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&MultiSelect) set_openpub fn (multi $&MultiSelect) set_open(open bool)Set whether the option list is open.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).open booltrue requests opening and false closes it; disabled or read-only controls remain closed.No return value; read the resulting state with is_open().
paint_popup_styled in an appropriate overlay pass.($&MultiSelect) set_popup_abovepub fn (multi $&MultiSelect) set_popup_above(above bool)Operation on $&MultiSelect: set popup above.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).above boolThis call does not return a value.
($&MultiSelect) set_boundspub fn (multi $&MultiSelect) set_bounds(bounds &layout.Rect) intOperation on $&MultiSelect: set bounds. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&MultiSelect) apply_stylespub fn (multi $&MultiSelect) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&MultiSelect) popup_boundspub fn (multi &MultiSelect) popup_bounds() layout.RectRead the option-list rectangle in canvas coordinates for overlay hit testing or layout.
multi &MultiSelectMultiSelect instance used by this call (borrow).The list's layout.Rect; reading it does not open the list, so also check is_open().
(&MultiSelect) option_boundspub fn (multi &MultiSelect) option_bounds(index int) layout.RectOperation on &MultiSelect: option bounds. Throws on failure; handle the error or propagate it to the caller.
multi &MultiSelectMultiSelect instance used by this call (borrow).index intlayout.Rect — a value of this type
($&MultiSelect) inputpub fn (multi $&MultiSelect) input(event &ui.InputEvent) ActionProcess opening, multiple selection and selected-chip interaction, updating control state.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).event &ui.InputEventAn Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
ACTION_CHANGE with the changed option index; call selected(index) for its new checked state.($&MultiSelect) routepub fn (multi $&MultiSelect) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&MultiSelect) eventpub fn (multi $&MultiSelect) event(event &ui.Event) ActionReceive native window events, routing input to input and other events to the internal editor or base control.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).event &ui.Eventui.Event; use this entry point for IME, blur and lifecycle handling.An Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
($&MultiSelect) measure_styledpub fn (multi $&MultiSelect) measure_styled(styles &Styles) layout.SizeOperation on $&MultiSelect: measure styled. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&MultiSelect) paint_styledpub fn (multi $&MultiSelect) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&MultiSelect: paint styled. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&MultiSelect) paint_popup_styledpub fn (multi $&MultiSelect) paint_popup_styled(frame $&draw.Frame,styles &Styles) intPaint the expanded option list separately from the field so it can appear above other controls.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).frame $&draw.Framestyles &StylesReturns 0 on success; failure throws rather than returning a nonzero status.
($&MultiSelect) disposepub fn (multi $&MultiSelect) dispose()Release and dispose native resources and underlying handles.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).This call does not return a value.
($&MultiSelect) set_filterpub fn (multi $&MultiSelect) set_filter(query &string) intOperation on $&MultiSelect: set filter. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).query &stringint — a value of this type
($&MultiSelect) select_allpub fn (multi $&MultiSelect) select_all(selected bool) intOperation on $&MultiSelect: select all. Throws on failure; handle the error or propagate it to the caller.
multi $&MultiSelectMultiSelect instance used by this call (exclusive borrow).selected boolint — a value of this type
($&Screen) set_notice_stylepub fn (s $&Screen) set_notice_style(style &ControlStyle) intOperation on $&Screen: set notice style. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Screen) clear_notice_stylepub fn (s $&Screen) clear_notice_style() intOperation on $&Screen: clear notice style. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).int — a value of this type
($&Screen) set_notice_motionpub fn (s $&Screen) set_notice_motion(spec &MotionSpec) intOperation on $&Screen: set notice motion. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&Screen) find_next_optionpub fn (s $&Screen) find_next_option(id int,prefix &string) intUnicode callers can provide a complete prefix from an editor or command. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intprefix &stringint — a value of this type
anchored_overlay_boundspub fn anchored_overlay_bounds(anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) layout.RectPlacement is in logical canvas pixels. Dimensions are clipped to the viewport; the caller clips child content to bounds when painting it. Throws on failure; handle the error or propagate it to the caller.
anchor &layout.Rectsize &layout.Sizeviewport &layout.Rectlayout.Rect — a value of this type
overlay_next_tickpub fn overlay_next_tick(animated bool,now time.Instant) time.InstantOverlay next tick. Throws on failure; handle the error or propagate it to the caller.
animated boolnow time.Instanttime.Instant — a value of this type
struct Popoverpub struct Popover {
}Anchored popover container attached to target element.
This type has no public fields.
popoverpub fn popover(identity &ui.CanvasEvent,id int,anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) PopoverExecute popover. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intanchor &layout.Rectsize &layout.Sizeviewport &layout.RectPopover — a value of this type
(&Popover) idpub fn (p &Popover) id() intReturn the unique integer ID of the element or control.
p &PopoverPopover instance used by this call (borrow).int — a value of this type
(&Popover) boundspub fn (p &Popover) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
p &PopoverPopover instance used by this call (borrow).layout.Rect — a value of this type
(&Popover) is_enabledpub fn (p &Popover) is_enabled() boolReturn whether the control is currently enabled.
p &PopoverPopover instance used by this call (borrow).bool — true or false
(&Popover) is_selectablepub fn (p &Popover) is_selectable() boolOperation on &Popover: whether it is selectable.
p &PopoverPopover instance used by this call (borrow).bool — true or false
($&Popover) set_selectablepub fn (p $&Popover) set_selectable(selectable bool)Operation on $&Popover: set selectable.
p $&PopoverPopover instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
($&Popover) set_textpub fn (p $&Popover) set_text(context &draw.Context,text &string) intOperation on $&Popover: set text. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).context &draw.Contexttext &stringint — a value of this type
(&Popover) has_popup_openpub fn (p &Popover) has_popup_open() boolOperation on &Popover: whether it has popup open.
p &PopoverPopover instance used by this call (borrow).bool — true or false
(&Popover) popup_boundspub fn (p &Popover) popup_bounds() layout.RectOperation on &Popover: popup bounds.
p &PopoverPopover instance used by this call (borrow).layout.Rect — a value of this type
(&Popover) selected_textpub fn (p &Popover) selected_text() stringOperation on &Popover: selected text.
p &PopoverPopover instance used by this call (borrow).string — result string
(&Popover) copy_selectionpub fn (p &Popover) copy_selection() intOperation on &Popover: copy selection.
p &PopoverPopover instance used by this call (borrow).int — a value of this type
(&Popover) selection_rangepub fn (p &Popover) selection_range() ui.TextRangeOperation on &Popover: selection range.
p &PopoverPopover instance used by this call (borrow).ui.TextRange — a value of this type
(&Popover) cursorpub fn (p &Popover) cursor() intExecute cursor on &Popover.
p &PopoverPopover instance used by this call (borrow).int — a value of this type
($&Popover) set_viewportpub fn (p $&Popover) set_viewport(viewport &layout.Rect)Operation on $&Popover: set viewport.
p $&PopoverPopover instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&Popover) set_localepub fn (p $&Popover) set_locale(locale &Locale) intOperation on $&Popover: set locale. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).locale &Localeint — a value of this type
(&Popover) is_openpub fn (p &Popover) is_open() boolReturn whether the overlay, menu or dialog is currently open.
p &PopoverPopover instance used by this call (borrow).bool — true or false
(&Popover) is_visiblepub fn (p &Popover) is_visible() boolCheck whether the popover remains visible, including its exit transition.
p &PopoverPopover instance used by this call (borrow).true while open or fading out, and false once fully hidden.
(&Popover) opacitypub fn (p &Popover) opacity() f64Execute opacity on &Popover.
p &PopoverPopover instance used by this call (borrow).f64 — a value of this type
(&Popover) needs_paintpub fn (p &Popover) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
p &PopoverPopover instance used by this call (borrow).bool — true or false
($&Popover) paintedpub fn (p $&Popover) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
p $&PopoverPopover instance used by this call (exclusive borrow).This call does not return a value.
($&Popover) set_geometrypub fn (p $&Popover) set_geometry(anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) intOperation on $&Popover: set geometry. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).anchor &layout.Rectsize &layout.Sizeviewport &layout.Rectint — a value of this type
($&Popover) openpub fn (p $&Popover) open(now time.Instant,reduced_motion bool) intOpen the popover with its entrance animation; a disabled popover stays closed.
p $&PopoverPopover instance used by this call (exclusive borrow).now time.Instanttime.Instant; use the same time basis for opening, ticking and closing.reduced_motion booltrue moves directly to the target state.Returns 0 on success; failure throws rather than returning a nonzero status.
tick each frame and use is_visible to decide whether painting must continue.($&Popover) closepub fn (p $&Popover) close(now time.Instant,reduced_motion bool) intRequest closing with an exit animation; painting may continue briefly after logical closure.
p $&PopoverPopover instance used by this call (exclusive borrow).now time.Instanttime.Instant; use the same time basis for opening, ticking and closing.reduced_motion booltrue moves directly to the target state.Returns 0 on success; failure throws rather than returning a nonzero status.
is_open() becomes false on the close request; is_visible() becomes false after the exit animation ends.($&Popover) set_enabledpub fn (p $&Popover) set_enabled(enabled bool) intOperation on $&Popover: set enabled. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).enabled boolint — a value of this type
($&Popover) tickpub fn (p $&Popover) tick(now time.Instant,reduced_motion bool) boolAdvance the fade animation to the current time and use the result to schedule repainting.
p $&PopoverPopover instance used by this call (exclusive borrow).now time.Instanttime.Instant; use the same time basis for opening, ticking and closing.reduced_motion booltrue moves directly to the target state.true when opacity changes, otherwise false.
(&Popover) next_tickpub fn (p &Popover) next_tick(now time.Instant) time.InstantOperation on &Popover: next tick. Throws on failure; handle the error or propagate it to the caller.
p &PopoverPopover instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&Popover) inputpub fn (p $&Popover) input(event &ui.InputEvent) ActionHandle outside presses, Escape and cancellation according to the popover's dismissal settings.
p $&PopoverPopover instance used by this call (exclusive borrow).event &ui.InputEventAn Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
($&Popover) routepub fn (p $&Popover) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
(&Popover) paint_styledpub fn (p &Popover) paint_styled(frame $&draw.Frame,styles &Styles) intPaint the popover panel background and border.
p &PopoverPopover instance used by this call (borrow).frame $&draw.Framestyles &StylesReturns 0 on success; failure throws rather than returning a nonzero status.
($&Popover) paint_content_styledpub fn (p $&Popover) paint_content_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Popover: paint content styled. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Popover) paint_popup_styledpub fn (p $&Popover) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Popover: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
struct Modalpub struct Modal {
}Modal owns the keyboard focus order, while the host owns the actual child controls. Use blocks_input as the dispatch gate, including the closing fade. Cancel background View input before open (cancel_input) to release capture and native editor focus. Apply focused_id after open/input, and restore take_restore_focus after tick reports the closing fade finished. Never dispatch to background while blocks_input first call input, honor consumed even when that input closes the modal, then dispatch only to modal children if allows_content.
This type has no public fields.
modalpub fn modal(identity &ui.CanvasEvent,id int,bounds &layout.Rect,viewport &layout.Rect) ModalExecute modal. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectviewport &layout.RectModal — a value of this type
(&Modal) idpub fn (m &Modal) id() intReturn the unique integer ID of the element or control.
m &ModalModal instance used by this call (borrow).int — a value of this type
(&Modal) boundspub fn (m &Modal) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
m &ModalModal instance used by this call (borrow).layout.Rect — a value of this type
(&Modal) is_enabledpub fn (m &Modal) is_enabled() boolReturn whether the control is currently enabled.
m &ModalModal instance used by this call (borrow).bool — true or false
(&Modal) is_selectablepub fn (m &Modal) is_selectable() boolOperation on &Modal: whether it is selectable.
m &ModalModal instance used by this call (borrow).bool — true or false
($&Modal) set_selectablepub fn (m $&Modal) set_selectable(selectable bool)Operation on $&Modal: set selectable.
m $&ModalModal instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
($&Modal) set_textpub fn (m $&Modal) set_text(context &draw.Context,text &string) intOperation on $&Modal: set text. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).context &draw.Contexttext &stringint — a value of this type
(&Modal) has_popup_openpub fn (m &Modal) has_popup_open() boolOperation on &Modal: whether it has popup open.
m &ModalModal instance used by this call (borrow).bool — true or false
(&Modal) popup_boundspub fn (m &Modal) popup_bounds() layout.RectOperation on &Modal: popup bounds.
m &ModalModal instance used by this call (borrow).layout.Rect — a value of this type
(&Modal) selected_textpub fn (m &Modal) selected_text() stringOperation on &Modal: selected text.
m &ModalModal instance used by this call (borrow).string — result string
(&Modal) copy_selectionpub fn (m &Modal) copy_selection() intOperation on &Modal: copy selection.
m &ModalModal instance used by this call (borrow).int — a value of this type
(&Modal) cursorpub fn (m &Modal) cursor() intExecute cursor on &Modal.
m &ModalModal instance used by this call (borrow).int — a value of this type
($&Modal) set_localepub fn (m $&Modal) set_locale(locale &Locale) intOperation on $&Modal: set locale. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).locale &Localeint — a value of this type
(&Modal) is_openpub fn (m &Modal) is_open() boolReturn whether the overlay, menu or dialog is currently open.
m &ModalModal instance used by this call (borrow).bool — true or false
(&Modal) is_visiblepub fn (m &Modal) is_visible() boolCheck whether the modal remains visible, including its exit transition.
m &ModalModal instance used by this call (borrow).true while open or fading out, and false once fully hidden.
(&Modal) blocks_inputpub fn (m &Modal) blocks_input() boolKeep background input blocked throughout the closing fade.
m &ModalModal instance used by this call (borrow).bool — true or false
(&Modal) opacitypub fn (m &Modal) opacity() f64Execute opacity on &Modal.
m &ModalModal instance used by this call (borrow).f64 — a value of this type
(&Modal) needs_paintpub fn (m &Modal) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
m &ModalModal instance used by this call (borrow).bool — true or false
($&Modal) paintedpub fn (m $&Modal) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
m $&ModalModal instance used by this call (exclusive borrow).This call does not return a value.
($&Modal) set_dismiss_on_outsidepub fn (m $&Modal) set_dismiss_on_outside(enabled bool)Operation on $&Modal: set dismiss on outside.
m $&ModalModal instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Modal) focused_idpub fn (m &Modal) focused_id() intOperation on &Modal: focused id.
m &ModalModal instance used by this call (borrow).int — a value of this type
(&Modal) focus_restore_idpub fn (m &Modal) focus_restore_id() intOperation on &Modal: focus restore id.
m &ModalModal instance used by this call (borrow).int — a value of this type
($&Modal) take_restore_focuspub fn (m $&Modal) take_restore_focus() intConsume the one-time focus restoration target once the modal is fully hidden.
m $&ModalModal instance used by this call (exclusive borrow).Control ID to restore, or 0 while visible or without a pending request. Each request is consumed once.
(&Modal) contains_focuspub fn (m &Modal) contains_focus(id int) boolOperation on &Modal: contains focus.
m &ModalModal instance used by this call (borrow).id intbool — true or false
($&Modal) set_focus_orderpub fn (m $&Modal) set_focus_order(ids &[]int) intSet the modal's Tab traversal order so keyboard focus cycles through the specified controls.
m $&ModalModal instance used by this call (exclusive borrow).ids &[]int256; IDs must be positive, unique and different from the modal's own ID.Returns 0 on success; failure throws rather than returning a nonzero status.
($&Modal) set_content_focuspub fn (m $&Modal) set_content_focus(id int) intOperation on $&Modal: set content focus. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).id intint — a value of this type
($&Modal) openpub fn (m $&Modal) open(now time.Instant,reduced_motion bool,restore_focus int) intOpen the modal and remember the focus restoration target.
m $&ModalModal instance used by this call (exclusive borrow).now time.Instanttime.Instant; use the same time basis for opening, ticking and closing.reduced_motion booltrue moves directly to the target state.restore_focus int0 means no target and negative values are invalid.Returns 0 on success; failure throws rather than returning a nonzero status.
tick each frame and use is_visible to decide whether painting must continue.($&Modal) closepub fn (m $&Modal) close(now time.Instant,reduced_motion bool) intRequest closing with an exit animation; painting may continue briefly after logical closure.
m $&ModalModal instance used by this call (exclusive borrow).now time.Instanttime.Instant; use the same time basis for opening, ticking and closing.reduced_motion booltrue moves directly to the target state.Returns 0 on success; failure throws rather than returning a nonzero status.
is_open() becomes false on the close request; is_visible() becomes false after the exit animation ends.($&Modal) set_enabledpub fn (m $&Modal) set_enabled(enabled bool) intOperation on $&Modal: set enabled. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).enabled boolint — a value of this type
($&Modal) set_geometrypub fn (m $&Modal) set_geometry(bounds &layout.Rect,viewport &layout.Rect) intOperation on $&Modal: set geometry. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).bounds &layout.Rectviewport &layout.Rectint — a value of this type
(&Modal) close_boundspub fn (m &Modal) close_bounds() layout.RectOperation on &Modal: close bounds.
m &ModalModal instance used by this call (borrow).layout.Rect — a value of this type
(&Modal) allows_contentpub fn (m &Modal) allows_content(event &ui.InputEvent) boolDecide whether input may reach modal content after modal-first dispatch.
m &ModalModal instance used by this call (borrow).event &ui.InputEventtrue when allowed; false when closed, mismatched, handling Tab/Escape, or hitting the close button.
($&Modal) inputpub fn (m $&Modal) input(event &ui.InputEvent) ActionHandle modal dismissal and Tab focus cycling before deciding whether content can receive input.
m $&ModalModal instance used by this call (exclusive borrow).event &ui.InputEventAn Action: kind identifies the action, consumed marks a handled event, request_focus requests focus, and needs_paint requests repainting.
allows_content for content input. The modal continues blocking background input during its exit animation.($&Modal) routepub fn (m $&Modal) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Modal) tickpub fn (m $&Modal) tick(now time.Instant,reduced_motion bool) boolAdvance the fade animation to the current time and use the result to schedule repainting.
m $&ModalModal instance used by this call (exclusive borrow).now time.Instanttime.Instant; use the same time basis for opening, ticking and closing.reduced_motion booltrue moves directly to the target state.true when opacity changes, otherwise false.
(&Modal) next_tickpub fn (m &Modal) next_tick(now time.Instant) time.InstantOperation on &Modal: next tick. Throws on failure; handle the error or propagate it to the caller.
m &ModalModal instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
(&Modal) paint_styledpub fn (m &Modal) paint_styled(frame $&draw.Frame,styles &Styles) intPaint the modal backdrop, panel and close button.
m &ModalModal instance used by this call (borrow).frame $&draw.Framestyles &StylesReturns 0 on success; failure throws rather than returning a nonzero status.
Styles.overlay_scrim() with alpha scaled by the modal animation.($&Modal) paint_content_styledpub fn (m $&Modal) paint_content_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Modal: paint content styled. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Modal) paint_popup_styledpub fn (m $&Modal) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Modal: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&Popover) style_orpub fn (p &Popover) style_or(styles &Styles) ControlStyleOperation on &Popover: style or.
p &PopoverPopover instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Popover) set_stylepub fn (p $&Popover) set_style(style &ControlStyle) intOperation on $&Popover: set style. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Popover) set_motionpub fn (p $&Popover) set_motion(spec &MotionSpec) intOperation on $&Popover: set motion. Throws on failure; handle the error or propagate it to the caller.
p $&PopoverPopover instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&Modal) set_stylepub fn (m $&Modal) set_style(style &ControlStyle) intOperation on $&Modal: set style. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Modal) set_motionpub fn (m $&Modal) set_motion(spec &MotionSpec) intOperation on $&Modal: set motion. Throws on failure; handle the error or propagate it to the caller.
m $&ModalModal instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
struct Paginationpub struct Pagination {
}Zero based page state. Endpoints and a bounded page window are materialized; callers retain ownership of the actual paged data. Zero pages has current == -1.
This type has no public fields.
paginationpub fn pagination(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,pages int,current int) PaginationExecute pagination. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectpages intcurrent intPagination — a value of this type
(&Pagination) idpub fn (p &Pagination) id() intReturn the unique integer ID of the element or control.
p &PaginationPagination instance used by this call (borrow).int — a value of this type
(&Pagination) boundspub fn (p &Pagination) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
p &PaginationPagination instance used by this call (borrow).layout.Rect — a value of this type
(&Pagination) page_countpub fn (p &Pagination) page_count() intOperation on &Pagination: page count.
p &PaginationPagination instance used by this call (borrow).int — a value of this type
(&Pagination) selectedpub fn (p &Pagination) selected() intGet or test the currently selected index, node, or state.
p &PaginationPagination instance used by this call (borrow).int — a value of this type
(&Pagination) needs_paintpub fn (p &Pagination) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
p &PaginationPagination instance used by this call (borrow).bool — true or false
($&Pagination) paintedpub fn (p $&Pagination) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
p $&PaginationPagination instance used by this call (exclusive borrow).This call does not return a value.
(&Pagination) is_enabledpub fn (p &Pagination) is_enabled() boolReturn whether the control is currently enabled.
p &PaginationPagination instance used by this call (borrow).bool — true or false
(&Pagination) is_selectablepub fn (p &Pagination) is_selectable() boolOperation on &Pagination: whether it is selectable.
p &PaginationPagination instance used by this call (borrow).bool — true or false
($&Pagination) set_selectablepub fn (p $&Pagination) set_selectable(selectable bool)Operation on $&Pagination: set selectable.
p $&PaginationPagination instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Pagination) is_focusedpub fn (p &Pagination) is_focused() boolReturn whether the control currently has input focus.
p &PaginationPagination instance used by this call (borrow).bool — true or false
(&Pagination) is_read_onlypub fn (p &Pagination) is_read_only() boolOperation on &Pagination: whether it is read only.
p &PaginationPagination instance used by this call (borrow).bool — true or false
($&Pagination) cancelpub fn (p $&Pagination) cancel()Execute cancel on $&Pagination.
p $&PaginationPagination instance used by this call (exclusive borrow).This call does not return a value.
($&Pagination) set_focuspub fn (p $&Pagination) set_focus(focused bool)Operation on $&Pagination: set focus.
p $&PaginationPagination instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&Pagination) set_enabledpub fn (p $&Pagination) set_enabled(enabled bool)Operation on $&Pagination: set enabled.
p $&PaginationPagination instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&Pagination) set_read_onlypub fn (p $&Pagination) set_read_only(value bool) intOperation on $&Pagination: set read only. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).value boolint — a value of this type
($&Pagination) set_page_countpub fn (p $&Pagination) set_page_count(pages int) intOperation on $&Pagination: set page count. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).pages intint — a value of this type
($&Pagination) set_selectedpub fn (p $&Pagination) set_selected(index int) intOperation on $&Pagination: set selected. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).index intint — a value of this type
($&Pagination) set_boundspub fn (p $&Pagination) set_bounds(bounds &layout.Rect) intOperation on $&Pagination: set bounds. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Pagination) style_orpub fn (p &Pagination) style_or(styles &Styles) ControlStyleOperation on &Pagination: style or.
p &PaginationPagination instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Pagination) set_stylepub fn (p $&Pagination) set_style(style &ControlStyle) intOperation on $&Pagination: set style. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Pagination) clear_stylepub fn (p $&Pagination) clear_style()Operation on $&Pagination: clear style.
p $&PaginationPagination instance used by this call (exclusive borrow).This call does not return a value.
($&Pagination) apply_stylespub fn (p $&Pagination) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&Pagination) item_boundspub fn (p &Pagination) item_bounds(slot int) layout.RectOperation on &Pagination: item bounds.
p &PaginationPagination instance used by this call (borrow).slot intlayout.Rect — a value of this type
($&Pagination) inputpub fn (p $&Pagination) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
p $&PaginationPagination instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Pagination) routepub fn (p $&Pagination) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Pagination) eventpub fn (p $&Pagination) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
($&Pagination) measure_styledpub fn (p $&Pagination) measure_styled(styles &Styles) layout.SizeOperation on $&Pagination: measure styled. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&Pagination) paint_styledpub fn (p $&Pagination) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Pagination: paint styled. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Pagination) disposepub fn (p $&Pagination) dispose()Release and dispose native resources and underlying handles.
p $&PaginationPagination instance used by this call (exclusive borrow).This call does not return a value.
struct PaginationAppearancepub struct PaginationAppearance {
pub gap f64
pub min_item_width f64
pub stretch bool
}Structure encapsulating gap, min_item_width, stretch.
gap f64min_item_width f64stretch boolpagination_appearancepub fn pagination_appearance() PaginationAppearancePagination appearance.
No arguments are required.
PaginationAppearance — a value of this type
($&Pagination) set_appearancepub fn (page $&Pagination) set_appearance(appearance &PaginationAppearance) intOperation on $&Pagination: set appearance. Throws on failure; handle the error or propagate it to the caller.
page $&PaginationPagination instance used by this call (exclusive borrow).appearance &PaginationAppearanceint — a value of this type
struct PaginationDatapub struct PaginationData {
pub total int
pub page_size int
pub pages int
pub current int
}Structure encapsulating total, page_size, pages, current.
total intpage_size intpages intcurrent int(&Pagination) datapub fn (page &Pagination) data() PaginationDataExecute data on &Pagination.
page &PaginationPagination instance used by this call (borrow).PaginationData — a value of this type
($&Pagination) set_datapub fn (page $&Pagination) set_data(total int,page_size int) intKeep the first item being viewed visible when page size changes. Throws on failure; handle the error or propagate it to the caller.
page $&PaginationPagination instance used by this call (exclusive borrow).total intpage_size intint — a value of this type
($&Pagination) jumppub fn (page $&Pagination) jump(one_based int) intExecute jump on $&Pagination. Throws on failure; handle the error or propagate it to the caller.
page $&PaginationPagination instance used by this call (exclusive borrow).one_based intint — a value of this type
(&Pagination) summary_textpub fn (page &Pagination) summary_text() stringOperation on &Pagination: summary text. Throws on failure; handle the error or propagate it to the caller.
page &PaginationPagination instance used by this call (borrow).string — result string
($&Screen) set_pagination_datapub fn (s $&Screen) set_pagination_data(id int,total int,page_size int) intOperation on $&Screen: set pagination data. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttotal intpage_size intint — a value of this type
($&Screen) pagination_datapub fn (s $&Screen) pagination_data(id int) PaginationDataOperation on $&Screen: pagination data. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intPaginationData — a value of this type
($&Screen) pagination_summarypub fn (s $&Screen) pagination_summary(id int) stringOperation on $&Screen: pagination summary. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intstring — result string
($&Pagination) set_motionpub fn (p $&Pagination) set_motion(spec &MotionSpec) intOperation on $&Pagination: set motion. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&Pagination) tickpub fn (p $&Pagination) tick(styles &Styles,now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
p $&PaginationPagination instance used by this call (exclusive borrow).styles &Stylesnow time.Instantreduced boolbool — true or false
(&Pagination) next_tickpub fn (p &Pagination) next_tick(now time.Instant) time.InstantOperation on &Pagination: next tick. Throws on failure; handle the error or propagate it to the caller.
p &PaginationPagination instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
(&Switch) is_pendingpub fn (sw &Switch) is_pending() boolOperation on &Switch: whether it is pending.
sw &SwitchSwitch instance used by this call (borrow).bool — true or false
($&Switch) set_pendingpub fn (sw $&Switch) set_pending(pending bool)Business code completes or rolls back the value and then clears pending. The switch keeps keyboard focus while suppressing repeated submissions.
sw $&SwitchSwitch instance used by this call (exclusive borrow).pending boolThis call does not return a value.
($&Screen) set_switch_pendingpub fn (s $&Screen) set_switch_pending(id int,pending bool) intOperation on $&Screen: set switch pending. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intpending boolint — a value of this type
const OVERLAY_BOTTOMpub const OVERLAY_BOTTOM = 0Constant OVERLAY_BOTTOM, defining protocol or algorithm parameters.
const OVERLAY_TOPpub const OVERLAY_TOP = 1Constant OVERLAY_TOP, defining protocol or algorithm parameters.
const OVERLAY_LEFTpub const OVERLAY_LEFT = 2Constant OVERLAY_LEFT, defining protocol or algorithm parameters.
const OVERLAY_RIGHTpub const OVERLAY_RIGHT = 3Constant OVERLAY_RIGHT, defining protocol or algorithm parameters.
const OVERLAY_STARTpub const OVERLAY_START = 0Constant OVERLAY_START, defining protocol or algorithm parameters.
const OVERLAY_CENTERpub const OVERLAY_CENTER = 1Constant OVERLAY_CENTER, defining protocol or algorithm parameters.
const OVERLAY_ENDpub const OVERLAY_END = 2Constant OVERLAY_END, defining protocol or algorithm parameters.
struct OverlayPlacementpub struct OverlayPlacement {
pub side int
pub align int
pub gap f64
pub offset f64
pub flip bool
}Structure encapsulating side, align, gap, offset, flip.
side intalign intgap f64offset f64flip booloverlay_placementpub fn overlay_placement() OverlayPlacementOverlay placement.
No arguments are required.
OverlayPlacement — a value of this type
placed_overlay_boundspub fn placed_overlay_bounds(anchor &layout.Rect,size &layout.Size,viewport &layout.Rect,placement &OverlayPlacement) layout.RectPlaced overlay bounds. Throws on failure; handle the error or propagate it to the caller.
anchor &layout.Rectsize &layout.Sizeviewport &layout.Rectplacement &OverlayPlacementlayout.Rect — a value of this type
($&Popover) set_placementpub fn (panel $&Popover) set_placement(placement &OverlayPlacement) intOperation on $&Popover: set placement. Throws on failure; handle the error or propagate it to the caller.
panel $&PopoverPopover instance used by this call (exclusive borrow).placement &OverlayPlacementint — a value of this type
($&Popover) set_dismissalpub fn (panel $&Popover) set_dismissal(outside bool,escape bool)Operation on $&Popover: set dismissal.
panel $&PopoverPopover instance used by this call (exclusive borrow).outside boolescape boolThis call does not return a value.
($&Screen) set_popover_placementpub fn (s $&Screen) set_popover_placement(id int,placement &OverlayPlacement) intOperation on $&Screen: set popover placement. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intplacement &OverlayPlacementint — a value of this type
($&Screen) set_tooltip_placementpub fn (s $&Screen) set_tooltip_placement(id int,placement &OverlayPlacement) intOperation on $&Screen: set tooltip placement. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intplacement &OverlayPlacementint — a value of this type
($&Screen) set_popover_dismissalpub fn (s $&Screen) set_popover_dismissal(id int,outside bool,escape bool) intOperation on $&Screen: set popover dismissal. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intoutside boolescape boolint — a value of this type
struct RadioGrouppub struct RadioGroup {
}One focus stop owns the selection and arrow-key navigation for the group.
This type has no public fields.
radio_grouppub fn radio_group(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,options &[]string,selected int) RadioGroupRadio group. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectoptions &[]stringselected intRadioGroup — a value of this type
(&RadioGroup) idpub fn (g &RadioGroup) id() intReturn the unique integer ID of the element or control.
g &RadioGroupRadioGroup instance used by this call (borrow).int — a value of this type
(&RadioGroup) boundspub fn (g &RadioGroup) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
g &RadioGroupRadioGroup instance used by this call (borrow).layout.Rect — a value of this type
(&RadioGroup) countpub fn (g &RadioGroup) count() intReturn the number of items in this control.
g &RadioGroupRadioGroup instance used by this call (borrow).int — a value of this type
(&RadioGroup) selectedpub fn (g &RadioGroup) selected() intGet or test the currently selected index, node, or state.
g &RadioGroupRadioGroup instance used by this call (borrow).int — a value of this type
(&RadioGroup) needs_paintpub fn (g &RadioGroup) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
g &RadioGroupRadioGroup instance used by this call (borrow).bool — true or false
(&RadioGroup) is_enabledpub fn (g &RadioGroup) is_enabled() boolReturn whether the control is currently enabled.
g &RadioGroupRadioGroup instance used by this call (borrow).bool — true or false
(&RadioGroup) is_selectablepub fn (g &RadioGroup) is_selectable() boolOperation on &RadioGroup: whether it is selectable.
g &RadioGroupRadioGroup instance used by this call (borrow).bool — true or false
($&RadioGroup) set_selectablepub fn (g $&RadioGroup) set_selectable(selectable bool)Operation on $&RadioGroup: set selectable.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&RadioGroup) is_focusedpub fn (g &RadioGroup) is_focused() boolReturn whether the control currently has input focus.
g &RadioGroupRadioGroup instance used by this call (borrow).bool — true or false
($&RadioGroup) set_horizontalpub fn (g $&RadioGroup) set_horizontal(horizontal bool)Operation on $&RadioGroup: set horizontal.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).horizontal boolThis call does not return a value.
($&RadioGroup) set_focuspub fn (g $&RadioGroup) set_focus(focused bool)Operation on $&RadioGroup: set focus.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&RadioGroup) set_enabledpub fn (g $&RadioGroup) set_enabled(enabled bool)Operation on $&RadioGroup: set enabled.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&RadioGroup) set_read_onlypub fn (g $&RadioGroup) set_read_only(value bool)Operation on $&RadioGroup: set read only.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&RadioGroup) set_selectedpub fn (g $&RadioGroup) set_selected(index int) intOperation on $&RadioGroup: set selected. Throws on failure; handle the error or propagate it to the caller.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).index intint — a value of this type
($&RadioGroup) set_boundspub fn (g $&RadioGroup) set_bounds(bounds &layout.Rect) intOperation on $&RadioGroup: set bounds. Throws on failure; handle the error or propagate it to the caller.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&RadioGroup) style_orpub fn (g &RadioGroup) style_or(styles &Styles) ControlStyleOperation on &RadioGroup: style or.
g &RadioGroupRadioGroup instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&RadioGroup) set_stylepub fn (g $&RadioGroup) set_style(style &ControlStyle) intOperation on $&RadioGroup: set style. Throws on failure; handle the error or propagate it to the caller.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&RadioGroup) paintedpub fn (g $&RadioGroup) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).This call does not return a value.
($&RadioGroup) cancelpub fn (g $&RadioGroup) cancel()Execute cancel on $&RadioGroup.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).This call does not return a value.
(&RadioGroup) item_boundspub fn (g &RadioGroup) item_bounds(index int) layout.RectOperation on &RadioGroup: item bounds. Throws on failure; handle the error or propagate it to the caller.
g &RadioGroupRadioGroup instance used by this call (borrow).index intlayout.Rect — a value of this type
($&RadioGroup) inputpub fn (g $&RadioGroup) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&RadioGroup) routepub fn (g $&RadioGroup) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&RadioGroup) measure_styledpub fn (g $&RadioGroup) measure_styled(styles &Styles) layout.SizeOperation on $&RadioGroup: measure styled. Throws on failure; handle the error or propagate it to the caller.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&RadioGroup) paint_styledpub fn (g $&RadioGroup) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&RadioGroup: paint styled. Throws on failure; handle the error or propagate it to the caller.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&RadioGroup) disposepub fn (g $&RadioGroup) dispose()Release and dispose native resources and underlying handles.
g $&RadioGroupRadioGroup instance used by this call (exclusive borrow).This call does not return a value.
const RANGE_CLAMPpub const RANGE_CLAMP = 0Constant RANGE_CLAMP, defining protocol or algorithm parameters.
const RANGE_PUSHpub const RANGE_PUSH = 1Constant RANGE_PUSH, defining protocol or algorithm parameters.
struct RangeValuespub struct RangeValues {
pub lower f64
pub upper f64
pub active int
}Structure encapsulating lower, upper, active.
lower f64upper f64active intstruct RangeSliderOptionspub struct RangeSliderOptions {
pub step f64
pub min_distance f64
pub collision int
pub vertical bool
pub reversed bool
pub drag_range bool
pub commit_only bool
}Widgets Configuration parameters and options set.
step f64min_distance f64collision intvertical boolreversed booldrag_range boolcommit_only boolrange_slider_optionspub fn range_slider_options() RangeSliderOptionsRange slider options.
No arguments are required.
RangeSliderOptions — a value of this type
struct RangeSliderpub struct RangeSlider {
}RangeSlider context or state structure.
This type has no public fields.
range_sliderpub fn range_slider(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,minimum f64,maximum f64,lower f64,upper f64) RangeSliderValues are bounded numeric data. Invalid configuration is rejected atomically. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectminimum f64maximum f64lower f64upper f64RangeSlider — a value of this type
(&RangeSlider) idpub fn (r &RangeSlider) id() intReturn the unique integer ID of the element or control.
r &RangeSliderRangeSlider instance used by this call (borrow).int — a value of this type
(&RangeSlider) boundspub fn (r &RangeSlider) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
r &RangeSliderRangeSlider instance used by this call (borrow).layout.Rect — a value of this type
(&RangeSlider) valuespub fn (r &RangeSlider) values() RangeValuesReturn a slice containing all values in the collection.
r &RangeSliderRangeSlider instance used by this call (borrow).RangeValues — a value of this type
(&RangeSlider) needs_paintpub fn (r &RangeSlider) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
r &RangeSliderRangeSlider instance used by this call (borrow).bool — true or false
($&RangeSlider) paintedpub fn (r $&RangeSlider) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).This call does not return a value.
(&RangeSlider) is_enabledpub fn (r &RangeSlider) is_enabled() boolReturn whether the control is currently enabled.
r &RangeSliderRangeSlider instance used by this call (borrow).bool — true or false
(&RangeSlider) style_orpub fn (r &RangeSlider) style_or(styles &Styles) ControlStyleOperation on &RangeSlider: style or.
r &RangeSliderRangeSlider instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&RangeSlider) set_valuespub fn (r $&RangeSlider) set_values(lower f64,upper f64) intOperation on $&RangeSlider: set values. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).lower f64upper f64int — a value of this type
($&RangeSlider) set_optionspub fn (r $&RangeSlider) set_options(o &RangeSliderOptions) intOperation on $&RangeSlider: set options. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).o &RangeSliderOptionsint — a value of this type
($&RangeSlider) set_appearancepub fn (r $&RangeSlider) set_appearance(a &SliderAppearance) intOperation on $&RangeSlider: set appearance. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).a &SliderAppearanceint — a value of this type
($&RangeSlider) set_localepub fn (r $&RangeSlider) set_locale(locale &Locale) intOperation on $&RangeSlider: set locale. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&RangeSlider) set_stylepub fn (r $&RangeSlider) set_style(style &ControlStyle) intOperation on $&RangeSlider: set style. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&RangeSlider) clear_stylepub fn (r $&RangeSlider) clear_style()Operation on $&RangeSlider: clear style.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).This call does not return a value.
($&RangeSlider) set_motionpub fn (r $&RangeSlider) set_motion(spec &MotionSpec) intOperation on $&RangeSlider: set motion. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&RangeSlider) cancelpub fn (r $&RangeSlider) cancel()Execute cancel on $&RangeSlider.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).This call does not return a value.
($&RangeSlider) set_focuspub fn (r $&RangeSlider) set_focus(value bool)Operation on $&RangeSlider: set focus.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&RangeSlider) set_enabledpub fn (r $&RangeSlider) set_enabled(value bool)Operation on $&RangeSlider: set enabled.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&RangeSlider) set_read_onlypub fn (r $&RangeSlider) set_read_only(value bool)Operation on $&RangeSlider: set read only.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&RangeSlider) set_boundspub fn (r $&RangeSlider) set_bounds(b &layout.Rect) intOperation on $&RangeSlider: set bounds. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).b &layout.Rectint — a value of this type
($&RangeSlider) disposepub fn (r $&RangeSlider) dispose()Release and dispose native resources and underlying handles.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).This call does not return a value.
($&RangeSlider) tabpub fn (r $&RangeSlider) tab(backward bool,entering bool) boolA RangeSlider has two Tab stops. Screen calls this before moving to another node.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).backward boolentering boolbool — true or false
($&RangeSlider) inputpub fn (r $&RangeSlider) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&RangeSlider) routepub fn (r $&RangeSlider) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&RangeSlider) apply_stylespub fn (r $&RangeSlider) apply_styles(styles &Styles) intResolve and apply theme metrics to the control.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
($&RangeSlider) tickpub fn (r $&RangeSlider) tick(styles &Styles,now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).styles &Stylesnow time.Instantreduced boolbool — true or false
(&RangeSlider) next_tickpub fn (r &RangeSlider) next_tick(now time.Instant) time.InstantOperation on &RangeSlider: next tick. Throws on failure; handle the error or propagate it to the caller.
r &RangeSliderRangeSlider instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&RangeSlider) paint_styledpub fn (r $&RangeSlider) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&RangeSlider: paint styled. Throws on failure; handle the error or propagate it to the caller.
r $&RangeSliderRangeSlider instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
const SPAN_NORMALpub const SPAN_NORMAL = 0Inline text styling flags for RichText spans.
const SPAN_BOLDpub const SPAN_BOLD = 1Constant SPAN_BOLD, defining protocol or algorithm parameters.
const SPAN_ITALICpub const SPAN_ITALIC = 2Constant SPAN_ITALIC, defining protocol or algorithm parameters.
const SPAN_CODEpub const SPAN_CODE = 4Constant SPAN_CODE, defining protocol or algorithm parameters.
const SPAN_UNDERLINEpub const SPAN_UNDERLINE = 8Constant SPAN_UNDERLINE, defining protocol or algorithm parameters.
const SPAN_STRIKETHROUGHpub const SPAN_STRIKETHROUGH = 16Constant SPAN_STRIKETHROUGH, defining protocol or algorithm parameters.
const SPAN_LINKpub const SPAN_LINK = 32Constant SPAN_LINK, defining protocol or algorithm parameters.
struct TextSpanpub struct TextSpan {
pub text string
pub flags int
pub link_url string
pub color draw.Color
}Structure encapsulating text, flags, link_url, color.
text stringflags intlink_url stringcolor draw.Colortext_spanpub fn text_span(text string, flags int) TextSpanText span.
text stringflags intTextSpan — a value of this type
(&TextSpan) has_flagpub fn (span &TextSpan) has_flag(flag int) boolOperation on &TextSpan: whether it has flag.
span &TextSpanTextSpan instance used by this call (borrow).flag intbool — true or false
($&TextSpan) toggle_flagpub fn (span $&TextSpan) toggle_flag(flag int)Operation on $&TextSpan: toggle flag.
span $&TextSpanTextSpan instance used by this call (exclusive borrow).flag intThis call does not return a value.
(&TextSpan) clonepub fn (span &TextSpan) clone() TextSpanCopy the control or style snapshot into an independent TextSpan value.
span &TextSpanTextSpan instance used by this call (borrow).TextSpan — a value of this type
struct RichParagraphpub struct RichParagraph {
pub spans []TextSpan
pub heading_level int
}Structure encapsulating spans, heading_level.
spans []TextSpanheading_level intrich_paragraphpub fn rich_paragraph(heading int) RichParagraphRich paragraph.
heading intRichParagraph — a value of this type
(&RichParagraph) textpub fn (p &RichParagraph) text() stringOperation on &RichParagraph: return the current text.
p &RichParagraphRichParagraph instance used by this call (borrow).string — result string
($&RichParagraph) append_spanpub fn (p $&RichParagraph) append_span(span TextSpan)Operation on $&RichParagraph: append span.
p $&RichParagraphRichParagraph instance used by this call (exclusive borrow).span TextSpanThis call does not return a value.
struct RichDocumentpub struct RichDocument {
pub paragraphs []RichParagraph
pub anchor int
pub focus int
}Structure encapsulating paragraphs, anchor, focus.
paragraphs []RichParagraphanchor intfocus intrich_documentpub fn rich_document() RichDocumentRich document.
No arguments are required.
RichDocument — a value of this type
(&RichDocument) is_emptypub fn (doc &RichDocument) is_empty() boolOperation on &RichDocument: whether it is empty.
doc &RichDocumentRichDocument instance used by this call (borrow).bool — true or false
($&RichDocument) append_paragraphpub fn (doc $&RichDocument) append_paragraph(heading int) intOperation on $&RichDocument: append paragraph.
doc $&RichDocumentRichDocument instance used by this call (exclusive borrow).heading intint — a value of this type
($&RichDocument) append_spanpub fn (doc $&RichDocument) append_span(para_idx int, span TextSpan) intOperation on $&RichDocument: append span. Throws on failure; handle the error or propagate it to the caller.
doc $&RichDocumentRichDocument instance used by this call (exclusive borrow).para_idx intspan TextSpanint — a value of this type
(&RichDocument) to_plain_textpub fn (doc &RichDocument) to_plain_text() stringOperation on &RichDocument: convert to plain text.
doc &RichDocumentRichDocument instance used by this call (borrow).string — result string
(&RichDocument) char_countpub fn (doc &RichDocument) char_count() intOperation on &RichDocument: char count.
doc &RichDocumentRichDocument instance used by this call (borrow).int — a value of this type
($&RichDocument) set_selectionpub fn (doc $&RichDocument) set_selection(anchor int, focus int)Operation on $&RichDocument: set selection.
doc $&RichDocumentRichDocument instance used by this call (exclusive borrow).anchor intfocus intThis call does not return a value.
(&RichDocument) has_selectionpub fn (doc &RichDocument) has_selection() boolOperation on &RichDocument: whether it has selection.
doc &RichDocumentRichDocument instance used by this call (borrow).bool — true or false
(&RichDocument) is_copy_enabledpub fn (doc &RichDocument) is_copy_enabled() boolOperation on &RichDocument: whether it is copy enabled.
doc &RichDocumentRichDocument instance used by this call (borrow).bool — true or false
($&RichDocument) set_copy_enabledpub fn (doc $&RichDocument) set_copy_enabled(on bool)Operation on $&RichDocument: set copy enabled.
doc $&RichDocumentRichDocument instance used by this call (exclusive borrow).on boolThis call does not return a value.
(&RichDocument) selection_rangepub fn (doc &RichDocument) selection_range() TextRangeOperation on &RichDocument: selection range.
doc &RichDocumentRichDocument instance used by this call (borrow).TextRange — a value of this type
(&RichDocument) selected_textpub fn (doc &RichDocument) selected_text() stringPlain-text slice of the current selection, suitable for clipboard copy. Indexes are UTF-8 byte offsets into to_plain_text. Empty when copy is disabled.
doc &RichDocumentRichDocument instance used by this call (borrow).string — result string
const SCREEN_SECRET_INPUTpub const SCREEN_SECRET_INPUT = 35Constant SCREEN_SECRET_INPUT, defining protocol or algorithm parameters.
const SCREEN_SELECTABLE_TEXTpub const SCREEN_SELECTABLE_TEXT = 40Constant SCREEN_SELECTABLE_TEXT, defining protocol or algorithm parameters.
const ACTION_KEYpub const ACTION_KEY = 5Constant ACTION_KEY, defining protocol or algorithm parameters.
struct ScreenNodeInfopub struct ScreenNodeInfo {
pub id int
pub kind int
pub parent int
pub x f64
pub y f64
pub width f64
pub height f64
pub visible bool
pub enabled bool
pub focusable bool
pub focused bool
pub text string
pub secure bool
}A bounded, immutable view of one retained screen node for tooling adapters. The internal node remains private so callers cannot forge handles or mutate layout/resource state behind Screen's lifecycle checks.
id intkind intparent intx f64y f64width f64height f64visible boolenabled boolfocusable boolfocused booltext stringsecure boolconst XACP_MAX_NODESpub const XACP_MAX_NODES = 512Constant XACP_MAX_NODES, defining protocol or algorithm parameters.
const XACP_MAX_NODE_TEXTpub const XACP_MAX_NODE_TEXT = 65536Constant XACP_MAX_NODE_TEXT, defining protocol or algorithm parameters.
struct Screenpub struct Screen {
}Screen context or state structure.
This type has no public fields.
screenpub fn screen(ready &ui.Event) ScreenExecute screen. Throws on failure; handle the error or propagate it to the caller.
ready &ui.EventScreen — a value of this type
(&Screen) is_openpub fn (s &Screen) is_open() boolReturn whether the overlay, menu or dialog is currently open.
s &ScreenScreen instance used by this call (borrow).bool — true or false
(&Screen) xacp_window_idpub fn (s &Screen) xacp_window_id() intOperation on &Screen: xacp window id.
s &ScreenScreen instance used by this call (borrow).int — a value of this type
(&Screen) xacp_canvas_idpub fn (s &Screen) xacp_canvas_id() intOperation on &Screen: xacp canvas id.
s &ScreenScreen instance used by this call (borrow).int — a value of this type
(&Screen) xacp_generationpub fn (s &Screen) xacp_generation() intOperation on &Screen: xacp generation.
s &ScreenScreen instance used by this call (borrow).int — a value of this type
(&Screen) xacp_close_eventspub fn (s &Screen) xacp_close_events() chan intA single control attachment may observe close/dispose without retaining a Screen reference. The Screen owner is the sole sender; notification is bounded.
s &ScreenScreen instance used by this call (borrow).chan int — a value of this type
(&Screen) widthpub fn (s &Screen) width() f64Execute width on &Screen.
s &ScreenScreen instance used by this call (borrow).f64 — a value of this type
(&Screen) heightpub fn (s &Screen) height() f64Execute height on &Screen.
s &ScreenScreen instance used by this call (borrow).f64 — a value of this type
(&Screen) focusedpub fn (s &Screen) focused() intExecute focused on &Screen.
s &ScreenScreen instance used by this call (borrow).int — a value of this type
(&Screen) reduced_motionpub fn (s &Screen) reduced_motion() boolOperation on &Screen: reduced motion.
s &ScreenScreen instance used by this call (borrow).bool — true or false
(&Screen) viewportpub fn (s &Screen) viewport() layout.RectExecute viewport on &Screen.
s &ScreenScreen instance used by this call (borrow).layout.Rect — a value of this type
($&Screen) invalidatepub fn (s $&Screen) invalidate()Invalidate the control area, requesting a repaint on next frame.
s $&ScreenScreen instance used by this call (exclusive borrow).This call does not return a value.
($&Screen) resizepub fn (s $&Screen) resize(width f64,height f64) intExecute resize on $&Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).width f64height f64int — a value of this type
($&Screen) set_min_sizepub fn (s $&Screen) set_min_size(width int,height int) intOperation on $&Screen: set min size. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).width intheight intint — a value of this type
($&Screen) set_stylespub fn (s $&Screen) set_styles(styles &Styles) intOperation on $&Screen: set styles. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&Screen) stylespub fn (s &Screen) styles() StylesExecute styles on &Screen.
s &ScreenScreen instance used by this call (borrow).Styles — a value of this type
(&Screen) row_heightpub fn (s &Screen) row_height() f64Operation on &Screen: row height.
s &ScreenScreen instance used by this call (borrow).f64 — a value of this type
($&Screen) set_reduced_motionpub fn (s $&Screen) set_reduced_motion(reduced bool)Operation on $&Screen: set reduced motion.
s $&ScreenScreen instance used by this call (exclusive borrow).reduced boolThis call does not return a value.
($&Screen) grouppub fn (s $&Screen) group() intExecute group on $&Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).int — a value of this type
($&Screen) buttonpub fn (s $&Screen) button(text string) intCreate Button in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringint — component node ID for place and other Screen methods.
($&Screen) labelpub fn (s $&Screen) label(text string,size f64,muted bool) intCreate StyledLabel in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringsize f64muted boolint — component node ID for place and other Screen methods.
($&Screen) set_textpub fn (s $&Screen) set_text(id int,text string) intOperation on $&Screen: set text. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttext stringint — a value of this type
($&Screen) set_selected_buttonpub fn (s $&Screen) set_selected_button(id int,selected bool) intOperation on $&Screen: set selected button. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intselected boolint — a value of this type
(&Screen) is_descendantpub fn (s &Screen) is_descendant(id int,parent int) boolOperation on &Screen: whether it is descendant.
s &ScreenScreen instance used by this call (borrow).id intparent intbool — true or false
(&Screen) is_visiblepub fn (s &Screen) is_visible(id int) boolOperation on &Screen: whether it is visible.
s &ScreenScreen instance used by this call (borrow).id intbool — true or false
($&Screen) set_parentpub fn (s $&Screen) set_parent(id int,parent int) intOperation on $&Screen: set parent. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intparent intint — a value of this type
($&Screen) set_visiblepub fn (s $&Screen) set_visible(id int,visible bool) intOperation on $&Screen: set visible. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvisible boolint — a value of this type
($&Screen) set_enabledpub fn (s $&Screen) set_enabled(id int,enabled bool) intOperation on $&Screen: set enabled. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intenabled boolint — a value of this type
($&Screen) placepub fn (s $&Screen) place(id int,x f64,y f64,width f64,height f64) intCompute and place control bounds within canvas layout. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intx f64y f64width f64height f64int — a value of this type
(&Screen) boundspub fn (s &Screen) bounds(id int) layout.RectReturn the bounding Rectangle of the control or geometry. Throws on failure; handle the error or propagate it to the caller.
s &ScreenScreen instance used by this call (borrow).id intlayout.Rect — a value of this type
($&Screen) xacp_treepub fn (s $&Screen) xacp_tree(include_hidden bool,max_rows int) []ScreenNodeInfoxacp_tree is the only public node enumeration API. It lays out controls before copying data, caps the result, and returns no internal handles. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).include_hidden boolmax_rows int[]ScreenNodeInfo — slice result
($&Screen) xacp_inputpub fn (s $&Screen) xacp_input(events &[]ui.InputEvent,max_events int) []Actionxacp_input validates canvas identity before dispatching every event. A foreign or stale generation is an error rather than a silently ignored UI operation, which prevents use-after-close and cross-window event injection. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).events &[]ui.InputEventmax_events int[]Action — slice result
($&Screen) xacp_actpub fn (s $&Screen) xacp_act(id int,act string,text string,checked bool) []Actionxacp_act provides the small, schema-approved action set. Click is routed through the normal pointer path, so hit testing, modal rules and focus transitions remain identical to native input. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intact stringtext stringchecked bool[]Action — slice result
($&Screen) cancel_allpub fn (s $&Screen) cancel_all() intOperation on $&Screen: cancel all. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).int — a value of this type
($&Screen) focuspub fn (s $&Screen) focus(id int) intExecute focus on $&Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) renderpub fn (s $&Screen) render() boolExecute render on $&Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).bool — true or false
($&Screen) export_xdfpub fn (s $&Screen) export_xdf() stringOperation on $&Screen: export xdf. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).string — result string
($&Screen) snapshotpub fn (s $&Screen) snapshot(scale f64) draw.SurfaceExport/preview still uses the same placement and layer ordering as render. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).scale f64draw.Surface — a value of this type
($&Screen) snapshot_nodepub fn (s $&Screen) snapshot_node(id int,scale f64) draw.Surfacesnapshot_node uses the same paint order as the full snapshot while clipping and translating the requested node rectangle. The returned Surface remains an owning native resource and must be disposed by the caller. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intscale f64draw.Surface — a value of this type
($&Screen) advancepub fn (s $&Screen) advance(now time.Instant) time.InstantExecute advance on $&Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).now time.Instanttime.Instant — a value of this type
($&Screen) dispatchpub fn (s $&Screen) dispatch(input &ui.InputEvent) []ActionExecute dispatch on $&Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).input &ui.InputEvent[]Action — slice result
($&Screen) eventpub fn (s $&Screen) event(event &ui.Event) []ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).event &ui.Event[]Action — slice result
($&Screen) nextpub fn (s $&Screen) next(events chan ui.Event) []ActionBlock when idle; coalesce non-semantic input bursts before one repaint. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).events chan ui.Event[]Action — slice result
($&Screen) closepub fn (s $&Screen) close() intOperation on $&Screen: close the resource. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).int — a value of this type
($&Screen) disposepub fn (s $&Screen) dispose()Release and dispose native resources and underlying handles.
s $&ScreenScreen instance used by this call (exclusive borrow).This call does not return a value.
struct@ ScreenHandlerpub struct@ ScreenHandler {
fn layout($&Screen) int
fn update($&Screen,Action) int
}The callback owns business state only. Screen owns dispatch, rendering, native resources and cleanup, including errors from either callback.
layout fn layout($&Screen) intlayout on ScreenHandler.update fn update($&Screen,Action) intupdate on ScreenHandler.(ScreenHandler) layoutfn layout($&Screen) intExecute layout on ScreenHandler.
self SelfSelf instance used by this call (value receiver).screen $&Screenint — a value of this type
(ScreenHandler) updatefn update($&Screen,Action) intExecute update on ScreenHandler.
self SelfSelf instance used by this call (value receiver).screen $&Screenaction Actionint — a value of this type
run_screenpub fn run_screen#H:ScreenHandler(s $&Screen,events chan ui.Event,handler $&H,tables <-> ActionDispatcher#H,Screen,Action) intExisting three-argument callers use update as the fallback. Supply one table to register functions; its fallback (if set) runs before legacy update. Throws on failure; handle the error or propagate it to the caller.
s $&Screenevents chan ui.Eventhandler $&Htables <-> ActionDispatcher#Hscreen Screenaction Actionint — a value of this type
($&Screen) take_actionspub fn (s $&Screen) take_actions() []Actionnext drains these automatically. Custom event loops call this after advance to receive timer-driven actions such as Stepper repetition.
s $&ScreenScreen instance used by this call (exclusive borrow).[]Action — slice result
($&Screen) set_tree_appearancepub fn (s $&Screen) set_tree_appearance(id int,appearance &TreeAppearance) intOperation on $&Screen: set tree appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intappearance &TreeAppearanceint — a value of this type
($&Screen) set_tree_metadatapub fn (s $&Screen) set_tree_metadata(id int,node int,value string) intOperation on $&Screen: set tree metadata. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intnode intvalue stringint — a value of this type
($&Screen) set_tree_actionpub fn (s $&Screen) set_tree_action(id int,node int,enabled bool) intOperation on $&Screen: set tree action. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intnode intenabled boolint — a value of this type
($&Screen) set_tree_filterpub fn (s $&Screen) set_tree_filter(id int,query string) intOperation on $&Screen: set tree filter. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intquery stringint — a value of this type
($&Screen) set_field_invalidpub fn (s $&Screen) set_field_invalid(id int,invalid bool) intOperation on $&Screen: set field invalid. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intinvalid boolint — a value of this type
($&Screen) set_field_read_onlypub fn (s $&Screen) set_field_read_only(id int,read_only bool) intOperation on $&Screen: set field read only. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intread_only boolint — a value of this type
($&Screen) set_task_labelspub fn (s $&Screen) set_task_labels(id int,running string,success string,error string,cancelled string) intOperation on $&Screen: set task labels. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intrunning stringsuccess stringerror stringcancelled stringint — a value of this type
($&Screen) checkboxpub fn (s $&Screen) checkbox(text string,checked bool) intCreate Checkbox in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringchecked boolint — component node ID for place and other Screen methods.
($&Screen) switch_controlpub fn (s $&Screen) switch_control(text string,checked bool) intCreate Switch in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringchecked boolint — component node ID for place and other Screen methods.
($&Screen) radiopub fn (s $&Screen) radio(text string,option int,checked bool) intCreate Radio in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringoption intchecked boolint — component node ID for place and other Screen methods.
($&Screen) sliderpub fn (s $&Screen) slider(minimum f64,maximum f64,value f64) intCreate Slider in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).minimum f64maximum f64value f64int — component node ID for place and other Screen methods.
($&Screen) stepperpub fn (s $&Screen) stepper(minimum f64,maximum f64,step f64,value f64) intCreate Stepper in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).minimum f64maximum f64step f64value f64int — component node ID for place and other Screen methods.
($&Screen) tabspub fn (s $&Screen) tabs(options &[]string,selected int) intCreate Tabs in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).options &[]stringselected intint — component node ID for place and other Screen methods.
($&Screen) select_boxpub fn (s $&Screen) select_box(options &[]string,selected int) intCreate Select in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).options &[]stringselected intint — component node ID for place and other Screen methods.
($&Screen) list_boxpub fn (s $&Screen) list_box(options &[]string,selected int) intCreate ListBox in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).options &[]stringselected intint — component node ID for place and other Screen methods.
($&Screen) progresspub fn (s $&Screen) progress(value f64) intCreate Progress in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value f64int — component node ID for place and other Screen methods.
($&Screen) dividerpub fn (s $&Screen) divider(axis int) intCreate Divider in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).axis intint — component node ID for place and other Screen methods.
($&Screen) badgepub fn (s $&Screen) badge(text string) intCreate Badge in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringint — component node ID for place and other Screen methods.
($&Screen) cardpub fn (s $&Screen) card() intCreate Card in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).int — component node ID for place and other Screen methods.
($&Screen) segmentedpub fn (s $&Screen) segmented(options &[]string,selected int) intCreate Segmented in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).options &[]stringselected intint — component node ID for place and other Screen methods.
($&Screen) toggle_valuepub fn (s $&Screen) toggle_value(id int) boolOperation on $&Screen: toggle value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intbool — true or false
($&Screen) number_valuepub fn (s $&Screen) number_value(id int) f64Operation on $&Screen: number value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intf64 — a value of this type
($&Screen) set_toggle_valuepub fn (s $&Screen) set_toggle_value(id int,checked bool) intOperation on $&Screen: set toggle value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intchecked boolint — a value of this type
($&Screen) set_number_valuepub fn (s $&Screen) set_number_value(id int,value f64) intOperation on $&Screen: set number value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvalue f64int — a value of this type
($&Screen) radio_grouppub fn (s $&Screen) radio_group(options &[]string,selected int) intCreate RadioGroup in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).options &[]stringselected intint — component node ID for place and other Screen methods.
($&Screen) set_candidate_openpub fn (s $&Screen) set_candidate_open(id int,open bool) intOperation on $&Screen: set candidate open. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intopen boolint — a value of this type
($&Screen) set_chart_seriespub fn (s $&Screen) set_chart_series(id int,series &[]chart.ChartSeries) intOperation on $&Screen: set chart series. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intseries &[]chart.ChartSeriesint — a value of this type
($&Screen) set_chart_appearancepub fn (s $&Screen) set_chart_appearance(id int,appearance &chart.ChartAppearance) intOperation on $&Screen: set chart appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intappearance &chart.ChartAppearanceint — a value of this type
($&Screen) set_chart_domainpub fn (s $&Screen) set_chart_domain(id int,domain &chart.ChartDomain) intOperation on $&Screen: set chart domain. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intdomain &chart.ChartDomainint — a value of this type
($&Screen) set_chart_viewportpub fn (s $&Screen) set_chart_viewport(id int,view &chart.ChartDomain) intOperation on $&Screen: set chart viewport. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intview &chart.ChartDomainint — a value of this type
($&Screen) set_chart_animationpub fn (s $&Screen) set_chart_animation(id int,options &AnimationOptions) intOperation on $&Screen: set chart animation. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intoptions &AnimationOptionsint — a value of this type
($&Screen) seek_chart_animationpub fn (s $&Screen) seek_chart_animation(id int,progress f64) intOperation on $&Screen: seek chart animation. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intprogress f64int — a value of this type
($&Screen) pause_chart_animationpub fn (s $&Screen) pause_chart_animation(id int) intOperation on $&Screen: pause chart animation. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) resume_chart_animationpub fn (s $&Screen) resume_chart_animation(id int) intOperation on $&Screen: resume chart animation. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) reset_chart_viewportpub fn (s $&Screen) reset_chart_viewport(id int) intOperation on $&Screen: reset chart viewport. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) use_chart_auto_domainpub fn (s $&Screen) use_chart_auto_domain(id int) intOperation on $&Screen: use chart auto domain. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) select_chart_pointpub fn (s $&Screen) select_chart_point(id int,series_id int,point_id int) intOperation on $&Screen: select chart point. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intseries_id intpoint_id intint — a value of this type
($&Screen) set_chart_series_visiblepub fn (s $&Screen) set_chart_series_visible(id int,series_id int,visible bool) intOperation on $&Screen: set chart series visible. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intseries_id intvisible boolint — a value of this type
($&Screen) chart_localepub fn (s $&Screen) chart_locale(id int,locale &Locale) intOperation on $&Screen: chart locale. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intlocale &Localeint — a value of this type
($&Screen) chart_hoveredpub fn (s $&Screen) chart_hovered(id int) chart.ChartHitOperation on $&Screen: chart hovered. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intchart.ChartHit — a value of this type
($&Screen) chart_selectionpub fn (s $&Screen) chart_selection(id int) chart.ChartHitOperation on $&Screen: chart selection. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intchart.ChartHit — a value of this type
($&Screen) chart_viewportpub fn (s $&Screen) chart_viewport(id int) chart.ChartDomainOperation on $&Screen: chart viewport. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intchart.ChartDomain — a value of this type
($&Screen) chart_animation_progresspub fn (s $&Screen) chart_animation_progress(id int) f64Operation on $&Screen: chart animation progress. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intf64 — a value of this type
($&Screen) set_button_group_itemspub fn (s $&Screen) set_button_group_items(id int,items &[]ButtonGroupItem) intOperation on $&Screen: set button group items. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intitems &[]ButtonGroupItemint — a value of this type
($&Screen) set_button_group_appearancepub fn (s $&Screen) set_button_group_appearance(id int,appearance &ButtonGroupAppearance) intOperation on $&Screen: set button group appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intappearance &ButtonGroupAppearanceint — a value of this type
($&Screen) set_button_group_item_enabledpub fn (s $&Screen) set_button_group_item_enabled(id int,key int,enabled bool) intOperation on $&Screen: set button group item enabled. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intkey intenabled boolint — a value of this type
($&Screen) set_button_group_labelpub fn (s $&Screen) set_button_group_label(id int,key int,label string) intOperation on $&Screen: set button group label. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intkey intlabel stringint — a value of this type
($&Screen) set_button_group_checkedpub fn (s $&Screen) set_button_group_checked(id int,key int,selected bool) intOperation on $&Screen: set button group checked. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intkey intselected boolint — a value of this type
($&Screen) button_group_valuespub fn (s $&Screen) button_group_values(id int) []intOperation on $&Screen: button group values. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id int[]int — slice result
($&Screen) button_group_activepub fn (s $&Screen) button_group_active(id int) intOperation on $&Screen: button group active. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) chart_positionpub fn (s $&Screen) chart_position(id int,x f64,y f64) chart.ChartCoordinateOperation on $&Screen: chart position. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intx f64y f64chart.ChartCoordinate — a value of this type
($&Screen) chart_hit_testpub fn (s $&Screen) chart_hit_test(id int,x f64,y f64) chart.ChartHitOperation on $&Screen: chart hit test. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intx f64y f64chart.ChartHit — a value of this type
($&Screen) remember_colorpub fn (s $&Screen) remember_color(id int) intOperation on $&Screen: remember color. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) set_tab_behaviorpub fn (s $&Screen) set_tab_behavior(id int,widths &[]f64,automatic bool) intOperation on $&Screen: set tab behavior. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intwidths &[]f64automatic boolint — a value of this type
($&Screen) set_table_columnpub fn (s $&Screen) set_table_column(id int,column int,width f64,alignment f64) intOperation on $&Screen: set table column. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intcolumn intwidth f64alignment f64int — a value of this type
($&Screen) set_table_statuspub fn (s $&Screen) set_table_status(id int,text string) intOperation on $&Screen: set table status. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttext stringint — a value of this type
($&Screen) set_multi_filterpub fn (s $&Screen) set_multi_filter(id int,query string) intOperation on $&Screen: set multi filter. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intquery stringint — a value of this type
($&Screen) select_allpub fn (s $&Screen) select_all(id int,selected bool) intOperation on $&Screen: select all. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intselected boolint — a value of this type
($&Screen) set_date_optionspub fn (s $&Screen) set_date_options(id int,today time.Time,clearable bool) intOperation on $&Screen: set date options. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttoday time.Timeclearable boolint — a value of this type
($&Screen) clear_calendarpub fn (s $&Screen) clear_calendar(id int) intOperation on $&Screen: clear calendar. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) set_clock_formatpub fn (s $&Screen) set_clock_format(id int,twelve_hour bool,seconds bool) intOperation on $&Screen: set clock format. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttwelve_hour boolseconds boolint — a value of this type
($&Screen) set_color_hexpub fn (s $&Screen) set_color_hex(id int,value string) intOperation on $&Screen: set color hex. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvalue stringint — a value of this type
($&Screen) set_color_swatchespub fn (s $&Screen) set_color_swatches(id int,colors &[]draw.Color) intOperation on $&Screen: set color swatches. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intcolors &[]draw.Colorint — a value of this type
($&Screen) set_stepper_repeatpub fn (s $&Screen) set_stepper_repeat(id int,enabled bool,delay time.Duration,interval time.Duration) intOperation on $&Screen: set stepper repeat. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intenabled booldelay time.Durationinterval time.Durationint — a value of this type
($&Screen) set_spinner_appearancepub fn (s $&Screen) set_spinner_appearance(id int,diameter f64,thickness f64,period time.Duration) intOperation on $&Screen: set spinner appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intdiameter f64thickness f64period time.Durationint — a value of this type
($&Screen) set_checkbox_indeterminatepub fn (s $&Screen) set_checkbox_indeterminate(id int,mixed bool) intOperation on $&Screen: set checkbox indeterminate. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intmixed boolint — a value of this type
($&Screen) set_badge_tonepub fn (s $&Screen) set_badge_tone(id int,tone int) intOperation on $&Screen: set badge tone. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttone intint — a value of this type
($&Screen) set_progress_bufferpub fn (s $&Screen) set_progress_buffer(id int,value f64) intOperation on $&Screen: set progress buffer. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvalue f64int — a value of this type
($&Screen) color_hexpub fn (s $&Screen) color_hex(id int) stringOperation on $&Screen: color hex. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intstring — result string
($&Screen) calendar_has_valuepub fn (s $&Screen) calendar_has_value(id int) boolOperation on $&Screen: calendar has value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intbool — true or false
($&Screen) text_field_areapub fn (s $&Screen) text_field_area(value string,decoration &FieldDecoration) intCreate FieldArea in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value stringdecoration &FieldDecorationint — component node ID for place and other Screen methods.
($&Screen) set_task_feedbackpub fn (s $&Screen) set_task_feedback(id int,feedback &TaskFeedback) intOperation on $&Screen: set task feedback. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intfeedback &TaskFeedbackint — a value of this type
($&Screen) set_select_option_enabledpub fn (s $&Screen) set_select_option_enabled(id int,index int,enabled bool) intOperation on $&Screen: set select option enabled. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intindex intenabled boolint — a value of this type
($&Screen) set_combo_custom_valuespub fn (s $&Screen) set_combo_custom_values(id int,allowed bool) intOperation on $&Screen: set combo custom values. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intallowed boolint — a value of this type
($&Screen) icon_buttonpub fn (s $&Screen) icon_button(asset string,text string) intCreate IconButton in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).asset stringtext stringint — component node ID for place and other Screen methods.
($&Screen) button_with_iconpub fn (s $&Screen) button_with_icon(asset string,text string) intA visible image plus label, with normal Button focus, variants and actions. ControlStyle.icon_placement selects leading/trailing/above/below placement. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).asset stringtext stringint — a value of this type
($&Screen) measure_buttonpub fn (s $&Screen) measure_button(id int) layout.SizeIntrinsic size in Screen coordinates, including the current style, density, text scale and icon placement. Call again after changing any of those inputs. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intlayout.Size — a value of this type
($&Screen) set_label_wrappedpub fn (s $&Screen) set_label_wrapped(id int,wrapped bool) intOperation on $&Screen: set label wrapped. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intwrapped boolint — a value of this type
($&Screen) tablepub fn (s $&Screen) table(headers &[]string,rows int,selected int) intCreate Table in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).headers &[]stringrows intselected intint — component node ID for place and other Screen methods.
($&Screen) treepub fn (s $&Screen) tree() intCreate TreeView in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).int — component node ID for place and other Screen methods.
($&Screen) paginationpub fn (s $&Screen) pagination(pages int,current int) intCreate Pagination in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).pages intcurrent intint — component node ID for place and other Screen methods.
($&Screen) breadcrumbspub fn (s $&Screen) breadcrumbs(items &[]string) intCreate Breadcrumbs in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).items &[]stringint — component node ID for place and other Screen methods.
($&Screen) combo_boxpub fn (s $&Screen) combo_box(options &[]string,value string) intCreate ComboBox in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).options &[]stringvalue stringint — component node ID for place and other Screen methods.
($&Screen) multi_selectpub fn (s $&Screen) multi_select(options &[]string) intCreate MultiSelect in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).options &[]stringint — component node ID for place and other Screen methods.
($&Screen) color_pickerpub fn (s $&Screen) color_picker(value draw.Color) intCreate ColorPicker in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value draw.Colorint — component node ID for place and other Screen methods.
($&Screen) date_pickerpub fn (s $&Screen) date_picker(value time.Time) intCreate DatePicker in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value time.Timeint — component node ID for place and other Screen methods.
($&Screen) time_pickerpub fn (s $&Screen) time_picker(value time.Time) intCreate TimePicker in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value time.Timeint — component node ID for place and other Screen methods.
($&Screen) spinnerpub fn (s $&Screen) spinner() intCreate Spinner in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).int — component node ID for place and other Screen methods.
($&Screen) inputpub fn (s $&Screen) input(value string) intCreate Input in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value stringint — component node ID for place and other Screen methods.
($&Screen) secret_inputpub fn (s $&Screen) secret_input(value string) intA secret input has the same editing behavior as input; tooling must redact its value and bounds. This flag follows the node for its entire lifetime. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).value stringint — a value of this type
($&Screen) set_securepub fn (s $&Screen) set_secure(id int,secure bool) intMark password/secure controls (including application-defined controls) for screenshot and accessibility export redaction. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intsecure boolint — a value of this type
($&Screen) text_areapub fn (s $&Screen) text_area(value string) intCreate TextArea in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value stringint — component node ID for place and other Screen methods.
($&Screen) set_cellpub fn (s $&Screen) set_cell(id int,row int,column int,value string) intOperation on $&Screen: set cell. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id introw intcolumn intvalue stringint — a value of this type
($&Screen) sort_columnpub fn (s $&Screen) sort_column(id int) intOperation on $&Screen: sort column. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) sort_descendingpub fn (s $&Screen) sort_descending(id int) boolOperation on $&Screen: sort descending. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intbool — true or false
($&Screen) tree_addpub fn (s $&Screen) tree_add(id int,parent int,value string) intOperation on $&Screen: tree add. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intparent intvalue stringint — a value of this type
($&Screen) set_expandedpub fn (s $&Screen) set_expanded(id int,index int,expanded bool) intOperation on $&Screen: set expanded. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intindex intexpanded boolint — a value of this type
($&Screen) selectedpub fn (s $&Screen) selected(id int) intGet or test the currently selected index, node, or state. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) set_selectedpub fn (s $&Screen) set_selected(id int,index int) intOperation on $&Screen: set selected. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intindex intint — a value of this type
($&Screen) set_checkedpub fn (s $&Screen) set_checked(id int,index int,checked bool) intOperation on $&Screen: set checked. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intindex intchecked boolint — a value of this type
($&Screen) valuespub fn (s $&Screen) values(id int) []intReturn a slice containing all values in the collection. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id int[]int — slice result
($&Screen) text_valuepub fn (s $&Screen) text_value(id int) stringOperation on $&Screen: text value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intstring — result string
($&Screen) set_valuepub fn (s $&Screen) set_value(id int,value string) intOperation on $&Screen: set value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvalue stringint — a value of this type
($&Screen) color_valuepub fn (s $&Screen) color_value(id int) draw.ColorOperation on $&Screen: color value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intdraw.Color — a value of this type
($&Screen) set_color_valuepub fn (s $&Screen) set_color_value(id int,value draw.Color) intOperation on $&Screen: set color value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvalue draw.Colorint — a value of this type
($&Screen) calendar_valuepub fn (s $&Screen) calendar_value(id int) time.TimeOperation on $&Screen: calendar value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttime.Time — a value of this type
($&Screen) set_calendar_valuepub fn (s $&Screen) set_calendar_value(id int,value time.Time) intOperation on $&Screen: set calendar value. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvalue time.Timeint — a value of this type
($&Screen) set_runningpub fn (s $&Screen) set_running(id int,running bool) intOperation on $&Screen: set running. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intrunning boolint — a value of this type
($&Screen) set_page_countpub fn (s $&Screen) set_page_count(id int,pages int) intOperation on $&Screen: set page count. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intpages intint — a value of this type
($&Screen) set_date_rangepub fn (s $&Screen) set_date_range(id int,minimum time.Time,maximum time.Time) intOperation on $&Screen: set date range. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intminimum time.Timemaximum time.Timeint — a value of this type
($&Screen) set_copy_enabledpub fn (s $&Screen) set_copy_enabled(id int,on bool) intOperation on $&Screen: set copy enabled. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inton boolint — a value of this type
(&Screen) is_copy_enabledpub fn (s &Screen) is_copy_enabled(id int) boolOperation on &Screen: whether it is copy enabled.
s &ScreenScreen instance used by this call (borrow).id intbool — true or false
(&Screen) selected_textpub fn (s &Screen) selected_text(id int) stringOperation on &Screen: selected text.
s &ScreenScreen instance used by this call (borrow).id intstring — result string
($&Screen) set_control_stylepub fn (s $&Screen) set_control_style(id int,style &ControlStyle) intFull ControlStyle overrides remain intact across the Screen adapter. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intstyle &ControlStyleint — a value of this type
($&Screen) set_button_variantpub fn (s $&Screen) set_button_variant(id int,variant int) intOperation on $&Screen: set button variant. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvariant intint — a value of this type
($&Screen) set_option_textpub fn (s $&Screen) set_option_text(id int,index int,value string) intOperation on $&Screen: set option text. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intindex intvalue stringint — a value of this type
($&Screen) set_slider_commit_onlypub fn (s $&Screen) set_slider_commit_only(id int,enabled bool) intOperation on $&Screen: set slider commit only. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intenabled boolint — a value of this type
($&Screen) set_motionpub fn (s $&Screen) set_motion(id int,spec &MotionSpec) intOperation on $&Screen: set motion. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intspec &MotionSpecint — a value of this type
($&Screen) set_field_text_optionspub fn (s $&Screen) set_field_text_options(id int,options &FieldTextOptions) intOperation on $&Screen: set field text options. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intoptions &FieldTextOptionsint — a value of this type
($&Screen) set_slider_appearancepub fn (s $&Screen) set_slider_appearance(id int,appearance &SliderAppearance,step f64) intOperation on $&Screen: set slider appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intappearance &SliderAppearancestep f64int — a value of this type
($&Screen) set_list_appearancepub fn (s $&Screen) set_list_appearance(id int,appearance &ListAppearance) intOperation on $&Screen: set list appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intappearance &ListAppearanceint — a value of this type
struct ActionDispatcher#C, S, Apub struct ActionDispatcher#C, S, A {
}The table owns functions only. Context and target are borrowed for one call register named functions rather than closures retaining a target borrow. A callback returns "" on success or an error message. Catch throwing calls inside the callback: Xu function values do not carry an inferred throw ABI. C/S/A keep the function table fully typed; the factory infers them. Its ctx and target arguments select types only and are never retained. Screen and retained View loops use the same table; raw controls can supply local state.
This type has no public fields.
action_dispatcherpub fn action_dispatcher#C, S(ctx &C, target &S) ActionDispatcher#C, S, ActionAction dispatcher.
ctx &Ctarget &SActionDispatcher#C, S, Action — a value of this type
($&ActionDispatcher#C, S, A) onpub fn (d $&ActionDispatcher#C, S, A) on(id int, kind int, handler fn ($&C, $&S, &A) string) intRe-registering a key replaces its handler. Exact kind wins over on_any. Throws on failure; handle the error or propagate it to the caller.
d $&ActionDispatcher#C, S, AActionDispatcher#C, S, A instance used by this call (exclusive borrow).id intkind inthandler fn ($&C, $&S, &A) stringint — a value of this type
($&ActionDispatcher#C, S, A) on_anypub fn (d $&ActionDispatcher#C, S, A) on_any(id int, handler fn ($&C, $&S, &A) string) inton_any receives semantic actions only, never ACTION_NONE repaint signals. Throws on failure; handle the error or propagate it to the caller.
d $&ActionDispatcher#C, S, AActionDispatcher#C, S, A instance used by this call (exclusive borrow).id inthandler fn ($&C, $&S, &A) stringint — a value of this type
($&ActionDispatcher#C, S, A) set_fallbackpub fn (d $&ActionDispatcher#C, S, A) set_fallback(handler fn ($&C, $&S, &A) string)Optional compatibility callback; replacement follows the same rule as on.
d $&ActionDispatcher#C, S, AActionDispatcher#C, S, A instance used by this call (exclusive borrow).handler fn ($&C, $&S, &A) stringThis call does not return a value.
($&ActionDispatcher#C, S, A) clear_fallbackpub fn (d $&ActionDispatcher#C, S, A) clear_fallback()Operation on $&ActionDispatcher#C, S, A: clear fallback.
d $&ActionDispatcher#C, S, AActionDispatcher#C, S, A instance used by this call (exclusive borrow).This call does not return a value.
(&ActionDispatcher#C, S, A) dispatchpub fn (d &ActionDispatcher#C, S, A) dispatch(action &A, ctx $&C, s $&S) boolA miss/invalid action is false. Handler errors propagate and never fall back. Neither Screen nor context is stored in the table. Throws on failure; handle the error or propagate it to the caller.
d &ActionDispatcher#C, S, AActionDispatcher#C, S, A instance used by this call (borrow).action &Actx $&Cs $&Sbool — true or false
(&ActionDispatcher#C, S, A) dispatch_or_fallbackpub fn (d &ActionDispatcher#C, S, A) dispatch_or_fallback(action &A, ctx $&C, s $&S) boolShared by standard and custom loops: dispatch, then the optional fallback. Throws on failure; handle the error or propagate it to the caller.
d &ActionDispatcher#C, S, AActionDispatcher#C, S, A instance used by this call (borrow).action &Actx $&Cs $&Sbool — true or false
run_screen_actionspub fn run_screen_actions#C(s $&Screen, events chan ui.Event, ctx $&C, layout_fn fn ($&C, $&Screen) string, dispatcher &ActionDispatcher#C, Screen, Action) intFunction-only entry point: context owns business state, layout is explicit, and a fallback is optional. Both paths dispose Screen on close or failure. Throws on failure; handle the error or propagate it to the caller.
s $&Screenevents chan ui.Eventctx $&Clayout_fn fn ($&C, $&Screen) stringdispatcher &ActionDispatcher#Cscreen Screenaction Actionint — a value of this type
($&Screen) clear_control_stylepub fn (s $&Screen) clear_control_style(id int) intReturn an instance to inherited theme styling, including later theme changes. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
(&Screen) localepub fn (s &Screen) locale() LocaleNo process-global language: each Screen and explicit control override own a copy.
s &ScreenScreen instance used by this call (borrow).Locale — a value of this type
($&Screen) control_localepub fn (s $&Screen) control_locale(id int) LocaleOperation on $&Screen: control locale. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intLocale — a value of this type
($&Screen) set_localepub fn (s $&Screen) set_locale(locale &Locale) intOperation on $&Screen: set locale. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&Screen) set_control_localepub fn (s $&Screen) set_control_locale(id int,locale &Locale) intOperation on $&Screen: set control locale. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intlocale &Localeint — a value of this type
($&Screen) clear_control_localepub fn (s $&Screen) clear_control_locale(id int) intOperation on $&Screen: clear control locale. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) menupub fn (s $&Screen) menu(label string,items &[]MenuItem,mode int,primary_key int) intCreate Menu / ContextMenu / SplitButton in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).label stringitems &[]MenuItemmode intprimary_key intint — component node ID for place and other Screen methods.
($&Screen) menu_checkedpub fn (s $&Screen) menu_checked(id int,key int) boolOperation on $&Screen: menu checked. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intkey intbool — true or false
($&Screen) set_menu_itemspub fn (s $&Screen) set_menu_items(id int,items &[]MenuItem) intOperation on $&Screen: set menu items. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intitems &[]MenuItemint — a value of this type
($&Screen) set_menu_labelpub fn (s $&Screen) set_menu_label(id int,label string) intOperation on $&Screen: set menu label. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intlabel stringint — a value of this type
($&Screen) set_menu_item_labelpub fn (s $&Screen) set_menu_item_label(id int,key int,label string) intOperation on $&Screen: set menu item label. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intkey intlabel stringint — a value of this type
($&Screen) set_menu_checkedpub fn (s $&Screen) set_menu_checked(id int,key int,checked bool) intOperation on $&Screen: set menu checked. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intkey intchecked boolint — a value of this type
($&Screen) set_menu_item_enabledpub fn (s $&Screen) set_menu_item_enabled(id int,key int,enabled bool) intOperation on $&Screen: set menu item enabled. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intkey intenabled boolint — a value of this type
($&Screen) set_menu_appearancepub fn (s $&Screen) set_menu_appearance(id int,appearance &MenuAppearance) intOperation on $&Screen: set menu appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intappearance &MenuAppearanceint — a value of this type
($&Screen) set_menu_openpub fn (s $&Screen) set_menu_open(id int,open bool) intOperation on $&Screen: set menu open. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intopen boolint — a value of this type
($&Screen) popoverpub fn (s $&Screen) popover(anchor int,text string) intCreate Popover in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).anchor inttext stringint — component node ID for place and other Screen methods.
($&Screen) tooltippub fn (s $&Screen) tooltip(anchor int,text string) intCreate Tooltip in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).anchor inttext stringint — component node ID for place and other Screen methods.
($&Screen) toastpub fn (s $&Screen) toast(text string) intExecute toast on $&Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringint — a value of this type
($&Screen) notifypub fn (s $&Screen) notify(text string) intExecute notify on $&Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringint — a value of this type
($&Screen) modalpub fn (s $&Screen) modal(title string,message string) intCreate Modal in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).title stringmessage stringint — component node ID for place and other Screen methods.
($&Screen) openpub fn (s $&Screen) open(id int) intOperation on $&Screen: open resource or establish connection. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) close_overlaypub fn (s $&Screen) close_overlay(id int) intOperation on $&Screen: close overlay. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) show_toastpub fn (s $&Screen) show_toast(id int,text string,duration time.Duration) intOperation on $&Screen: show toast. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttext stringduration time.Durationint — a value of this type
($&Screen) password_inputpub fn (s $&Screen) password_input(value string) intCreate PasswordInput in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value stringint — component node ID for place and other Screen methods.
($&Screen) set_passwordpub fn (s $&Screen) set_password(id int,password bool) intOperation on $&Screen: set password. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intpassword boolint — a value of this type
($&Screen) set_password_visiblepub fn (s $&Screen) set_password_visible(id int,visible bool) intOperation on $&Screen: set password visible. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvisible boolint — a value of this type
(&Screen) is_passwordpub fn (s &Screen) is_password(id int) boolOperation on &Screen: whether it is password. Throws on failure; handle the error or propagate it to the caller.
s &ScreenScreen instance used by this call (borrow).id intbool — true or false
(&Screen) is_password_visiblepub fn (s &Screen) is_password_visible(id int) boolOperation on &Screen: whether it is password visible. Throws on failure; handle the error or propagate it to the caller.
s &ScreenScreen instance used by this call (borrow).id intbool — true or false
($&Screen) set_range_valuespub fn (s $&Screen) set_range_values(id int,lower f64,upper f64) intOperation on $&Screen: set range values. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intlower f64upper f64int — a value of this type
($&Screen) set_range_optionspub fn (s $&Screen) set_range_options(id int,options &RangeSliderOptions) intOperation on $&Screen: set range options. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intoptions &RangeSliderOptionsint — a value of this type
($&Screen) set_range_appearancepub fn (s $&Screen) set_range_appearance(id int,appearance &SliderAppearance) intOperation on $&Screen: set range appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intappearance &SliderAppearanceint — a value of this type
($&Screen) range_valuespub fn (s $&Screen) range_values(id int) RangeValuesOperation on $&Screen: range values. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intRangeValues — a value of this type
($&Screen) set_read_onlypub fn (s $&Screen) set_read_only(id int,value bool) intOperation on $&Screen: set read only. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intvalue boolint — a value of this type
($&Screen) fieldpub fn (s $&Screen) field(value string,decoration &FieldDecoration) intCreate Field in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).value stringdecoration &FieldDecorationint — component node ID for place and other Screen methods.
($&Screen) task_buttonpub fn (s $&Screen) task_button(label string) intCreate TaskButton in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).label stringint — component node ID for place and other Screen methods.
($&Screen) set_field_decorationpub fn (s $&Screen) set_field_decoration(id int,decoration &FieldDecoration) intOperation on $&Screen: set field decoration. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intdecoration &FieldDecorationint — a value of this type
($&Screen) begin_taskpub fn (s $&Screen) begin_task(id int,task_id int) intOperation on $&Screen: begin task. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttask_id intint — a value of this type
($&Screen) set_task_progresspub fn (s $&Screen) set_task_progress(id int,task_id int,value f64) boolOperation on $&Screen: set task progress. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttask_id intvalue f64bool — true or false
($&Screen) complete_taskpub fn (s $&Screen) complete_task(id int,task_id int,state int) boolOperation on $&Screen: complete task. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inttask_id intstate intbool — true or false
($&Screen) set_task_progress_modepub fn (s $&Screen) set_task_progress_mode(id int,mode int) intOperation on $&Screen: set task progress mode. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intmode intint — a value of this type
(&Scroll) axispub fn (scroll &Scroll) axis() intExecute axis on &Scroll.
scroll &ScrollScroll instance used by this call (borrow).int — a value of this type
(&Scroll) content_boundspub fn (scroll &Scroll) content_bounds() layout.RectChildren occupy content coordinates; the rail stays outside their clip.
scroll &ScrollScroll instance used by this call (borrow).layout.Rect — a value of this type
($&Screen) scroll_areapub fn (s $&Screen) scroll_area(axis int,content_extent f64) intCreate Scroll in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).axis intcontent_extent f64int — component node ID for place and other Screen methods.
($&Screen) set_scroll_offsetpub fn (s $&Screen) set_scroll_offset(id int,offset f64) intOperation on $&Screen: set scroll offset. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intoffset f64int — a value of this type
($&Screen) set_scroll_extentpub fn (s $&Screen) set_scroll_extent(id int,extent f64) intOperation on $&Screen: set scroll extent. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intextent f64int — a value of this type
(&Screen) scroll_offsetpub fn (s &Screen) scroll_offset(id int) f64Operation on &Screen: scroll offset. Throws on failure; handle the error or propagate it to the caller.
s &ScreenScreen instance used by this call (borrow).id intf64 — a value of this type
($&Screen) selectable_textpub fn (s $&Screen) selectable_text(text string,size f64,muted bool) intOperation on $&Screen: selectable text. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringsize f64muted boolint — a value of this type
($&Screen) selectable_labelpub fn (s $&Screen) selectable_label(text string,size f64,muted bool) intOperation on $&Screen: selectable label. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).text stringsize f64muted boolint — a value of this type
(&Screen) is_selectable_labelpub fn (s &Screen) is_selectable_label(id int) boolOperation on &Screen: whether it is selectable label.
s &ScreenScreen instance used by this call (borrow).id intbool — true or false
(&Screen) is_selectablepub fn (s &Screen) is_selectable(id int) boolOperation on &Screen: whether it is selectable.
s &ScreenScreen instance used by this call (borrow).id intbool — true or false
($&Screen) set_label_selectablepub fn (s $&Screen) set_label_selectable(id int,selectable bool) intOperation on $&Screen: set label selectable. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intselectable boolint — a value of this type
($&Screen) set_selectablepub fn (s $&Screen) set_selectable(id int,selectable bool) intOperation on $&Screen: set selectable. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intselectable boolint — a value of this type
($&Screen) split_panepub fn (s $&Screen) split_pane(id int,pane int) intOperation on $&Screen: split pane. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intpane intint — a value of this type
($&Screen) split_layoutpub fn (s $&Screen) split_layout(id int) SplitLayoutReturns current local pane geometry from the placed size, before painting. Parent business content under split_pane and size it using this query. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intSplitLayout — a value of this type
($&Screen) set_split_ratiopub fn (s $&Screen) set_split_ratio(id int,ratio f64) intOperation on $&Screen: set split ratio. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intratio f64int — a value of this type
($&Screen) set_split_optionspub fn (s $&Screen) set_split_options(id int,options &SplitViewOptions) intOperation on $&Screen: set split options. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intoptions &SplitViewOptionsint — a value of this type
($&Screen) set_split_collapsedpub fn (s $&Screen) set_split_collapsed(id int,pane int,collapsed bool) intOperation on $&Screen: set split collapsed. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intpane intcollapsed boolint — a value of this type
struct Appearancepub struct Appearance {
pub styles Styles
pub reduced_motion bool
}Appearance contains no event callbacks or business context. Applying it only updates style/motion state and invalidation; it does not dispatch actions.
styles Stylesreduced_motion boolscreen_appearancepub fn screen_appearance(styles &Styles, reduced_motion bool) AppearanceScreen appearance. Throws on failure; handle the error or propagate it to the caller.
styles &Stylesreduced_motion boolAppearance — a value of this type
($&Screen) apply_appearancepub fn (s $&Screen) apply_appearance(appearance &Appearance) intOperation on $&Screen: apply appearance. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).appearance &Appearanceint — a value of this type
($&Screen) sort_tablepub fn (s $&Screen) sort_table(id int,column int,descending bool) intOperation on $&Screen: sort table. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intcolumn intdescending boolint — a value of this type
($&Screen) set_table_sort_kindpub fn (s $&Screen) set_table_sort_kind(id int,column int,kind int) intOperation on $&Screen: set table sort kind. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intcolumn intkind intint — a value of this type
($&Screen) set_table_local_sortpub fn (s $&Screen) set_table_local_sort(id int,enabled bool) intOperation on $&Screen: set table local sort. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intenabled boolint — a value of this type
($&Screen) set_table_selected_rowpub fn (s $&Screen) set_table_selected_row(id int,row int) intOperation on $&Screen: set table selected row. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id introw intint — a value of this type
($&Screen) set_table_rowspub fn (s $&Screen) set_table_rows(id int,count int) intOperation on $&Screen: set table rows. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intcount intint — a value of this type
($&Screen) table_row_atpub fn (s $&Screen) table_row_at(id int,row int) intOperation on $&Screen: table row at. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id introw intint — a value of this type
($&Screen) table_view_rowpub fn (s $&Screen) table_view_row(id int,row int) intOperation on $&Screen: table view row. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id introw intint — a value of this type
($&Screen) table_selected_rowpub fn (s $&Screen) table_selected_row(id int) intOperation on $&Screen: table selected row. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
($&Screen) table_cellpub fn (s $&Screen) table_cell(id int,row int,column int) stringOperation on $&Screen: table cell. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id introw intcolumn intstring — result string
($&Screen) table_view_cellpub fn (s $&Screen) table_view_cell(id int,row int,column int) stringOperation on $&Screen: table view cell. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id introw intcolumn intstring — result string
($&Screen) set_invalidpub fn (s $&Screen) set_invalid(id int,invalid bool) intOperation on $&Screen: set invalid. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intinvalid boolint — a value of this type
($&Screen) chartpub fn (s $&Screen) chart() intCreate Chart in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).int — component node ID for place and other Screen methods.
($&Screen) button_grouppub fn (s $&Screen) button_group(items &[]ButtonGroupItem,mode int) intCreate ButtonGroup in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).items &[]ButtonGroupItemmode intint — component node ID for place and other Screen methods.
($&Screen) range_sliderpub fn (s $&Screen) range_slider(minimum f64,maximum f64,lower f64,upper f64) intCreate RangeSlider in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).minimum f64maximum f64lower f64upper f64int — component node ID for place and other Screen methods.
($&Screen) split_viewpub fn (s $&Screen) split_view(ratio f64) intCreate SplitView in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).ratio f64int — component node ID for place and other Screen methods.
const ACTION_WEB_LOADINGpub const ACTION_WEB_LOADING = 30Constant ACTION_WEB_LOADING, defining protocol or algorithm parameters.
const ACTION_WEB_LOADEDpub const ACTION_WEB_LOADED = 31Constant ACTION_WEB_LOADED, defining protocol or algorithm parameters.
const ACTION_WEB_FAILEDpub const ACTION_WEB_FAILED = 32Constant ACTION_WEB_FAILED, defining protocol or algorithm parameters.
const ACTION_WEB_PROGRESSpub const ACTION_WEB_PROGRESS = 33Constant ACTION_WEB_PROGRESS, defining protocol or algorithm parameters.
($&Screen) webviewpub fn (s $&Screen) webview() intCreate WebView in Screen and return the component node ID; throw on creation failure.
s $&ScreenScreen instance used by this call (exclusive borrow).int — component node ID for place and other Screen methods.
($&Screen) webview_nativepub fn (s $&Screen) webview_native(id int) ui.NativeViewBind this handle with webview.bind_native for the full WebView API. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intui.NativeView — a value of this type
($&Screen) load_web_htmlpub fn (s $&Screen) load_web_html(id int,html string) intOperation on $&Screen: load web html. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inthtml stringint — a value of this type
($&Screen) load_web_urlpub fn (s $&Screen) load_web_url(id int,url string) intOperation on $&Screen: load web url. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id inturl stringint — a value of this type
($&Screen) webview_commandpub fn (s $&Screen) webview_command(id int,command string) intOperation on $&Screen: webview command. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intcommand stringint — a value of this type
($&Screen) set_webview_radiuspub fn (s $&Screen) set_webview_radius(id int,radius f64) intOperation on $&Screen: set webview radius. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intradius f64int — a value of this type
($&Screen) close_webviewpub fn (s $&Screen) close_webview(id int) intExplicit removal revokes copied native/WebView/request handles immediately. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intint — a value of this type
const AXIS_VERTICALpub const AXIS_VERTICAL = 0Constant AXIS_VERTICAL, defining protocol or algorithm parameters.
const AXIS_HORIZONTALpub const AXIS_HORIZONTAL = 1Constant AXIS_HORIZONTAL, defining protocol or algorithm parameters.
struct Scrollpub struct Scroll {
}Scroll context or state structure.
This type has no public fields.
scrollpub fn scroll(identity &ui.CanvasEvent,id int,bounds &layout.Rect,axis int,content_extent f64) ScrollExecute scroll. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectaxis intcontent_extent f64Scroll — a value of this type
(&Scroll) offsetpub fn (scroll &Scroll) offset() f64Execute offset on &Scroll.
scroll &ScrollScroll instance used by this call (borrow).f64 — a value of this type
(&Scroll) needs_paintpub fn (scroll &Scroll) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
scroll &ScrollScroll instance used by this call (borrow).bool — true or false
($&Scroll) paintedpub fn (scroll $&Scroll) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
scroll $&ScrollScroll instance used by this call (exclusive borrow).This call does not return a value.
($&Scroll) set_focuspub fn (scroll $&Scroll) set_focus(focused bool)Operation on $&Scroll: set focus.
scroll $&ScrollScroll instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&Scroll) set_offsetpub fn (scroll $&Scroll) set_offset(offset f64) intOperation on $&Scroll: set offset. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).offset f64int — a value of this type
($&Scroll) set_content_extentpub fn (scroll $&Scroll) set_content_extent(extent f64) intOperation on $&Scroll: set content extent. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).extent f64int — a value of this type
($&Scroll) set_boundspub fn (scroll $&Scroll) set_bounds(bounds &layout.Rect) intOperation on $&Scroll: set bounds. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&Scroll) inputpub fn (scroll $&Scroll) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Scroll) eventpub fn (scroll $&Scroll) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Scroll) visible_itemspub fn (scroll &Scroll) visible_items(count int,item_extent f64,gap f64,overscan int) layout.VisibleRangeOperation on &Scroll: visible items. Throws on failure; handle the error or propagate it to the caller.
scroll &ScrollScroll instance used by this call (borrow).count intitem_extent f64gap f64overscan intlayout.VisibleRange — a value of this type
($&Scroll) layout_itemspub fn (scroll $&Scroll) layout_items(count int,item_extent f64,gap f64,overscan int) layout.VisibleRangeOperation on $&Scroll: layout items. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).count intitem_extent f64gap f64overscan intlayout.VisibleRange — a value of this type
(&Scroll) beginpub fn (scroll &Scroll) begin(frame $&draw.Frame) intExecute begin on &Scroll. Throws on failure; handle the error or propagate it to the caller.
scroll &ScrollScroll instance used by this call (borrow).frame $&draw.Frameint — a value of this type
(&Scroll) endpub fn (scroll &Scroll) end(frame $&draw.Frame) intExecute end on &Scroll. Throws on failure; handle the error or propagate it to the caller.
scroll &ScrollScroll instance used by this call (borrow).frame $&draw.Frameint — a value of this type
struct FocusGrouppub struct FocusGroup {
}FocusGroup context or state structure.
This type has no public fields.
focus_grouppub fn focus_group(identity &ui.CanvasEvent,ids []int) FocusGroupFocus group. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventids []intFocusGroup — a value of this type
(&FocusGroup) currentpub fn (focus &FocusGroup) current() intExecute current on &FocusGroup.
focus &FocusGroupFocusGroup instance used by this call (borrow).int — a value of this type
($&FocusGroup) clearpub fn (focus $&FocusGroup) clear()Clear all buffered or stored entries and internal state.
focus $&FocusGroupFocusGroup instance used by this call (exclusive borrow).This call does not return a value.
($&FocusGroup) focuspub fn (focus $&FocusGroup) focus(id int) intExecute focus on $&FocusGroup. Throws on failure; handle the error or propagate it to the caller.
focus $&FocusGroupFocusGroup instance used by this call (exclusive borrow).id intint — a value of this type
($&FocusGroup) inputpub fn (focus $&FocusGroup) input(input &ui.InputEvent) ActionThe owner registers only enabled, visible controls and applies the resulting identity to their set_focus methods. This preserves state across repaint/layout.
focus $&FocusGroupFocusGroup instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&FocusGroup) set_itemspub fn (focus $&FocusGroup) set_items(ids []int) intOperation on $&FocusGroup: set items. Throws on failure; handle the error or propagate it to the caller.
focus $&FocusGroupFocusGroup instance used by this call (exclusive borrow).ids []intint — a value of this type
($&FocusGroup) eventpub fn (focus $&FocusGroup) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
focus $&FocusGroupFocusGroup instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
(&Scroll) is_enabledpub fn (scroll &Scroll) is_enabled() boolReturn whether the control is currently enabled.
scroll &ScrollScroll instance used by this call (borrow).bool — true or false
($&Scroll) set_enabledpub fn (scroll $&Scroll) set_enabled(enabled bool)Operation on $&Scroll: set enabled.
scroll $&ScrollScroll instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&Scroll) idpub fn (scroll &Scroll) id() intReturn the unique integer ID of the element or control.
scroll &ScrollScroll instance used by this call (borrow).int — a value of this type
(&Scroll) boundspub fn (scroll &Scroll) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
scroll &ScrollScroll instance used by this call (borrow).layout.Rect — a value of this type
(&Scroll) is_focusedpub fn (scroll &Scroll) is_focused() boolReturn whether the control currently has input focus.
scroll &ScrollScroll instance used by this call (borrow).bool — true or false
(&Scroll) is_hoveredpub fn (scroll &Scroll) is_hovered() boolOperation on &Scroll: whether it is hovered.
scroll &ScrollScroll instance used by this call (borrow).bool — true or false
(&Scroll) is_draggingpub fn (scroll &Scroll) is_dragging() boolOperation on &Scroll: whether it is dragging.
scroll &ScrollScroll instance used by this call (borrow).bool — true or false
(&Scroll) is_invalidpub fn (scroll &Scroll) is_invalid() boolOperation on &Scroll: whether it is invalid.
scroll &ScrollScroll instance used by this call (borrow).bool — true or false
($&Scroll) set_invalidpub fn (scroll $&Scroll) set_invalid(invalid bool)Operation on $&Scroll: set invalid.
scroll $&ScrollScroll instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
(&Scroll) visual_statepub fn (scroll &Scroll) visual_state() intOperation on &Scroll: visual state.
scroll &ScrollScroll instance used by this call (borrow).int — a value of this type
(&Scroll) has_stylepub fn (scroll &Scroll) has_style() boolOperation on &Scroll: whether it has style.
scroll &ScrollScroll instance used by this call (borrow).bool — true or false
(&Scroll) style_orpub fn (scroll &Scroll) style_or(styles &Styles) ControlStyleOperation on &Scroll: style or.
scroll &ScrollScroll instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Scroll) set_stylepub fn (scroll $&Scroll) set_style(style &ControlStyle) intOperation on $&Scroll: set style. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Scroll) clear_stylepub fn (scroll $&Scroll) clear_style()Operation on $&Scroll: clear style.
scroll $&ScrollScroll instance used by this call (exclusive borrow).This call does not return a value.
($&Scroll) apply_stylespub fn (scroll $&Scroll) apply_styles(styles &Styles) intValidate and apply styles, updating layout / geometry and repainting when metrics change.
scroll $&ScrollScroll instance used by this call (exclusive borrow).styles &Styles0 on success; throws on failure
($&Scroll) measure_styledpub fn (scroll $&Scroll) measure_styled(styles &Styles) layout.SizeOperation on $&Scroll: measure styled. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
(&Scroll) scrollbar_trackpub fn (scroll &Scroll) scrollbar_track() layout.RectReturn the scrollbar track rectangle shared with hit testing.
scroll &ScrollScroll instance used by this call (borrow).track in control coordinates
(&Scroll) scrollbar_thumbpub fn (scroll &Scroll) scrollbar_thumb() layout.RectReturn the thumb rectangle from content extent, offset and minimum thumb size.
scroll &ScrollScroll instance used by this call (borrow).thumb in control coordinates
($&Scroll) paint_scrollbarpub fn (scroll $&Scroll) paint_scrollbar(frame $&draw.Frame,styles &Styles) intPaint the scrollbar and clear its dirty flag. Call after child content in overlay_styled.
scroll $&ScrollScroll instance used by this call (exclusive borrow).frame $&draw.Framestyles &Styles0 on success; throws on failure
struct SelectOptionpub struct SelectOption {
pub label string
pub enabled bool
pub group bool
}Structure encapsulating label, enabled, group.
label stringenabled boolgroup boolselect_optionpub fn select_option(label string) SelectOptionSelect option.
label stringSelectOption — a value of this type
select_grouppub fn select_group(label string) SelectOptionSelect group.
label stringSelectOption — a value of this type
($&Select) set_option_grouppub fn (sel $&Select) set_option_group(index int,group bool) intOperation on $&Select: set option group. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).index intgroup boolint — a value of this type
(&Select) is_grouppub fn (sel &Select) is_group(index int) boolOperation on &Select: whether it is group.
sel &SelectSelect instance used by this call (borrow).index intbool — true or false
($&Screen) select_optionspub fn (s $&Screen) select_options(options &[]SelectOption,selected int) intOperation on $&Screen: select options. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).options &[]SelectOptionselected intint — a value of this type
struct SelectableTextpub struct SelectableText {
}SelectableText context or state structure.
This type has no public fields.
selectable_textpub fn selectable_text(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,text &string) SelectableTextSelectable text. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Recttext &stringSelectableText — a value of this type
(&SelectableText) idpub fn (s &SelectableText) id() intReturn the unique integer ID of the element or control.
s &SelectableTextSelectableText instance used by this call (borrow).int — a value of this type
(&SelectableText) identitypub fn (s &SelectableText) identity() ui.CanvasEventExecute identity on &SelectableText.
s &SelectableTextSelectableText instance used by this call (borrow).ui.CanvasEvent — a value of this type
(&SelectableText) boundspub fn (s &SelectableText) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
s &SelectableTextSelectableText instance used by this call (borrow).layout.Rect — a value of this type
(&SelectableText) textpub fn (s &SelectableText) text() stringOperation on &SelectableText: return the current text.
s &SelectableTextSelectableText instance used by this call (borrow).string — result string
(&SelectableText) is_closedpub fn (s &SelectableText) is_closed() boolOperation on &SelectableText: whether it is closed.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) is_focusedpub fn (s &SelectableText) is_focused() boolReturn whether the control currently has input focus.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) is_selectingpub fn (s &SelectableText) is_selecting() boolOperation on &SelectableText: whether it is selecting.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) is_hoveredpub fn (s &SelectableText) is_hovered() boolOperation on &SelectableText: whether it is hovered.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) is_enabledpub fn (s &SelectableText) is_enabled() boolReturn whether the control is currently enabled.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) is_selectablepub fn (s &SelectableText) is_selectable() boolOperation on &SelectableText: whether it is selectable.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) needs_paintpub fn (s &SelectableText) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) has_popup_openpub fn (s &SelectableText) has_popup_open() boolOperation on &SelectableText: whether it has popup open.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) popup_boundspub fn (s &SelectableText) popup_bounds() layout.RectOperation on &SelectableText: popup bounds.
s &SelectableTextSelectableText instance used by this call (borrow).layout.Rect — a value of this type
(&SelectableText) cursorpub fn (s &SelectableText) cursor() intExecute cursor on &SelectableText.
s &SelectableTextSelectableText instance used by this call (borrow).int — a value of this type
(&SelectableText) has_selectionpub fn (s &SelectableText) has_selection() boolOperation on &SelectableText: whether it has selection.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) selection_rangepub fn (s &SelectableText) selection_range() ui.TextRangeOperation on &SelectableText: selection range.
s &SelectableTextSelectableText instance used by this call (borrow).ui.TextRange — a value of this type
(&SelectableText) selected_textpub fn (s &SelectableText) selected_text() stringOperation on &SelectableText: selected text.
s &SelectableTextSelectableText instance used by this call (borrow).string — result string
($&SelectableText) paintedpub fn (s $&SelectableText) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).This call does not return a value.
($&SelectableText) closepub fn (s $&SelectableText) close()Operation on $&SelectableText: close the resource.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).This call does not return a value.
($&SelectableText) disposepub fn (s $&SelectableText) dispose()Release and dispose native resources and underlying handles.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).This call does not return a value.
(&SelectableText) clone_widgetpub fn (s &SelectableText) clone_widget() SelectableTextOperation on &SelectableText: clone widget. Throws on failure; handle the error or propagate it to the caller.
s &SelectableTextSelectableText instance used by this call (borrow).SelectableText — a value of this type
($&SelectableText) set_boundspub fn (s $&SelectableText) set_bounds(bounds &layout.Rect) intOperation on $&SelectableText: set bounds. Throws on failure; handle the error or propagate it to the caller.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&SelectableText) set_textpub fn (s $&SelectableText) set_text(text &string) intOperation on $&SelectableText: set text. Throws on failure; handle the error or propagate it to the caller.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).text &stringint — a value of this type
($&SelectableText) set_wrappedpub fn (s $&SelectableText) set_wrapped(wrapped bool)Operation on $&SelectableText: set wrapped.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).wrapped boolThis call does not return a value.
($&SelectableText) set_ellipsispub fn (s $&SelectableText) set_ellipsis(ellipsis bool)Operation on $&SelectableText: set ellipsis.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).ellipsis boolThis call does not return a value.
($&SelectableText) set_mutedpub fn (s $&SelectableText) set_muted(muted bool)Operation on $&SelectableText: set muted.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).muted boolThis call does not return a value.
($&SelectableText) set_enabledpub fn (s $&SelectableText) set_enabled(enabled bool)Operation on $&SelectableText: set enabled.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&SelectableText) set_selectablepub fn (s $&SelectableText) set_selectable(selectable bool)Operation on $&SelectableText: set selectable.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&SelectableText) is_copy_enabledpub fn (s &SelectableText) is_copy_enabled() boolOperation on &SelectableText: whether it is copy enabled.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
($&SelectableText) set_copy_enabledpub fn (s $&SelectableText) set_copy_enabled(on bool)Operation on $&SelectableText: set copy enabled.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).on boolThis call does not return a value.
($&SelectableText) set_localepub fn (s $&SelectableText) set_locale(locale &Locale) intOperation on $&SelectableText: set locale. Throws on failure; handle the error or propagate it to the caller.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&SelectableText) set_viewportpub fn (s $&SelectableText) set_viewport(viewport &layout.Rect)Operation on $&SelectableText: set viewport.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&SelectableText) select_allpub fn (s $&SelectableText) select_all() boolOperation on $&SelectableText: select all.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).bool — true or false
($&SelectableText) clear_selectionpub fn (s $&SelectableText) clear_selection() boolOperation on $&SelectableText: clear selection.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).bool — true or false
($&SelectableText) set_selectionpub fn (s $&SelectableText) set_selection(start int,end int) boolOperation on $&SelectableText: set selection.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).start intend intbool — true or false
(&SelectableText) copy_selectionpub fn (s &SelectableText) copy_selection() intOperation on &SelectableText: copy selection.
s &SelectableTextSelectableText instance used by this call (borrow).int — a value of this type
(&SelectableText) has_stylepub fn (s &SelectableText) has_style() boolOperation on &SelectableText: whether it has style.
s &SelectableTextSelectableText instance used by this call (borrow).bool — true or false
(&SelectableText) style_orpub fn (s &SelectableText) style_or(styles &Styles) ControlStyleOperation on &SelectableText: style or.
s &SelectableTextSelectableText instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&SelectableText) set_stylepub fn (s $&SelectableText) set_style(style &ControlStyle) intOperation on $&SelectableText: set style. Throws on failure; handle the error or propagate it to the caller.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&SelectableText) clear_stylepub fn (s $&SelectableText) clear_style()Operation on $&SelectableText: clear style.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).This call does not return a value.
($&SelectableText) measure_styledpub fn (s $&SelectableText) measure_styled(styles &Styles) layout.SizeOperation on $&SelectableText: measure styled. Throws on failure; handle the error or propagate it to the caller.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&SelectableText) routepub fn (s $&SelectableText) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&SelectableText) inputpub fn (s $&SelectableText) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&SelectableText) eventpub fn (s $&SelectableText) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
($&SelectableText) paint_styledpub fn (s $&SelectableText) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&SelectableText: paint styled. Throws on failure; handle the error or propagate it to the caller.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&SelectableText) paint_popup_styledpub fn (s $&SelectableText) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&SelectableText: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
s $&SelectableTextSelectableText instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Checkbox) set_motionpub fn (control $&Checkbox) set_motion(spec &MotionSpec) intOperation on $&Checkbox: set motion. Throws on failure; handle the error or propagate it to the caller.
control $&CheckboxCheckbox instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&Radio) set_motionpub fn (control $&Radio) set_motion(spec &MotionSpec) intOperation on $&Radio: set motion. Throws on failure; handle the error or propagate it to the caller.
control $&RadioRadio instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&Checkbox) tickpub fn (control $&Checkbox) tick(now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
control $&CheckboxCheckbox instance used by this call (exclusive borrow).now time.Instantreduced boolbool — true or false
(&Checkbox) next_tickpub fn (control &Checkbox) next_tick(now time.Instant) time.InstantOperation on &Checkbox: next tick. Throws on failure; handle the error or propagate it to the caller.
control &CheckboxCheckbox instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&Radio) tickpub fn (control $&Radio) tick(now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
control $&RadioRadio instance used by this call (exclusive borrow).now time.Instantreduced boolbool — true or false
(&Radio) next_tickpub fn (control &Radio) next_tick(now time.Instant) time.InstantOperation on &Radio: next tick. Throws on failure; handle the error or propagate it to the caller.
control &RadioRadio instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
struct SliderAppearancepub struct SliderAppearance {
pub ticks int
pub show_value bool
pub decimals int
}Structure encapsulating ticks, show_value, decimals.
ticks intshow_value booldecimals intslider_appearancepub fn slider_appearance() SliderAppearanceSlider appearance.
No arguments are required.
SliderAppearance — a value of this type
(&SliderAppearance) validatepub fn (appearance &SliderAppearance) validate() intExecute validate on &SliderAppearance. Throws on failure; handle the error or propagate it to the caller.
appearance &SliderAppearanceSliderAppearance instance used by this call (borrow).int — a value of this type
($&Slider) set_appearancepub fn (s $&Slider) set_appearance(appearance &SliderAppearance) intOperation on $&Slider: set appearance. Throws on failure; handle the error or propagate it to the caller.
s $&SliderSlider instance used by this call (exclusive borrow).appearance &SliderAppearanceint — a value of this type
(&Slider) shows_valuepub fn (s &Slider) shows_value() boolOperation on &Slider: shows value.
s &SliderSlider instance used by this call (borrow).bool — true or false
(&Slider) value_textpub fn (s &Slider) value_text() stringOperation on &Slider: value text. Throws on failure; handle the error or propagate it to the caller.
s &SliderSlider instance used by this call (borrow).string — result string
(&Slider) paint_value_styledpub fn (s &Slider) paint_value_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Slider: paint value styled. Throws on failure; handle the error or propagate it to the caller.
s &SliderSlider instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
struct Spinnerpub struct Spinner {
}Spinner context or state structure.
This type has no public fields.
spinnerpub fn spinner(bounds &layout.Rect) SpinnerExecute spinner. Throws on failure; handle the error or propagate it to the caller.
bounds &layout.RectSpinner — a value of this type
(&Spinner) is_runningpub fn (spinner &Spinner) is_running() boolOperation on &Spinner: whether it is running.
spinner &SpinnerSpinner instance used by this call (borrow).bool — true or false
(&Spinner) needs_paintpub fn (spinner &Spinner) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
spinner &SpinnerSpinner instance used by this call (borrow).bool — true or false
(&Spinner) boundspub fn (spinner &Spinner) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
spinner &SpinnerSpinner instance used by this call (borrow).layout.Rect — a value of this type
($&Spinner) set_boundspub fn (spinner $&Spinner) set_bounds(bounds &layout.Rect) intOperation on $&Spinner: set bounds. Throws on failure; handle the error or propagate it to the caller.
spinner $&SpinnerSpinner instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&Spinner) set_runningpub fn (spinner $&Spinner) set_running(running bool)Operation on $&Spinner: set running.
spinner $&SpinnerSpinner instance used by this call (exclusive borrow).running boolThis call does not return a value.
($&Spinner) set_enabledpub fn (spinner $&Spinner) set_enabled(enabled bool)Operation on $&Spinner: set enabled.
spinner $&SpinnerSpinner instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&Spinner) set_stylepub fn (spinner $&Spinner) set_style(style &ControlStyle) intOperation on $&Spinner: set style. Throws on failure; handle the error or propagate it to the caller.
spinner $&SpinnerSpinner instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
(&Spinner) style_orpub fn (spinner &Spinner) style_or(styles &Styles) ControlStyleOperation on &Spinner: style or.
spinner &SpinnerSpinner instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Spinner) tickpub fn (spinner $&Spinner) tick(now time.Instant,reduced_motion bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
spinner $&SpinnerSpinner instance used by this call (exclusive borrow).now time.Instantreduced_motion boolbool — true or false
(&Spinner) next_tickpub fn (spinner &Spinner) next_tick(now time.Instant,reduced_motion bool) time.InstantOperation on &Spinner: next tick. Throws on failure; handle the error or propagate it to the caller.
spinner &SpinnerSpinner instance used by this call (borrow).now time.Instantreduced_motion booltime.Instant — a value of this type
(&Spinner) measure_styledpub fn (spinner &Spinner) measure_styled(styles &Styles) layout.SizeOperation on &Spinner: measure styled. Throws on failure; handle the error or propagate it to the caller.
spinner &SpinnerSpinner instance used by this call (borrow).styles &Styleslayout.Size — a value of this type
($&Spinner) paint_styledpub fn (spinner $&Spinner) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Spinner: paint styled. Throws on failure; handle the error or propagate it to the caller.
spinner $&SpinnerSpinner instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Spinner) set_appearancepub fn (spinner $&Spinner) set_appearance(diameter f64,thickness f64,period time.Duration) intOperation on $&Spinner: set appearance. Throws on failure; handle the error or propagate it to the caller.
spinner $&SpinnerSpinner instance used by this call (exclusive borrow).diameter f64thickness f64period time.Durationint — a value of this type
struct SplitViewOptionspub struct SplitViewOptions {
pub vertical bool
pub minimum_first f64
pub minimum_second f64
pub handle_size f64
pub keyboard_step f64
}Widgets Configuration parameters and options set.
vertical boolminimum_first f64minimum_second f64handle_size f64keyboard_step f64split_view_optionspub fn split_view_options() SplitViewOptionsSplit view options.
No arguments are required.
SplitViewOptions — a value of this type
struct SplitLayoutpub struct SplitLayout {
pub first layout.Rect
pub second layout.Rect
pub handle layout.Rect
pub ratio f64
pub collapsed int
}Structure encapsulating first, second, handle, ratio, collapsed.
first layout.Rectsecond layout.Recthandle layout.Rectratio f64collapsed intstruct SplitViewpub struct SplitView {
}SplitView context or state structure.
This type has no public fields.
split_viewpub fn split_view(identity &ui.CanvasEvent,id int,bounds &layout.Rect,ratio f64) SplitViewSplit view. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.Rectratio f64SplitView — a value of this type
(&SplitView) idpub fn (v &SplitView) id() intReturn the unique integer ID of the element or control.
v &SplitViewSplitView instance used by this call (borrow).int — a value of this type
(&SplitView) boundspub fn (v &SplitView) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
v &SplitViewSplitView instance used by this call (borrow).layout.Rect — a value of this type
(&SplitView) valuepub fn (v &SplitView) value() f64Execute value on &SplitView.
v &SplitViewSplitView instance used by this call (borrow).f64 — a value of this type
(&SplitView) needs_paintpub fn (v &SplitView) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
v &SplitViewSplitView instance used by this call (borrow).bool — true or false
($&SplitView) paintedpub fn (v $&SplitView) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
v $&SplitViewSplitView instance used by this call (exclusive borrow).This call does not return a value.
(&SplitView) is_enabledpub fn (v &SplitView) is_enabled() boolReturn whether the control is currently enabled.
v &SplitViewSplitView instance used by this call (borrow).bool — true or false
(&SplitView) geometrypub fn (v &SplitView) geometry(bounds &layout.Rect,density f64) SplitLayoutExecute geometry on &SplitView.
v &SplitViewSplitView instance used by this call (borrow).bounds &layout.Rectdensity f64SplitLayout — a value of this type
(&SplitView) layoutpub fn (v &SplitView) layout() SplitLayoutExecute layout on &SplitView.
v &SplitViewSplitView instance used by this call (borrow).SplitLayout — a value of this type
($&SplitView) set_ratiopub fn (v $&SplitView) set_ratio(value f64) intOperation on $&SplitView: set ratio. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).value f64int — a value of this type
($&SplitView) set_collapsedpub fn (v $&SplitView) set_collapsed(pane int,collapsed bool) intCollapse retains the requested ratio; expanding restores it under current minima. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).pane intcollapsed boolint — a value of this type
($&SplitView) set_optionspub fn (v $&SplitView) set_options(o &SplitViewOptions) intOperation on $&SplitView: set options. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).o &SplitViewOptionsint — a value of this type
($&SplitView) cancelpub fn (v $&SplitView) cancel()Execute cancel on $&SplitView.
v $&SplitViewSplitView instance used by this call (exclusive borrow).This call does not return a value.
($&SplitView) set_focuspub fn (v $&SplitView) set_focus(value bool)Operation on $&SplitView: set focus.
v $&SplitViewSplitView instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&SplitView) set_enabledpub fn (v $&SplitView) set_enabled(value bool)Operation on $&SplitView: set enabled.
v $&SplitViewSplitView instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&SplitView) set_read_onlypub fn (v $&SplitView) set_read_only(value bool)Operation on $&SplitView: set read only.
v $&SplitViewSplitView instance used by this call (exclusive borrow).value boolThis call does not return a value.
($&SplitView) set_boundspub fn (v $&SplitView) set_bounds(b &layout.Rect) intOperation on $&SplitView: set bounds. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).b &layout.Rectint — a value of this type
($&SplitView) set_stylepub fn (v $&SplitView) set_style(style &ControlStyle) intOperation on $&SplitView: set style. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&SplitView) clear_stylepub fn (v $&SplitView) clear_style()Operation on $&SplitView: clear style.
v $&SplitViewSplitView instance used by this call (exclusive borrow).This call does not return a value.
($&SplitView) set_motionpub fn (v $&SplitView) set_motion(spec &MotionSpec) intOperation on $&SplitView: set motion. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&SplitView) apply_stylespub fn (v $&SplitView) apply_styles(styles &Styles) intResolve and apply theme metrics to the control.
v $&SplitViewSplitView instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
($&SplitView) tickpub fn (v $&SplitView) tick(styles &Styles,now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).styles &Stylesnow time.Instantreduced boolbool — true or false
(&SplitView) next_tickpub fn (v &SplitView) next_tick(now time.Instant) time.InstantOperation on &SplitView: next tick. Throws on failure; handle the error or propagate it to the caller.
v &SplitViewSplitView instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&SplitView) disposepub fn (v $&SplitView) dispose()Release and dispose native resources and underlying handles.
v $&SplitViewSplitView instance used by this call (exclusive borrow).This call does not return a value.
($&SplitView) inputpub fn (v $&SplitView) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
v $&SplitViewSplitView instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&SplitView) routepub fn (v $&SplitView) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&SplitView) paint_styledpub fn (v $&SplitView) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&SplitView: paint styled. Throws on failure; handle the error or propagate it to the caller.
v $&SplitViewSplitView instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
const PAINT_BACKGROUNDpub const PAINT_BACKGROUND = 1Constant PAINT_BACKGROUND, defining protocol or algorithm parameters.
const PAINT_FOREGROUNDpub const PAINT_FOREGROUND = 2Constant PAINT_FOREGROUND, defining protocol or algorithm parameters.
const PAINT_BORDERpub const PAINT_BORDER = 4Constant PAINT_BORDER, defining protocol or algorithm parameters.
const PAINT_FOCUSpub const PAINT_FOCUS = 8Constant PAINT_FOCUS, defining protocol or algorithm parameters.
const PAINT_SELECTIONpub const PAINT_SELECTION = 16Constant PAINT_SELECTION, defining protocol or algorithm parameters.
const PAINT_SELECTION_TEXTpub const PAINT_SELECTION_TEXT = 32Constant PAINT_SELECTION_TEXT, defining protocol or algorithm parameters.
const PAINT_PLACEHOLDERpub const PAINT_PLACEHOLDER = 64Constant PAINT_PLACEHOLDER, defining protocol or algorithm parameters.
const PAINT_ICON_OPACITYpub const PAINT_ICON_OPACITY = 128Constant PAINT_ICON_OPACITY, defining protocol or algorithm parameters.
struct StatePaintpub struct StatePaint {
pub when int
pub unless int
pub fields int
pub background draw.Color
pub foreground draw.Color
pub border draw.Color
pub focus draw.Color
pub selection draw.Color
pub selection_text draw.Color
pub placeholder draw.Color
pub icon_opacity f64
}Selective combined-state override. Matches all when bits and no unless bits; rules apply in array order, with later overrides winning.
when intunless intfields intbackground draw.Colorforeground draw.Colorborder draw.Colorfocus draw.Colorselection draw.Colorselection_text draw.Colorplaceholder draw.Coloricon_opacity f64state_paintpub fn state_paint(when int) StatePaintCreate a rule with when and fields=0. Select paint_* bits to activate the corresponding overrides.
when inta rule ready for customization
struct ResolvedStylepub struct ResolvedStyle {
pub background draw.Color
pub foreground draw.Color
pub border draw.Color
pub focus draw.Color
pub selection draw.Color
pub selection_text draw.Color
pub placeholder draw.Color
pub icon_opacity f64
}Structure encapsulating background, foreground, border, focus, selection.
background draw.Colorforeground draw.Colorborder draw.Colorfocus draw.Colorselection draw.Colorselection_text draw.Colorplaceholder draw.Coloricon_opacity f64(&ControlStyle) resolvepub fn (c &ControlStyle) resolve(state int) ResolvedStyleResolve combined states using the base palette and ordered rules without mutating the control.
c &ControlStyleControlStyle instance used by this call (borrow).state intresolved colors and icon opacity
const STATE_DISABLEDpub const STATE_DISABLED = 1Constant STATE_DISABLED, defining protocol or algorithm parameters.
const STATE_HOVEREDpub const STATE_HOVERED = 2Constant STATE_HOVERED, defining protocol or algorithm parameters.
const STATE_PRESSEDpub const STATE_PRESSED = 4Constant STATE_PRESSED, defining protocol or algorithm parameters.
const STATE_FOCUSEDpub const STATE_FOCUSED = 8Constant STATE_FOCUSED, defining protocol or algorithm parameters.
const STATE_SELECTEDpub const STATE_SELECTED = 16Constant STATE_SELECTED, defining protocol or algorithm parameters.
const STATE_INVALIDpub const STATE_INVALID = 32Constant STATE_INVALID, defining protocol or algorithm parameters.
const STATE_READ_ONLYpub const STATE_READ_ONLY = 64Constant STATE_READ_ONLY, defining protocol or algorithm parameters.
const ICON_LEADINGpub const ICON_LEADING = 0Constant ICON_LEADING, defining protocol or algorithm parameters.
const ICON_TRAILINGpub const ICON_TRAILING = 1Constant ICON_TRAILING, defining protocol or algorithm parameters.
const ICON_ABOVEpub const ICON_ABOVE = 2Constant ICON_ABOVE, defining protocol or algorithm parameters.
const ICON_BELOWpub const ICON_BELOW = 3Constant ICON_BELOW, defining protocol or algorithm parameters.
struct FontStylepub struct FontStyle {
pub family string
pub size f64
pub weight int
pub italic bool
pub line_height f64
}Font configuration. Empty family selects the system font; size and line_height use logical pixels.
family stringsize f64weight intitalic boolline_height f64font_stylepub fn font_style(size f64) FontStyleFont style.
size f64FontStyle — a value of this type
struct Palettepub struct Palette {
pub normal draw.Color
pub hovered draw.Color
pub pressed draw.Color
pub disabled draw.Color
pub foreground draw.Color
pub muted draw.Color
pub accent draw.Color
pub on_accent draw.Color
pub focus draw.Color
pub border draw.Color
pub invalid draw.Color
pub invalid_fill draw.Color
pub read_only draw.Color
pub selection draw.Color
pub selection_text draw.Color
pub placeholder draw.Color
}Base state palette. Background precedence: disabled, invalid, read-only, selected, pressed, hovered, normal.
normal draw.Colorhovered draw.Colorpressed draw.Colordisabled draw.Colorforeground draw.Colormuted draw.Coloraccent draw.Coloron_accent draw.Colorfocus draw.Colorborder draw.Colorinvalid draw.Colorinvalid_fill draw.Colorread_only draw.Colorselection draw.Colorselection_text draw.Colorplaceholder draw.Colorstruct ControlStylepub struct ControlStyle {
pub palette Palette
pub font FontStyle
pub inherit_font bool
pub padding layout.Insets
pub radius f64
pub border_width f64
pub focus_width f64
pub focus_inset f64
pub min_width f64
pub min_height f64
pub gap f64
pub indicator_size f64
pub mark_width f64
pub caret_width f64
pub preedit_width f64
pub shadow_x f64
pub shadow_y f64
pub shadow_spread f64
pub shadow_blur f64
pub align_x f64
pub align_y f64
pub icon_size f64
pub icon_placement int
pub icon_opacity f64
pub disabled_icon_opacity f64
pub shadow draw.Color
pub states []StatePaint
}Control colors, typography and geometry. Metrics are finite and nonnegative; offsets may be negative. clone deep-copies the rule array.
palette Palettefont FontStyleinherit_font boolpadding layout.Insetsradius f64border_width f64focus_width f64focus_inset f64min_width f64min_height f64gap f64indicator_size f64mark_width f64caret_width f64preedit_width f64shadow_x f64shadow_y f64shadow_spread f64shadow_blur f64align_x f64align_y f64icon_size f64icon_placement inticon_opacity f64disabled_icon_opacity f64shadow draw.Colorstates []StatePaintstruct Stylespub struct Styles {
pub font FontStyle
pub text_scale f64
pub density f64
pub background draw.Color
pub button ControlStyle
pub checkbox ControlStyle
pub input ControlStyle
pub text_area ControlStyle
pub progress ControlStyle
pub scroll ControlStyle
}Complete control theme with independent text scaling and geometry density. Start with a factory, customize and validate.
font FontStyletext_scale f64density f64background draw.Colorbutton ControlStylecheckbox ControlStyleinput ControlStyletext_area ControlStyleprogress ControlStylescroll ControlStyledark_stylespub fn dark_styles() StylesCreate a complete dark theme; applications control subsequent switching.
No arguments are required.
an owned Styles value
light_stylespub fn light_styles() StylesCreate a complete light theme; applications control subsequent switching.
No arguments are required.
an owned Styles value
contrast_stylespub fn contrast_styles() StylesCreate a complete high-contrast theme; applications control subsequent switching.
No arguments are required.
an owned Styles value
(&Styles) same_aspub fn (styles &Styles) same_as(other &Styles) boolCompare the complete theme, including state rules.
styles &StylesStyles instance used by this call (borrow).other &Styleswhether all style fields match
(&Styles) same_metricspub fn (styles &Styles) same_metrics(other &Styles) boolCompare fields affecting typography and geometry measurement; colors and decorations are excluded.
styles &StylesStyles instance used by this call (borrow).other &Styleswhether measurement metrics match
(&Styles) validatepub fn (styles &Styles) validate() intValidate fonts, text scale, density, geometry and state rules; throws on invalid values.
styles &StylesStyles instance used by this call (borrow).0 on success; throws on failure
(&Styles) text_optionspub fn (styles &Styles) text_options(control &ControlStyle) draw.TextOptionsOperation on &Styles: text options.
styles &StylesStyles instance used by this call (borrow).control &ControlStyledraw.TextOptions — a value of this type
rounded_fillpub fn rounded_fill(frame $&draw.Frame,bounds &layout.Rect,radius f64,color draw.Color) intRounded fill. Throws on failure; handle the error or propagate it to the caller.
frame $&draw.Framebounds &layout.Rectradius f64color draw.Colorint — a value of this type
style_boxpub fn style_box(frame $&draw.Frame,bounds &layout.Rect,style &ControlStyle,density f64,state int) intStyle box. Throws on failure; handle the error or propagate it to the caller.
frame $&draw.Framebounds &layout.Rectstyle &ControlStyledensity f64state intint — a value of this type
(&FontStyle) validatepub fn (font &FontStyle) validate() intExecute validate on &FontStyle. Throws on failure; handle the error or propagate it to the caller.
font &FontStyleFontStyle instance used by this call (borrow).int — a value of this type
(&ControlStyle) validatepub fn (c &ControlStyle) validate() intExecute validate on &ControlStyle. Throws on failure; handle the error or propagate it to the caller.
c &ControlStyleControlStyle instance used by this call (borrow).int — a value of this type
(&ControlStyle) same_aspub fn (c &ControlStyle) same_as(other &ControlStyle) boolOperation on &ControlStyle: same as.
c &ControlStyleControlStyle instance used by this call (borrow).other &ControlStylebool — true or false
(&ControlStyle) same_metricspub fn (c &ControlStyle) same_metrics(other &ControlStyle) boolOperation on &ControlStyle: same metrics.
c &ControlStyleControlStyle instance used by this call (borrow).other &ControlStylebool — true or false
paint_box_styledpub fn paint_box_styled(frame $&draw.Frame,bounds &layout.Rect,styles &Styles,control &ControlStyle,state int) intPaint box styled. Throws on failure; handle the error or propagate it to the caller.
frame $&draw.Framebounds &layout.Rectstyles &Stylescontrol &ControlStylestate intint — a value of this type
struct StyledLabelpub struct StyledLabel {
}Owned text and native layout cache. Palette changes reuse layout; font changes rebuild it. Dispose when finished.
This type has no public fields.
styled_labelpub fn styled_label(context &draw.Context,value &string) StyledLabelStyled label.
context &draw.Contextvalue &stringStyledLabel — a value of this type
($&StyledLabel) set_font_stackpub fn (label $&StyledLabel) set_font_stack(stack font.FontStack)Operation on $&StyledLabel: set font stack.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).stack font.FontStackThis call does not return a value.
($&StyledLabel) add_ttf_bytespub fn (label $&StyledLabel) add_ttf_bytes(ttf_bytes &[]u8,font_index int,face_id int) intOperation on $&StyledLabel: add ttf bytes. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).ttf_bytes &[]u8font_index intface_id intint — a value of this type
(&StyledLabel) paint_layout_atpub fn (label &StyledLabel) paint_layout_at(frame $&draw.Frame,shaped &draw.TextLayout,x f64,y f64,color draw.Color) intOperation on &StyledLabel: paint layout at. Throws on failure; handle the error or propagate it to the caller.
label &StyledLabelStyledLabel instance used by this call (borrow).frame $&draw.Frameshaped &draw.TextLayoutx f64y f64color draw.Colorint — a value of this type
(&StyledLabel) textpub fn (label &StyledLabel) text() stringOperation on &StyledLabel: return the current text.
label &StyledLabelStyledLabel instance used by this call (borrow).string — result string
(&StyledLabel) has_stylepub fn (label &StyledLabel) has_style() boolOperation on &StyledLabel: whether it has style.
label &StyledLabelStyledLabel instance used by this call (borrow).bool — true or false
(&StyledLabel) style_orpub fn (label &StyledLabel) style_or(fallback &ControlStyle) ControlStyleOperation on &StyledLabel: style or.
label &StyledLabelStyledLabel instance used by this call (borrow).fallback &ControlStyleControlStyle — a value of this type
($&StyledLabel) set_stylepub fn (label $&StyledLabel) set_style(style &ControlStyle) intOperation on $&StyledLabel: set style. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&StyledLabel) clear_stylepub fn (label $&StyledLabel) clear_style()Operation on $&StyledLabel: clear style.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).This call does not return a value.
($&StyledLabel) set_textpub fn (label $&StyledLabel) set_text(value &string)Replace owned text; also call View.mark_measure when used in a View.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).value &stringThis call does not return a value.
($&StyledLabel) measure_styledpub fn (label $&StyledLabel) measure_styled(styles &Styles,control &ControlStyle) layout.SizeMeasure StyledLabel with the effective font, density, content and minimum size.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).styles &Stylescontrol &ControlStyleintrinsic logical size; throws if native shaping fails
($&StyledLabel) measure_wrappedpub fn (label $&StyledLabel) measure_wrapped(styles &Styles,control &ControlStyle,width f64) layout.SizeOperation on $&StyledLabel: measure wrapped. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).styles &Stylescontrol &ControlStylewidth f64layout.Size — a value of this type
($&StyledLabel) measure_box_styledpub fn (label $&StyledLabel) measure_box_styled(styles &Styles,fallback &ControlStyle) layout.SizeOperation on $&StyledLabel: measure box styled. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).styles &Stylesfallback &ControlStylelayout.Size — a value of this type
($&StyledLabel) paint_text_styledpub fn (label $&StyledLabel) paint_text_styled(frame $&draw.Frame,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,state int) intOperation on $&StyledLabel: paint text styled. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).frame $&draw.Framebounds &layout.Rectstyles &Stylesfallback &ControlStylestate intint — a value of this type
($&StyledLabel) paint_styledpub fn (label $&StyledLabel) paint_styled(frame $&draw.Frame,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,state int) intOperation on $&StyledLabel: paint styled. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).frame $&draw.Framebounds &layout.Rectstyles &Stylesfallback &ControlStylestate intint — a value of this type
($&StyledLabel) disposepub fn (label $&StyledLabel) dispose()Release the native layout cache owned by the label.
label $&StyledLabelStyledLabel instance used by this call (exclusive borrow).This call does not return a value.
copy_fontpub fn copy_font(font &FontStyle) FontStyleCopy font.
font &FontStyleFontStyle — a value of this type
(&ControlStyle) clonepub fn (c &ControlStyle) clone() ControlStyleDeep-copy the control style and state-rule array.
c &ControlStyleControlStyle instance used by this call (borrow).an owned ControlStyle
(&Styles) clonepub fn (s &Styles) clone() StylesDeep-copy the theme, including each control state-rule array.
s &StylesStyles instance used by this call (borrow).an owned Styles
(&Styles) switch_stylepub fn (styles &Styles) switch_style() ControlStyleOperation on &Styles: switch style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) radio_stylepub fn (styles &Styles) radio_style() ControlStyleOperation on &Styles: radio style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) slider_stylepub fn (styles &Styles) slider_style() ControlStyleOperation on &Styles: slider style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) tabs_stylepub fn (styles &Styles) tabs_style() ControlStyleOperation on &Styles: tabs style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) select_stylepub fn (styles &Styles) select_style() ControlStyleOperation on &Styles: select style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) divider_stylepub fn (styles &Styles) divider_style() ControlStyleOperation on &Styles: divider style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) badge_stylepub fn (styles &Styles) badge_style() ControlStyleOperation on &Styles: badge style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) card_stylepub fn (styles &Styles) card_style() ControlStyleOperation on &Styles: card style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) stepper_stylepub fn (styles &Styles) stepper_style() ControlStyleOperation on &Styles: stepper style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) list_box_stylepub fn (styles &Styles) list_box_style() ControlStyleOperation on &Styles: list box style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Styles) menu_stylepub fn (styles &Styles) menu_style() ControlStyleOperation on &Styles: menu style.
styles &StylesStyles instance used by this call (borrow).ControlStyle — a value of this type
(&Button) visual_statepub fn (button &Button) visual_state() intOperation on &Button: visual state.
button &ButtonButton instance used by this call (borrow).int — a value of this type
(&Button) has_stylepub fn (button &Button) has_style() boolOperation on &Button: whether it has style.
button &ButtonButton instance used by this call (borrow).bool — true or false
(&Button) style_orpub fn (button &Button) style_or(styles &Styles) ControlStyleOperation on &Button: style or.
button &ButtonButton instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Button) set_stylepub fn (button $&Button) set_style(style &ControlStyle) intOperation on $&Button: set style. Throws on failure; handle the error or propagate it to the caller.
button $&ButtonButton instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Button) clear_stylepub fn (button $&Button) clear_style()Operation on $&Button: clear style.
button $&ButtonButton instance used by this call (exclusive borrow).This call does not return a value.
(&Button) is_invalidpub fn (button &Button) is_invalid() boolOperation on &Button: whether it is invalid.
button &ButtonButton instance used by this call (borrow).bool — true or false
(&Button) is_selectedpub fn (button &Button) is_selected() boolOperation on &Button: whether it is selected.
button &ButtonButton instance used by this call (borrow).bool — true or false
(&Button) is_read_onlypub fn (button &Button) is_read_only() boolOperation on &Button: whether it is read only.
button &ButtonButton instance used by this call (borrow).bool — true or false
(&Button) is_hoveredpub fn (button &Button) is_hovered() boolOperation on &Button: whether it is hovered.
button &ButtonButton instance used by this call (borrow).bool — true or false
(&Button) is_pressedpub fn (button &Button) is_pressed() boolOperation on &Button: whether it is pressed.
button &ButtonButton instance used by this call (borrow).bool — true or false
($&Button) set_read_onlypub fn (button $&Button) set_read_only(read_only bool)Operation on $&Button: set read only.
button $&ButtonButton instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
(&Button) measure_styledpub fn (button &Button) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeMeasure Button with the effective font, density, content and minimum size.
button &ButtonButton instance used by this call (borrow).label $&StyledLabelstyles &Stylesintrinsic logical size; throws if native shaping fails
(&Button) paint_styledpub fn (button &Button) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intPaint Button using the complete theme; control bounds and Frame use the same local coordinates.
button &ButtonButton instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Styles0 on success; throws on failure
(&Checkbox) idpub fn (checkbox &Checkbox) id() intReturn the unique integer ID of the element or control.
checkbox &CheckboxCheckbox instance used by this call (borrow).int — a value of this type
(&Checkbox) boundspub fn (checkbox &Checkbox) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
checkbox &CheckboxCheckbox instance used by this call (borrow).layout.Rect — a value of this type
(&Checkbox) is_focusedpub fn (checkbox &Checkbox) is_focused() boolReturn whether the control currently has input focus.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
(&Checkbox) is_enabledpub fn (checkbox &Checkbox) is_enabled() boolReturn whether the control is currently enabled.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
(&Checkbox) is_invalidpub fn (checkbox &Checkbox) is_invalid() boolOperation on &Checkbox: whether it is invalid.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
(&Checkbox) is_read_onlypub fn (checkbox &Checkbox) is_read_only() boolOperation on &Checkbox: whether it is read only.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
($&Checkbox) set_read_onlypub fn (checkbox $&Checkbox) set_read_only(read_only bool)Operation on $&Checkbox: set read only.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).read_only boolThis call does not return a value.
(&Checkbox) visual_statepub fn (checkbox &Checkbox) visual_state() intOperation on &Checkbox: visual state.
checkbox &CheckboxCheckbox instance used by this call (borrow).int — a value of this type
(&Checkbox) has_stylepub fn (checkbox &Checkbox) has_style() boolOperation on &Checkbox: whether it has style.
checkbox &CheckboxCheckbox instance used by this call (borrow).bool — true or false
(&Checkbox) style_orpub fn (checkbox &Checkbox) style_or(styles &Styles) ControlStyleOperation on &Checkbox: style or.
checkbox &CheckboxCheckbox instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Checkbox) set_stylepub fn (checkbox $&Checkbox) set_style(style &ControlStyle) intOperation on $&Checkbox: set style. Throws on failure; handle the error or propagate it to the caller.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Checkbox) clear_stylepub fn (checkbox $&Checkbox) clear_style()Operation on $&Checkbox: clear style.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).This call does not return a value.
(&Checkbox) measure_styledpub fn (checkbox &Checkbox) measure_styled(label $&StyledLabel,styles &Styles) layout.SizeMeasure Checkbox with the effective font, density, content and minimum size.
checkbox &CheckboxCheckbox instance used by this call (borrow).label $&StyledLabelstyles &Stylesintrinsic logical size; throws if native shaping fails
(&Checkbox) paint_styledpub fn (checkbox &Checkbox) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intPaint Checkbox using the complete theme; control bounds and Frame use the same local coordinates.
checkbox &CheckboxCheckbox instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Styles0 on success; throws on failure
(&Progress) boundspub fn (progress &Progress) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
progress &ProgressProgress instance used by this call (borrow).layout.Rect — a value of this type
(&Progress) is_enabledpub fn (progress &Progress) is_enabled() boolReturn whether the control is currently enabled.
progress &ProgressProgress instance used by this call (borrow).bool — true or false
(&Progress) is_invalidpub fn (progress &Progress) is_invalid() boolOperation on &Progress: whether it is invalid.
progress &ProgressProgress instance used by this call (borrow).bool — true or false
(&Progress) is_focusedpub fn (progress &Progress) is_focused() boolReturn whether the control currently has input focus.
progress &ProgressProgress instance used by this call (borrow).bool — true or false
(&Progress) is_selectedpub fn (progress &Progress) is_selected() boolOperation on &Progress: whether it is selected.
progress &ProgressProgress instance used by this call (borrow).bool — true or false
($&Progress) set_focuspub fn (progress $&Progress) set_focus(focused bool)Operation on $&Progress: set focus.
progress $&ProgressProgress instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&Progress) set_selectedpub fn (progress $&Progress) set_selected(selected bool)Operation on $&Progress: set selected.
progress $&ProgressProgress instance used by this call (exclusive borrow).selected boolThis call does not return a value.
(&Progress) visual_statepub fn (progress &Progress) visual_state() intOperation on &Progress: visual state.
progress &ProgressProgress instance used by this call (borrow).int — a value of this type
(&Progress) has_stylepub fn (progress &Progress) has_style() boolOperation on &Progress: whether it has style.
progress &ProgressProgress instance used by this call (borrow).bool — true or false
(&Progress) style_orpub fn (progress &Progress) style_or(styles &Styles) ControlStyleOperation on &Progress: style or.
progress &ProgressProgress instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Progress) set_stylepub fn (progress $&Progress) set_style(style &ControlStyle) intOperation on $&Progress: set style. Throws on failure; handle the error or propagate it to the caller.
progress $&ProgressProgress instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Progress) clear_stylepub fn (progress $&Progress) clear_style()Operation on $&Progress: clear style.
progress $&ProgressProgress instance used by this call (exclusive borrow).This call does not return a value.
(&Progress) measure_styledpub fn (progress &Progress) measure_styled(styles &Styles) layout.SizeOperation on &Progress: measure styled.
progress &ProgressProgress instance used by this call (borrow).styles &Styleslayout.Size — a value of this type
(&Progress) paint_styledpub fn (progress &Progress) paint_styled(frame $&draw.Frame,styles &Styles) intPaint Progress using the complete theme; control bounds and Frame use the same local coordinates.
progress &ProgressProgress instance used by this call (borrow).frame $&draw.Framestyles &Styles0 on success; throws on failure
($&Button) set_invalidpub fn (button $&Button) set_invalid(invalid bool)Operation on $&Button: set invalid.
button $&ButtonButton instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&Button) set_selectedpub fn (button $&Button) set_selected(selected bool)Set a button's persistent selected appearance, for example a toolbar mode toggle.
button $&ButtonButton instance used by this call (exclusive borrow).selected boolNo return value; changed state marks repainting.
($&Checkbox) set_invalidpub fn (checkbox $&Checkbox) set_invalid(invalid bool)Operation on $&Checkbox: set invalid.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&Progress) set_enabledpub fn (progress $&Progress) set_enabled(enabled bool)Operation on $&Progress: set enabled.
progress $&ProgressProgress instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&Progress) set_invalidpub fn (progress $&Progress) set_invalid(invalid bool)Operation on $&Progress: set invalid.
progress $&ProgressProgress instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&Progress) set_bufferpub fn (progress $&Progress) set_buffer(value f64) intOperation on $&Progress: set buffer. Throws on failure; handle the error or propagate it to the caller.
progress $&ProgressProgress instance used by this call (exclusive borrow).value f64int — a value of this type
struct Tablepub struct Table {
}A bounded single-line, equal-width column table: 1..16 columns and at most 768 cells (512 rows). Header activation sorts locally unless manual mode is set. Only visible rows are shaped, and their cache slots are reused on scroll.
This type has no public fields.
tablepub fn table(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,headers &[]string,rows int,selected int) TableTable. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectheaders &[]stringrows intselected intTable — a value of this type
(&Table) idpub fn (t &Table) id() intReturn the unique integer ID of the element or control.
t &TableTable instance used by this call (borrow).int — a value of this type
(&Table) boundspub fn (t &Table) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
t &TableTable instance used by this call (borrow).layout.Rect — a value of this type
(&Table) countpub fn (t &Table) count() intReturn the number of items in this control.
t &TableTable instance used by this call (borrow).int — a value of this type
(&Table) column_countpub fn (t &Table) column_count() intOperation on &Table: column count.
t &TableTable instance used by this call (borrow).int — a value of this type
(&Table) selectedpub fn (t &Table) selected() intGet or test the currently selected index, node, or state.
t &TableTable instance used by this call (borrow).int — a value of this type
(&Table) sort_columnpub fn (t &Table) sort_column() intOperation on &Table: sort column.
t &TableTable instance used by this call (borrow).int — a value of this type
(&Table) sort_descendingpub fn (t &Table) sort_descending() boolOperation on &Table: sort descending.
t &TableTable instance used by this call (borrow).bool — true or false
(&Table) scroll_offsetpub fn (t &Table) scroll_offset() f64Operation on &Table: scroll offset.
t &TableTable instance used by this call (borrow).f64 — a value of this type
(&Table) needs_paintpub fn (t &Table) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
t &TableTable instance used by this call (borrow).bool — true or false
($&Table) paintedpub fn (t $&Table) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
t $&TableTable instance used by this call (exclusive borrow).This call does not return a value.
(&Table) is_selectablepub fn (t &Table) is_selectable() boolOperation on &Table: whether it is selectable.
t &TableTable instance used by this call (borrow).bool — true or false
($&Table) set_selectablepub fn (t $&Table) set_selectable(selectable bool)Operation on $&Table: set selectable.
t $&TableTable instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&Table) has_popup_openpub fn (t &Table) has_popup_open() boolOperation on &Table: whether it has popup open.
t &TableTable instance used by this call (borrow).bool — true or false
(&Table) popup_boundspub fn (t &Table) popup_bounds() layout.RectOperation on &Table: popup bounds.
t &TableTable instance used by this call (borrow).layout.Rect — a value of this type
($&Table) set_viewportpub fn (t $&Table) set_viewport(viewport &layout.Rect)Operation on $&Table: set viewport.
t $&TableTable instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&Table) paint_popup_styledpub fn (t $&Table) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Table: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&Table) cursorpub fn (t &Table) cursor() intExecute cursor on &Table.
t &TableTable instance used by this call (borrow).int — a value of this type
(&Table) is_enabledpub fn (t &Table) is_enabled() boolReturn whether the control is currently enabled.
t &TableTable instance used by this call (borrow).bool — true or false
(&Table) is_focusedpub fn (t &Table) is_focused() boolReturn whether the control currently has input focus.
t &TableTable instance used by this call (borrow).bool — true or false
(&Table) is_read_onlypub fn (t &Table) is_read_only() boolOperation on &Table: whether it is read only.
t &TableTable instance used by this call (borrow).bool — true or false
($&Table) cancelpub fn (t $&Table) cancel()Execute cancel on $&Table.
t $&TableTable instance used by this call (exclusive borrow).This call does not return a value.
($&Table) set_focuspub fn (t $&Table) set_focus(focused bool)Operation on $&Table: set focus.
t $&TableTable instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&Table) set_enabledpub fn (t $&Table) set_enabled(enabled bool)Operation on $&Table: set enabled.
t $&TableTable instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&Table) set_read_onlypub fn (t $&Table) set_read_only(value bool) intOperation on $&Table: set read only. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).value boolint — a value of this type
($&Table) set_cellpub fn (t $&Table) set_cell(row int,column int,text &string) intOperation on $&Table: set cell. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).row intcolumn inttext &stringint — a value of this type
(&Table) cellpub fn (t &Table) cell(row int,column int) stringExecute cell on &Table. Throws on failure; handle the error or propagate it to the caller.
t &TableTable instance used by this call (borrow).row intcolumn intstring — result string
($&Table) set_rowspub fn (t $&Table) set_rows(count int) intOperation on $&Table: set rows. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).count intint — a value of this type
($&Table) set_selectedpub fn (t $&Table) set_selected(index int) intOperation on $&Table: set selected. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).index intint — a value of this type
($&Table) set_scroll_offsetpub fn (t $&Table) set_scroll_offset(offset f64) intOperation on $&Table: set scroll offset. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).offset f64int — a value of this type
($&Table) set_boundspub fn (t $&Table) set_bounds(bounds &layout.Rect) intOperation on $&Table: set bounds. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&Table) style_orpub fn (t &Table) style_or(styles &Styles) ControlStyleOperation on &Table: style or.
t &TableTable instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Table) set_stylepub fn (t $&Table) set_style(style &ControlStyle) intOperation on $&Table: set style. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Table) clear_stylepub fn (t $&Table) clear_style()Operation on $&Table: clear style.
t $&TableTable instance used by this call (exclusive borrow).This call does not return a value.
($&Table) apply_stylespub fn (t $&Table) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&Table) row_boundspub fn (t &Table) row_bounds(row int) layout.RectOperation on &Table: row bounds.
t &TableTable instance used by this call (borrow).row intlayout.Rect — a value of this type
(&Table) header_boundspub fn (t &Table) header_bounds(column int) layout.RectOperation on &Table: header bounds.
t &TableTable instance used by this call (borrow).column intlayout.Rect — a value of this type
(&Table) row_textpub fn (t &Table) row_text(source_row int) stringOperation on &Table: row text.
t &TableTable instance used by this call (borrow).source_row intstring — result string
($&Table) inputpub fn (t $&Table) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Table) routepub fn (t $&Table) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Table) eventpub fn (t $&Table) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
($&Table) measure_styledpub fn (t $&Table) measure_styled(styles &Styles) layout.SizeOperation on $&Table: measure styled. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&Table) disposepub fn (t $&Table) dispose()Release and dispose native resources and underlying handles.
t $&TableTable instance used by this call (exclusive borrow).This call does not return a value.
(&Table) selected_textpub fn (t &Table) selected_text() stringOperation on &Table: selected text.
t &TableTable instance used by this call (borrow).string — result string
(&Table) column_widthpub fn (t &Table) column_width(column int) f64Operation on &Table: column width. Throws on failure; handle the error or propagate it to the caller.
t &TableTable instance used by this call (borrow).column intf64 — a value of this type
($&Table) set_column_widthpub fn (t $&Table) set_column_width(column int,width f64) intOperation on $&Table: set column width. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).column intwidth f64int — a value of this type
($&Table) set_column_alignmentpub fn (t $&Table) set_column_alignment(column int,alignment f64) intOperation on $&Table: set column alignment. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).column intalignment f64int — a value of this type
($&Table) set_horizontal_offsetpub fn (t $&Table) set_horizontal_offset(offset f64) intOperation on $&Table: set horizontal offset. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).offset f64int — a value of this type
(&Table) horizontal_offsetpub fn (t &Table) horizontal_offset() f64Operation on &Table: horizontal offset.
t &TableTable instance used by this call (borrow).f64 — a value of this type
($&Table) set_statuspub fn (t $&Table) set_status(text &string) intOperation on $&Table: set status. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).text &stringint — a value of this type
($&Table) paint_styledpub fn (t $&Table) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Table: paint styled. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Table) set_column_min_widthpub fn (t $&Table) set_column_min_width(column int,width f64) intOperation on $&Table: set column min width. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).column intwidth f64int — a value of this type
($&Screen) set_table_column_min_widthpub fn (s $&Screen) set_table_column_min_width(id int,column int,width f64) intOperation on $&Screen: set table column min width. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).id intcolumn intwidth f64int — a value of this type
const TABLE_SORT_TEXTpub const TABLE_SORT_TEXT = 0Constant TABLE_SORT_TEXT, defining protocol or algorithm parameters.
const TABLE_SORT_NUMBERpub const TABLE_SORT_NUMBER = 1Constant TABLE_SORT_NUMBER, defining protocol or algorithm parameters.
(&Table) row_atpub fn (t &Table) row_at(view_row int) intSource row indices remain stable while the view is sorted. cell/set_cell address source rows; view_cell and row_at address displayed rows. Throws on failure; handle the error or propagate it to the caller.
t &TableTable instance used by this call (borrow).view_row intint — a value of this type
(&Table) view_rowpub fn (t &Table) view_row(source_row int) intOperation on &Table: view row. Throws on failure; handle the error or propagate it to the caller.
t &TableTable instance used by this call (borrow).source_row intint — a value of this type
(&Table) selected_rowpub fn (t &Table) selected_row() intOperation on &Table: selected row. Throws on failure; handle the error or propagate it to the caller.
t &TableTable instance used by this call (borrow).int — a value of this type
(&Table) view_cellpub fn (t &Table) view_cell(row int,column int) stringOperation on &Table: view cell. Throws on failure; handle the error or propagate it to the caller.
t &TableTable instance used by this call (borrow).row intcolumn intstring — result string
($&Table) set_selected_rowpub fn (t $&Table) set_selected_row(source_row int) intOperation on $&Table: set selected row. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).source_row intint — a value of this type
($&Table) sort_bypub fn (t $&Table) sort_by(column int,descending bool) intOperation on $&Table: sort by. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).column intdescending boolint — a value of this type
($&Table) refresh_sortpub fn (t $&Table) refresh_sort() intOperation on $&Table: refresh sort. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).int — a value of this type
($&Table) set_sort_kindpub fn (t $&Table) set_sort_kind(column int,kind int) intOperation on $&Table: set sort kind. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).column intkind intint — a value of this type
($&Table) set_local_sortpub fn (t $&Table) set_local_sort(enabled bool) intManual mode keeps header state/events and lets a remote data source own order. Throws on failure; handle the error or propagate it to the caller.
t $&TableTable instance used by this call (exclusive borrow).enabled boolint — a value of this type
const TASK_IDLEpub const TASK_IDLE = 0Constant TASK_IDLE, defining protocol or algorithm parameters.
const TASK_RUNNINGpub const TASK_RUNNING = 1Constant TASK_RUNNING, defining protocol or algorithm parameters.
const TASK_SUCCESSpub const TASK_SUCCESS = 2Constant TASK_SUCCESS, defining protocol or algorithm parameters.
const TASK_ERRORpub const TASK_ERROR = 3Constant TASK_ERROR, defining protocol or algorithm parameters.
const TASK_CANCELLEDpub const TASK_CANCELLED = 4Constant TASK_CANCELLED, defining protocol or algorithm parameters.
const TASK_PROGRESS_LINEpub const TASK_PROGRESS_LINE = 0Constant TASK_PROGRESS_LINE, defining protocol or algorithm parameters.
const TASK_PROGRESS_FILLpub const TASK_PROGRESS_FILL = 1Constant TASK_PROGRESS_FILL, defining protocol or algorithm parameters.
const TASK_PROGRESS_ICONpub const TASK_PROGRESS_ICON = 2Constant TASK_PROGRESS_ICON, defining protocol or algorithm parameters.
const ACTION_CANCEL_TASKpub const ACTION_CANCEL_TASK = 7Constant ACTION_CANCEL_TASK, defining protocol or algorithm parameters.
struct TaskButtonpub struct TaskButton {
}TaskButton context or state structure.
This type has no public fields.
task_buttonpub fn task_button(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,label &string) TaskButtonTask button. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectlabel &stringTaskButton — a value of this type
(&TaskButton) idpub fn (task &TaskButton) id() intReturn the unique integer ID of the element or control.
task &TaskButtonTaskButton instance used by this call (borrow).int — a value of this type
(&TaskButton) boundspub fn (task &TaskButton) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
task &TaskButtonTaskButton instance used by this call (borrow).layout.Rect — a value of this type
(&TaskButton) statepub fn (task &TaskButton) state() intExecute state on &TaskButton.
task &TaskButtonTaskButton instance used by this call (borrow).int — a value of this type
(&TaskButton) task_idpub fn (task &TaskButton) task_id() intOperation on &TaskButton: task id.
task &TaskButtonTaskButton instance used by this call (borrow).int — a value of this type
(&TaskButton) is_runningpub fn (task &TaskButton) is_running() boolOperation on &TaskButton: whether it is running.
task &TaskButtonTaskButton instance used by this call (borrow).bool — true or false
(&TaskButton) is_determinatepub fn (task &TaskButton) is_determinate() boolOperation on &TaskButton: whether it is determinate.
task &TaskButtonTaskButton instance used by this call (borrow).bool — true or false
(&TaskButton) progresspub fn (task &TaskButton) progress() f64Execute progress on &TaskButton.
task &TaskButtonTaskButton instance used by this call (borrow).f64 — a value of this type
(&TaskButton) is_enabledpub fn (task &TaskButton) is_enabled() boolReturn whether the control is currently enabled.
task &TaskButtonTaskButton instance used by this call (borrow).bool — true or false
(&TaskButton) is_selectablepub fn (task &TaskButton) is_selectable() boolOperation on &TaskButton: whether it is selectable.
task &TaskButtonTaskButton instance used by this call (borrow).bool — true or false
($&TaskButton) set_selectablepub fn (task $&TaskButton) set_selectable(selectable bool)Operation on $&TaskButton: set selectable.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&TaskButton) is_focusedpub fn (task &TaskButton) is_focused() boolReturn whether the control currently has input focus.
task &TaskButtonTaskButton instance used by this call (borrow).bool — true or false
(&TaskButton) needs_paintpub fn (task &TaskButton) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
task &TaskButtonTaskButton instance used by this call (borrow).bool — true or false
($&TaskButton) paintedpub fn (task $&TaskButton) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).This call does not return a value.
($&TaskButton) cancelpub fn (task $&TaskButton) cancel()Execute cancel on $&TaskButton.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).This call does not return a value.
($&TaskButton) set_focuspub fn (task $&TaskButton) set_focus(focused bool)Operation on $&TaskButton: set focus.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&TaskButton) set_enabledpub fn (task $&TaskButton) set_enabled(enabled bool)Operation on $&TaskButton: set enabled.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&TaskButton) set_boundspub fn (task $&TaskButton) set_bounds(bounds &layout.Rect) intOperation on $&TaskButton: set bounds. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&TaskButton) set_stylepub fn (task $&TaskButton) set_style(style &ControlStyle) intOperation on $&TaskButton: set style. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&TaskButton) set_motionpub fn (task $&TaskButton) set_motion(spec &MotionSpec) intOperation on $&TaskButton: set motion. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&TaskButton) set_progress_modepub fn (task $&TaskButton) set_progress_mode(mode int) intOperation on $&TaskButton: set progress mode. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).mode intint — a value of this type
($&TaskButton) set_labelspub fn (task $&TaskButton) set_labels(running &string,success &string,error &string,cancelled &string) intOperation on $&TaskButton: set labels. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).running &stringsuccess &stringerror &stringcancelled &stringint — a value of this type
($&TaskButton) set_cancellablepub fn (task $&TaskButton) set_cancellable(enabled bool)Operation on $&TaskButton: set cancellable.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&TaskButton) beginpub fn (task $&TaskButton) begin(id int,now time.Instant) intStrictly increasing task IDs prevent a late completion from replacing a retry. The caller owns execution, cancellation and all progress reporting. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).id intnow time.Instantint — a value of this type
($&TaskButton) set_progresspub fn (task $&TaskButton) set_progress(id int,value f64) boolOperation on $&TaskButton: set progress. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).id intvalue f64bool — true or false
($&TaskButton) completepub fn (task $&TaskButton) complete(id int,state int) boolExecute complete on $&TaskButton. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).id intstate intbool — true or false
($&TaskButton) resetpub fn (task $&TaskButton) reset() intOperation on $&TaskButton: clear internal state so the value can be reused. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).int — a value of this type
($&TaskButton) inputpub fn (task $&TaskButton) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&TaskButton) routepub fn (task $&TaskButton) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&TaskButton) eventpub fn (task $&TaskButton) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
($&TaskButton) tickpub fn (task $&TaskButton) tick(now time.Instant,reduced bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).now time.Instantreduced boolbool — true or false
(&TaskButton) next_tickpub fn (task &TaskButton) next_tick(now time.Instant) time.InstantOperation on &TaskButton: next tick. Throws on failure; handle the error or propagate it to the caller.
task &TaskButtonTaskButton instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
($&TaskButton) measure_styledpub fn (task $&TaskButton) measure_styled(styles &Styles) layout.SizeOperation on $&TaskButton: measure styled. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&TaskButton) paint_styledpub fn (task $&TaskButton) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&TaskButton: paint styled. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&TaskButton) disposepub fn (task $&TaskButton) dispose()Release and dispose native resources and underlying handles.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).This call does not return a value.
struct TaskFeedbackpub struct TaskFeedback {
pub delay time.Duration
pub success_hold time.Duration
pub percentage bool
pub thickness f64
}Structure encapsulating delay, success_hold, percentage, thickness.
delay time.Durationsuccess_hold time.Durationpercentage boolthickness f64task_feedbackpub fn task_feedback() TaskFeedbackTask feedback.
No arguments are required.
TaskFeedback — a value of this type
($&TaskButton) set_feedbackpub fn (task $&TaskButton) set_feedback(feedback &TaskFeedback) intOperation on $&TaskButton: set feedback. Throws on failure; handle the error or propagate it to the caller.
task $&TaskButtonTaskButton instance used by this call (exclusive borrow).feedback &TaskFeedbackint — a value of this type
struct TextCachepub struct TextCache {
}Composite controls share typography while retaining separate native layouts. Cache keys are sparse identities; visible-cell slots can be reused by callers. Native handles are plain values with explicit disposal, like Editor.
This type has no public fields.
text_cachepub fn text_cache(context &draw.Context) TextCacheText cache.
context &draw.ContextTextCache — a value of this type
($&TextCache) disposepub fn (cache $&TextCache) dispose()Release and dispose native resources and underlying handles.
cache $&TextCacheTextCache instance used by this call (exclusive borrow).This call does not return a value.
($&TextCache) measurepub fn (cache $&TextCache) measure(index int,value &string,styles &Styles,c &ControlStyle) layout.SizeExecute measure on $&TextCache. Throws on failure; handle the error or propagate it to the caller.
cache $&TextCacheTextCache instance used by this call (exclusive borrow).index intvalue &stringstyles &Stylesc &ControlStylelayout.Size — a value of this type
($&TextCache) paint_textpub fn (cache $&TextCache) paint_text(index int,value &string,frame $&draw.Frame,bounds &layout.Rect,styles &Styles,c &ControlStyle,state int) intOperation on $&TextCache: paint text. Throws on failure; handle the error or propagate it to the caller.
cache $&TextCacheTextCache instance used by this call (exclusive borrow).index intvalue &stringframe $&draw.Framebounds &layout.Rectstyles &Stylesc &ControlStylestate intint — a value of this type
const TEXT_MENU_NONEpub const TEXT_MENU_NONE = 0Constant TEXT_MENU_NONE, defining protocol or algorithm parameters.
const TEXT_MENU_COPYpub const TEXT_MENU_COPY = 1Constant TEXT_MENU_COPY, defining protocol or algorithm parameters.
const TEXT_MENU_CUTpub const TEXT_MENU_CUT = 2Constant TEXT_MENU_CUT, defining protocol or algorithm parameters.
const TEXT_MENU_PASTEpub const TEXT_MENU_PASTE = 3Constant TEXT_MENU_PASTE, defining protocol or algorithm parameters.
const TEXT_MENU_SELECT_ALLpub const TEXT_MENU_SELECT_ALL = 4Constant TEXT_MENU_SELECT_ALL, defining protocol or algorithm parameters.
const TEXT_MENU_COPY_ROWpub const TEXT_MENU_COPY_ROW = 5Constant TEXT_MENU_COPY_ROW, defining protocol or algorithm parameters.
const TEXT_KEY_NONEpub const TEXT_KEY_NONE = 0Constant TEXT_KEY_NONE, defining protocol or algorithm parameters.
const TEXT_KEY_CHANGEDpub const TEXT_KEY_CHANGED = 1Constant TEXT_KEY_CHANGED, defining protocol or algorithm parameters.
const TEXT_KEY_COPYpub const TEXT_KEY_COPY = 2Constant TEXT_KEY_COPY, defining protocol or algorithm parameters.
struct TextRangepub struct TextRange {
pub start int
pub end int
}Structure encapsulating start, end.
start intend inttext_rangepub fn text_range(a int,b int) TextRangeText range.
a intb intTextRange — a value of this type
(&TextRange) emptypub fn (range &TextRange) empty() boolReport whether the geometry rectangle is empty (dx <= 0 or dy <= 0).
range &TextRangeTextRange instance used by this call (borrow).bool — true or false
(&TextRange) lengthpub fn (range &TextRange) length() intOperation on &TextRange: return the current length.
range &TextRangeTextRange instance used by this call (borrow).int — a value of this type
selection_prev_boundarypub fn selection_prev_boundary(value &string,index int) intSelection prev boundary.
value &stringindex intint — a value of this type
selection_next_boundarypub fn selection_next_boundary(value &string,index int) intSelection next boundary.
value &stringindex intint — a value of this type
word_range_atpub fn word_range_at(value &string,index int) TextRangeWord range at.
value &stringindex intTextRange — a value of this type
line_range_atpub fn line_range_at(value &string,index int) TextRangeLine range at.
value &stringindex intTextRange — a value of this type
struct TextMenuSpecpub struct TextMenuSpec {
pub show_cut bool
pub cut_enabled bool
pub show_copy bool
pub copy_enabled bool
pub show_paste bool
pub paste_enabled bool
pub show_select_all bool
pub select_all_enabled bool
pub show_copy_row bool
pub copy_row_enabled bool
}Structure encapsulating show_cut, cut_enabled, show_copy, copy_enabled, show_paste.
show_cut boolcut_enabled boolshow_copy boolcopy_enabled boolshow_paste boolpaste_enabled boolshow_select_all boolselect_all_enabled boolshow_copy_row boolcopy_row_enabled booltext_menu_spec_readonlypub fn text_menu_spec_readonly(has_selection bool,has_text bool) TextMenuSpecText menu spec readonly.
has_selection boolhas_text boolTextMenuSpec — a value of this type
text_menu_spec_editablepub fn text_menu_spec_editable(has_selection bool,has_text bool,can_paste bool) TextMenuSpecText menu spec editable.
has_selection boolhas_text boolcan_paste boolTextMenuSpec — a value of this type
struct TextContextMenuItempub struct TextContextMenuItem {
pub cmd int
pub enabled bool
}Structure encapsulating cmd, enabled.
cmd intenabled boolstruct TextMenuResultpub struct TextMenuResult {
pub consumed bool
pub closed bool
pub cmd int
pub dirty bool
}Structure encapsulating consumed, closed, cmd, dirty.
consumed boolclosed boolcmd intdirty booltry_copy_clipboardpub fn try_copy_clipboard(identity &ui.CanvasEvent,text &string) intTry copy clipboard.
identity &ui.CanvasEventtext &stringint — a value of this type
paint_text_selectionpub fn paint_text_selection(frame $&draw.Frame,shaped &draw.TextLayout,origin_x f64,origin_y f64,anchor int,focus int,bg draw.Color,fg draw.Color,text_len int) intPaint text selection. Throws on failure; handle the error or propagate it to the caller.
frame $&draw.Frameshaped &draw.TextLayoutorigin_x f64origin_y f64anchor intfocus intbg draw.Colorfg draw.Colortext_len intint — a value of this type
($&TextCache) ensure_layout_forpub fn (cache $&TextCache) ensure_layout_for(index int,value &string,bounds &layout.Rect,styles &Styles,c &ControlStyle,wrapped bool) draw.TextLayoutOperation on $&TextCache: ensure layout for. Throws on failure; handle the error or propagate it to the caller.
cache $&TextCacheTextCache instance used by this call (exclusive borrow).index intvalue &stringbounds &layout.Rectstyles &Stylesc &ControlStylewrapped booldraw.TextLayout — a value of this type
($&TextCache) hit_test_atpub fn (cache $&TextCache) hit_test_at(index int,value &string,bounds &layout.Rect,styles &Styles,c &ControlStyle,wrapped bool,x f64,y f64) intOperation on $&TextCache: hit test at. Throws on failure; handle the error or propagate it to the caller.
cache $&TextCacheTextCache instance used by this call (exclusive borrow).index intvalue &stringbounds &layout.Rectstyles &Stylesc &ControlStylewrapped boolx f64y f64int — a value of this type
($&TextCache) paint_text_selectedpub fn (cache $&TextCache) paint_text_selected(index int,value &string,frame $&draw.Frame,bounds &layout.Rect,styles &Styles,c &ControlStyle,state int,sel_anchor int,sel_focus int,wrapped bool) intOperation on $&TextCache: paint text selected. Throws on failure; handle the error or propagate it to the caller.
cache $&TextCacheTextCache instance used by this call (exclusive borrow).index intvalue &stringframe $&draw.Framebounds &layout.Rectstyles &Stylesc &ControlStylestate intsel_anchor intsel_focus intwrapped boolint — a value of this type
styled_label_ensurepub fn styled_label_ensure(label $&StyledLabel,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,wrapped bool) layout.SizeStyled label ensure. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelbounds &layout.Rectstyles &Stylesfallback &ControlStylewrapped boollayout.Size — a value of this type
styled_label_hit_testpub fn styled_label_hit_test(label $&StyledLabel,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,wrapped bool,x f64,y f64) intStyled label hit test. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelbounds &layout.Rectstyles &Stylesfallback &ControlStylewrapped boolx f64y f64int — a value of this type
paint_styled_label_selectedpub fn paint_styled_label_selected(label $&StyledLabel,frame $&draw.Frame,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,state int,sel_anchor int,sel_focus int,wrapped bool,ellipsis bool) intPaint styled label selected. Throws on failure; handle the error or propagate it to the caller.
label $&StyledLabelframe $&draw.Framebounds &layout.Rectstyles &Stylesfallback &ControlStylestate intsel_anchor intsel_focus intwrapped boolellipsis boolint — a value of this type
paint_styled_label_at_originpub fn paint_styled_label_at_origin(label &StyledLabel,frame $&draw.Frame,tx f64,ty f64,resolved &ResolvedStyle,sel_anchor int,sel_focus int) intPaint styled label at origin. Throws on failure; handle the error or propagate it to the caller.
label &StyledLabelframe $&draw.Frametx f64ty f64resolved &ResolvedStylesel_anchor intsel_focus intint — a value of this type
hit_test_styled_label_at_originpub fn hit_test_styled_label_at_origin(label &StyledLabel,tx f64,ty f64,x f64,y f64) intHit test styled label at origin.
label &StyledLabeltx f64ty f64x f64y f64int — a value of this type
struct TextSelectionEnginepub struct TextSelectionEngine {
pub selectable bool
pub anchor int
pub focus int
pub selecting bool
}Structure encapsulating selectable, anchor, focus, selecting.
selectable boolanchor intfocus intselecting booltext_selection_enginepub fn text_selection_engine(selectable bool) TextSelectionEngineText selection engine.
selectable boolTextSelectionEngine — a value of this type
(&TextSelectionEngine) has_selectionpub fn (e &TextSelectionEngine) has_selection() boolOperation on &TextSelectionEngine: whether it has selection.
e &TextSelectionEngineTextSelectionEngine instance used by this call (borrow).bool — true or false
(&TextSelectionEngine) is_drag_charpub fn (e &TextSelectionEngine) is_drag_char() boolOperation on &TextSelectionEngine: whether it is drag char.
e &TextSelectionEngineTextSelectionEngine instance used by this call (borrow).bool — true or false
($&TextSelectionEngine) reset_clickspub fn (e $&TextSelectionEngine) reset_clicks()Operation on $&TextSelectionEngine: reset clicks.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).This call does not return a value.
(&TextSelectionEngine) rangepub fn (e &TextSelectionEngine) range(text_len int) ui.TextRangeExecute range on &TextSelectionEngine.
e &TextSelectionEngineTextSelectionEngine instance used by this call (borrow).text_len intui.TextRange — a value of this type
(&TextSelectionEngine) selected_textpub fn (e &TextSelectionEngine) selected_text(text &string) stringOperation on &TextSelectionEngine: selected text.
e &TextSelectionEngineTextSelectionEngine instance used by this call (borrow).text &stringstring — result string
($&TextSelectionEngine) clearpub fn (e $&TextSelectionEngine) clear() boolClear all buffered or stored entries and internal state.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).bool — true or false
($&TextSelectionEngine) set_selectablepub fn (e $&TextSelectionEngine) set_selectable(selectable bool) boolOperation on $&TextSelectionEngine: set selectable.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).selectable boolbool — true or false
($&TextSelectionEngine) select_allpub fn (e $&TextSelectionEngine) select_all(text &string) boolOperation on $&TextSelectionEngine: select all.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).text &stringbool — true or false
($&TextSelectionEngine) set_rangepub fn (e $&TextSelectionEngine) set_range(text &string,start int,end int) boolOperation on $&TextSelectionEngine: set range.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).text &stringstart intend intbool — true or false
($&TextSelectionEngine) begin_pointer_downpub fn (e $&TextSelectionEngine) begin_pointer_down(text &string,idx int,event &ui.InputEvent) boolOperation on $&TextSelectionEngine: begin pointer down.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).text &stringidx intevent &ui.InputEventbool — true or false
($&TextSelectionEngine) drag_pointerpub fn (e $&TextSelectionEngine) drag_pointer(text &string,idx int) boolOperation on $&TextSelectionEngine: drag pointer.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).text &stringidx intbool — true or false
($&TextSelectionEngine) end_pointerpub fn (e $&TextSelectionEngine) end_pointer() boolOperation on $&TextSelectionEngine: end pointer.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).bool — true or false
($&TextSelectionEngine) key_navigationpub fn (e $&TextSelectionEngine) key_navigation(text &string,event &ui.InputEvent) intOperation on $&TextSelectionEngine: key navigation.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).text &stringevent &ui.InputEventint — a value of this type
($&TextSelectionEngine) key_navigation_layoutpub fn (e $&TextSelectionEngine) key_navigation_layout(text &string,shaped &draw.TextLayout,event &ui.InputEvent) intOperation on $&TextSelectionEngine: key navigation layout.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).text &stringshaped &draw.TextLayoutevent &ui.InputEventint — a value of this type
font_vertical_step_focuspub fn font_vertical_step_focus(shaped &font.TextLayout,text &string,cur_focus int,key int) intFont vertical step focus.
shaped &font.TextLayouttext &stringcur_focus intkey intint — a value of this type
($&TextSelectionEngine) key_navigation_font_layoutpub fn (e $&TextSelectionEngine) key_navigation_font_layout(text &string,shaped &font.TextLayout,event &ui.InputEvent) intOperation on $&TextSelectionEngine: key navigation font layout.
e $&TextSelectionEngineTextSelectionEngine instance used by this call (exclusive borrow).text &stringshaped &font.TextLayoutevent &ui.InputEventint — a value of this type
text_menu_item_labelpub fn text_menu_item_label(locale &Locale,cmd int) stringText menu item label.
locale &Localecmd intstring — result string
text_menu_shortcut_labelpub fn text_menu_shortcut_label(cmd int) stringText menu shortcut label.
cmd intstring — result string
is_context_triggerpub fn is_context_trigger(event &ui.InputEvent) boolWhether it is context trigger.
event &ui.InputEventbool — true or false
struct TextContextMenupub struct TextContextMenu {
}TextContextMenu context or state structure.
This type has no public fields.
text_context_menupub fn text_context_menu(context &draw.Context,identity &ui.CanvasEvent,id int) TextContextMenuText context menu.
context &draw.Contextidentity &ui.CanvasEventid intTextContextMenu — a value of this type
(&TextContextMenu) is_openpub fn (m &TextContextMenu) is_open() boolReturn whether the overlay, menu or dialog is currently open.
m &TextContextMenuTextContextMenu instance used by this call (borrow).bool — true or false
(&TextContextMenu) needs_paintpub fn (m &TextContextMenu) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
m &TextContextMenuTextContextMenu instance used by this call (borrow).bool — true or false
($&TextContextMenu) paintedpub fn (m $&TextContextMenu) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).This call does not return a value.
(&TextContextMenu) popup_boundspub fn (m &TextContextMenu) popup_bounds() layout.RectOperation on &TextContextMenu: popup bounds.
m &TextContextMenuTextContextMenu instance used by this call (borrow).layout.Rect — a value of this type
($&TextContextMenu) disposepub fn (m $&TextContextMenu) dispose()Release and dispose native resources and underlying handles.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).This call does not return a value.
(&TextContextMenu) clone_menupub fn (m &TextContextMenu) clone_menu() TextContextMenuOperation on &TextContextMenu: clone menu.
m &TextContextMenuTextContextMenu instance used by this call (borrow).TextContextMenu — a value of this type
($&TextContextMenu) set_localepub fn (m $&TextContextMenu) set_locale(locale &Locale) intOperation on $&TextContextMenu: set locale. Throws on failure; handle the error or propagate it to the caller.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&TextContextMenu) set_zhpub fn (m $&TextContextMenu) set_zh(zh bool)Operation on $&TextContextMenu: set zh.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).zh boolThis call does not return a value.
($&TextContextMenu) set_viewportpub fn (m $&TextContextMenu) set_viewport(viewport &layout.Rect)Operation on $&TextContextMenu: set viewport.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&TextContextMenu) openpub fn (m $&TextContextMenu) open(x f64,y f64,spec &TextMenuSpec,density f64) boolOperation on $&TextContextMenu: open resource or establish connection.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).x f64y f64spec &TextMenuSpecdensity f64bool — true or false
($&TextContextMenu) closepub fn (m $&TextContextMenu) close() boolOperation on $&TextContextMenu: close the resource.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).bool — true or false
($&TextContextMenu) inputpub fn (m $&TextContextMenu) input(event &ui.InputEvent,density f64) TextMenuResultProcess routed mouse, keyboard, or touch input events.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).event &ui.InputEventdensity f64TextMenuResult — a value of this type
($&TextContextMenu) paint_styledpub fn (m $&TextContextMenu) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&TextContextMenu: paint styled. Throws on failure; handle the error or propagate it to the caller.
m $&TextContextMenuTextContextMenu instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
paint_text_context_menu_errpub fn paint_text_context_menu_err(m $&TextContextMenu,frame $&draw.Frame,styles &Styles) stringPaint text context menu err.
m $&TextContextMenuframe $&draw.Framestyles &Stylesstring — result string
struct ListTextAuxpub struct ListTextAux {
pub drag_start_x f64
pub drag_start_y f64
pub drag_moved bool
pub sel_row int
pub sel_col int
pub active_text string
pub row_text string
pub viewport layout.Rect
pub zh bool
pub selection TextSelectionEngine
pub menus map[int]TextContextMenu
pub cached_styles []Styles
}Structure encapsulating drag_start_x, drag_start_y, drag_moved, sel_row, sel_col.
drag_start_x f64drag_start_y f64drag_moved boolsel_row intsel_col intactive_text stringrow_text stringviewport layout.Rectzh boolselection TextSelectionEnginemenus map[int]TextContextMenucached_styles []Styleslist_text_aux_newpub fn list_text_aux_new(selectable bool) ListTextAuxList text aux new.
selectable boolListTextAux — a value of this type
(&ListTextAux) has_menupub fn (aux &ListTextAux) has_menu() boolOperation on &ListTextAux: whether it has menu.
aux &ListTextAuxListTextAux instance used by this call (borrow).bool — true or false
(&ListTextAux) is_menu_openpub fn (aux &ListTextAux) is_menu_open() boolOperation on &ListTextAux: whether it is menu open.
aux &ListTextAuxListTextAux instance used by this call (borrow).bool — true or false
(&ListTextAux) menu_boundspub fn (aux &ListTextAux) menu_bounds() layout.RectOperation on &ListTextAux: menu bounds.
aux &ListTextAuxListTextAux instance used by this call (borrow).layout.Rect — a value of this type
(&ListTextAux) menu_needs_paintpub fn (aux &ListTextAux) menu_needs_paint() boolOperation on &ListTextAux: menu needs paint.
aux &ListTextAuxListTextAux instance used by this call (borrow).bool — true or false
(&ListTextAux) has_selection_forpub fn (aux &ListTextAux) has_selection_for(row int,col int) boolOperation on &ListTextAux: whether it has selection for.
aux &ListTextAuxListTextAux instance used by this call (borrow).row intcol intbool — true or false
(&ListTextAux) sel_anchorpub fn (aux &ListTextAux) sel_anchor() intOperation on &ListTextAux: sel anchor.
aux &ListTextAuxListTextAux instance used by this call (borrow).int — a value of this type
(&ListTextAux) sel_focuspub fn (aux &ListTextAux) sel_focus() intOperation on &ListTextAux: sel focus.
aux &ListTextAuxListTextAux instance used by this call (borrow).int — a value of this type
(&ListTextAux) get_sel_rowpub fn (aux &ListTextAux) get_sel_row() intOperation on &ListTextAux: read sel row.
aux &ListTextAuxListTextAux instance used by this call (borrow).int — a value of this type
(&ListTextAux) get_sel_colpub fn (aux &ListTextAux) get_sel_col() intOperation on &ListTextAux: read sel col.
aux &ListTextAuxListTextAux instance used by this call (borrow).int — a value of this type
(&ListTextAux) has_active_textpub fn (aux &ListTextAux) has_active_text() boolOperation on &ListTextAux: whether it has active text.
aux &ListTextAuxListTextAux instance used by this call (borrow).bool — true or false
(&ListTextAux) get_active_textpub fn (aux &ListTextAux) get_active_text() stringOperation on &ListTextAux: read active text.
aux &ListTextAuxListTextAux instance used by this call (borrow).string — result string
(&ListTextAux) get_row_textpub fn (aux &ListTextAux) get_row_text() stringOperation on &ListTextAux: read row text.
aux &ListTextAuxListTextAux instance used by this call (borrow).string — result string
(&ListTextAux) selected_textpub fn (aux &ListTextAux) selected_text() stringOperation on &ListTextAux: selected text.
aux &ListTextAuxListTextAux instance used by this call (borrow).string — result string
(&ListTextAux) style_snapshotpub fn (aux &ListTextAux) style_snapshot() StylesOperation on &ListTextAux: style snapshot.
aux &ListTextAuxListTextAux instance used by this call (borrow).Styles — a value of this type
($&ListTextAux) set_styles_cachepub fn (aux $&ListTextAux) set_styles_cache(styles &Styles)Operation on $&ListTextAux: set styles cache.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).styles &StylesThis call does not return a value.
($&ListTextAux) ensure_menupub fn (aux $&ListTextAux) ensure_menu(context &draw.Context,identity &ui.CanvasEvent,id int)Operation on $&ListTextAux: ensure menu.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).context &draw.Contextidentity &ui.CanvasEventid intThis call does not return a value.
($&ListTextAux) set_zhpub fn (aux $&ListTextAux) set_zh(zh bool)Operation on $&ListTextAux: set zh.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).zh boolThis call does not return a value.
($&ListTextAux) set_viewportpub fn (aux $&ListTextAux) set_viewport(viewport &layout.Rect,context &draw.Context,identity &ui.CanvasEvent,id int)Operation on $&ListTextAux: set viewport.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).viewport &layout.Rectcontext &draw.Contextidentity &ui.CanvasEventid intThis call does not return a value.
($&ListTextAux) paintedpub fn (aux $&ListTextAux) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).This call does not return a value.
($&ListTextAux) close_menupub fn (aux $&ListTextAux) close_menu() boolOperation on $&ListTextAux: close menu.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).bool — true or false
($&ListTextAux) paint_menu_styledpub fn (aux $&ListTextAux) paint_menu_styled(frame $&draw.Frame,styles &Styles) intOperation on $&ListTextAux: paint menu styled. Throws on failure; handle the error or propagate it to the caller.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&ListTextAux) route_menupub fn (aux $&ListTextAux) route_menu(event &ui.InputEvent,density f64) TextMenuResultOperation on $&ListTextAux: route menu.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).event &ui.InputEventdensity f64TextMenuResult — a value of this type
($&ListTextAux) open_menupub fn (aux $&ListTextAux) open_menu(context &draw.Context,identity &ui.CanvasEvent,id int,x f64,y f64,show_row bool,density f64) boolOperation on $&ListTextAux: open menu.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).context &draw.Contextidentity &ui.CanvasEventid intx f64y f64show_row booldensity f64bool — true or false
($&ListTextAux) open_cached_menupub fn (aux $&ListTextAux) open_cached_menu(x f64,y f64,show_row bool,density f64) boolOperation on $&ListTextAux: open cached menu.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).x f64y f64show_row booldensity f64bool — true or false
($&ListTextAux) handle_menu_cmdpub fn (aux $&ListTextAux) handle_menu_cmd(cmd int,identity &ui.CanvasEvent) boolOperation on $&ListTextAux: handle menu cmd.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).cmd intidentity &ui.CanvasEventbool — true or false
($&ListTextAux) begin_pointerpub fn (aux $&ListTextAux) begin_pointer(text &string,row_text &string,idx int,row int,col int,event &ui.InputEvent) boolOperation on $&ListTextAux: begin pointer.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).text &stringrow_text &stringidx introw intcol intevent &ui.InputEventbool — true or false
($&ListTextAux) should_begin_dragpub fn (aux $&ListTextAux) should_begin_drag(x f64,y f64,density f64) boolOperation on $&ListTextAux: should begin drag.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).x f64y f64density f64bool — true or false
($&ListTextAux) drag_topub fn (aux $&ListTextAux) drag_to(idx int) boolOperation on $&ListTextAux: drag to.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).idx intbool — true or false
($&ListTextAux) end_pointerpub fn (aux $&ListTextAux) end_pointer() boolOperation on $&ListTextAux: end pointer.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).bool — true or false
($&ListTextAux) clear_selectionpub fn (aux $&ListTextAux) clear_selection() boolOperation on $&ListTextAux: clear selection.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).bool — true or false
($&ListTextAux) key_actionpub fn (aux $&ListTextAux) key_action(event &ui.InputEvent,identity &ui.CanvasEvent) intOperation on $&ListTextAux: key action.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).event &ui.InputEventidentity &ui.CanvasEventint — a value of this type
($&ListTextAux) disposepub fn (aux $&ListTextAux) dispose()Release and dispose native resources and underlying handles.
aux $&ListTextAuxListTextAux instance used by this call (exclusive borrow).This call does not return a value.
struct TimePickerpub struct TimePicker {
}A 24-hour segmented field. Editing changes the selected clock component, wraps within that component, and preserves the date and subsecond value.
This type has no public fields.
time_pickerpub fn time_picker(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value time.Time) TimePickerTime picker. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.Rectvalue time.TimeTimePicker — a value of this type
(&TimePicker) idpub fn (picker &TimePicker) id() intReturn the unique integer ID of the element or control.
picker &TimePickerTimePicker instance used by this call (borrow).int — a value of this type
(&TimePicker) boundspub fn (picker &TimePicker) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
picker &TimePickerTimePicker instance used by this call (borrow).layout.Rect — a value of this type
(&TimePicker) valuepub fn (picker &TimePicker) value() time.TimeExecute value on &TimePicker.
picker &TimePickerTimePicker instance used by this call (borrow).time.Time — a value of this type
(&TimePicker) selected_partpub fn (picker &TimePicker) selected_part() intOperation on &TimePicker: selected part.
picker &TimePickerTimePicker instance used by this call (borrow).int — a value of this type
(&TimePicker) is_selectablepub fn (picker &TimePicker) is_selectable() boolOperation on &TimePicker: whether it is selectable.
picker &TimePickerTimePicker instance used by this call (borrow).bool — true or false
($&TimePicker) set_selectablepub fn (picker $&TimePicker) set_selectable(selectable bool)Operation on $&TimePicker: set selectable.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&TimePicker) needs_paintpub fn (picker &TimePicker) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
picker &TimePickerTimePicker instance used by this call (borrow).bool — true or false
(&TimePicker) visual_statepub fn (picker &TimePicker) visual_state() intOperation on &TimePicker: visual state.
picker &TimePickerTimePicker instance used by this call (borrow).int — a value of this type
(&TimePicker) style_orpub fn (picker &TimePicker) style_or(styles &Styles) ControlStyleOperation on &TimePicker: style or.
picker &TimePickerTimePicker instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&TimePicker) set_stylepub fn (picker $&TimePicker) set_style(style &ControlStyle) intOperation on $&TimePicker: set style. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&TimePicker) set_valuepub fn (picker $&TimePicker) set_value(value time.Time) intOperation on $&TimePicker: set value. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).value time.Timeint — a value of this type
($&TimePicker) set_show_secondspub fn (picker $&TimePicker) set_show_seconds(show bool)Operation on $&TimePicker: set show seconds.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).show boolThis call does not return a value.
($&TimePicker) set_enabledpub fn (picker $&TimePicker) set_enabled(enabled bool)Operation on $&TimePicker: set enabled.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&TimePicker) set_read_onlypub fn (picker $&TimePicker) set_read_only(read_only bool) intOperation on $&TimePicker: set read only. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).read_only boolint — a value of this type
($&TimePicker) set_invalidpub fn (picker $&TimePicker) set_invalid(invalid bool)Operation on $&TimePicker: set invalid.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).invalid boolThis call does not return a value.
($&TimePicker) set_focuspub fn (picker $&TimePicker) set_focus(focused bool)Operation on $&TimePicker: set focus.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&TimePicker) set_boundspub fn (picker $&TimePicker) set_bounds(bounds &layout.Rect) intOperation on $&TimePicker: set bounds. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
(&TimePicker) part_boundspub fn (picker &TimePicker) part_bounds(part int) layout.RectOperation on &TimePicker: part bounds. Throws on failure; handle the error or propagate it to the caller.
picker &TimePickerTimePicker instance used by this call (borrow).part intlayout.Rect — a value of this type
($&TimePicker) inputpub fn (picker $&TimePicker) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&TimePicker) routepub fn (picker $&TimePicker) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&TimePicker) measure_styledpub fn (picker $&TimePicker) measure_styled(styles &Styles) layout.SizeOperation on $&TimePicker: measure styled. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&TimePicker) paint_styledpub fn (picker $&TimePicker) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&TimePicker: paint styled. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&TimePicker) disposepub fn (picker $&TimePicker) dispose()Release and dispose native resources and underlying handles.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).This call does not return a value.
($&TimePicker) set_12_hourpub fn (picker $&TimePicker) set_12_hour(enabled bool)Operation on $&TimePicker: set 12 hour.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
(&TimePicker) period_boundspub fn (picker &TimePicker) period_bounds() layout.RectOperation on &TimePicker: period bounds.
picker &TimePickerTimePicker instance used by this call (borrow).layout.Rect — a value of this type
($&TimePicker) apply_stylespub fn (picker $&TimePicker) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
picker $&TimePickerTimePicker instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
struct Toastpub struct Toast {
}One toast, with host-owned text and stacking. Lifetime zero is persistent. Hover/focus pauses expiry. tick/next_tick are explicit; idle toasts do no work.
This type has no public fields.
toastpub fn toast(identity &ui.CanvasEvent,id int,bounds &layout.Rect) ToastExecute toast. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intbounds &layout.RectToast — a value of this type
(&Toast) idpub fn (t &Toast) id() intReturn the unique integer ID of the element or control.
t &ToastToast instance used by this call (borrow).int — a value of this type
(&Toast) boundspub fn (t &Toast) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
t &ToastToast instance used by this call (borrow).layout.Rect — a value of this type
(&Toast) is_enabledpub fn (t &Toast) is_enabled() boolReturn whether the control is currently enabled.
t &ToastToast instance used by this call (borrow).bool — true or false
(&Toast) is_selectablepub fn (t &Toast) is_selectable() boolOperation on &Toast: whether it is selectable.
t &ToastToast instance used by this call (borrow).bool — true or false
($&Toast) set_selectablepub fn (t $&Toast) set_selectable(selectable bool)Operation on $&Toast: set selectable.
t $&ToastToast instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
($&Toast) set_action_widthpub fn (t $&Toast) set_action_width(width f64)Operation on $&Toast: set action width.
t $&ToastToast instance used by this call (exclusive borrow).width f64This call does not return a value.
(&Toast) text_boundspub fn (t &Toast) text_bounds() layout.RectOperation on &Toast: text bounds.
t &ToastToast instance used by this call (borrow).layout.Rect — a value of this type
($&Toast) set_textpub fn (t $&Toast) set_text(context &draw.Context,text &string) intOperation on $&Toast: set text. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).context &draw.Contexttext &stringint — a value of this type
($&Toast) set_viewportpub fn (t $&Toast) set_viewport(viewport &layout.Rect)Operation on $&Toast: set viewport.
t $&ToastToast instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&Toast) set_localepub fn (t $&Toast) set_locale(locale &Locale) intOperation on $&Toast: set locale. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).locale &Localeint — a value of this type
(&Toast) has_popup_openpub fn (t &Toast) has_popup_open() boolOperation on &Toast: whether it has popup open.
t &ToastToast instance used by this call (borrow).bool — true or false
(&Toast) popup_boundspub fn (t &Toast) popup_bounds() layout.RectOperation on &Toast: popup bounds.
t &ToastToast instance used by this call (borrow).layout.Rect — a value of this type
(&Toast) selected_textpub fn (t &Toast) selected_text() stringOperation on &Toast: selected text.
t &ToastToast instance used by this call (borrow).string — result string
(&Toast) copy_selectionpub fn (t &Toast) copy_selection() intOperation on &Toast: copy selection.
t &ToastToast instance used by this call (borrow).int — a value of this type
(&Toast) cursorpub fn (t &Toast) cursor() intExecute cursor on &Toast.
t &ToastToast instance used by this call (borrow).int — a value of this type
(&Toast) is_openpub fn (t &Toast) is_open() boolReturn whether the overlay, menu or dialog is currently open.
t &ToastToast instance used by this call (borrow).bool — true or false
(&Toast) is_visiblepub fn (t &Toast) is_visible() boolOperation on &Toast: whether it is visible.
t &ToastToast instance used by this call (borrow).bool — true or false
(&Toast) opacitypub fn (t &Toast) opacity() f64Execute opacity on &Toast.
t &ToastToast instance used by this call (borrow).f64 — a value of this type
(&Toast) needs_paintpub fn (t &Toast) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
t &ToastToast instance used by this call (borrow).bool — true or false
($&Toast) paintedpub fn (t $&Toast) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
t $&ToastToast instance used by this call (exclusive borrow).This call does not return a value.
(&Toast) close_boundspub fn (t &Toast) close_bounds() layout.RectOperation on &Toast: close bounds.
t &ToastToast instance used by this call (borrow).layout.Rect — a value of this type
($&Toast) set_boundspub fn (t $&Toast) set_bounds(bounds &layout.Rect) intOperation on $&Toast: set bounds. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&Toast) showpub fn (t $&Toast) show(now time.Instant,lifetime time.Duration,reduced_motion bool) intExecute show on $&Toast. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).now time.Instantlifetime time.Durationreduced_motion boolint — a value of this type
($&Toast) dismisspub fn (t $&Toast) dismiss(now time.Instant,reduced_motion bool) intExecute dismiss on $&Toast. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).now time.Instantreduced_motion boolint — a value of this type
($&Toast) set_enabledpub fn (t $&Toast) set_enabled(enabled bool) intOperation on $&Toast: set enabled. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).enabled boolint — a value of this type
($&Toast) set_focuspub fn (t $&Toast) set_focus(focused bool,now time.Instant) intOperation on $&Toast: set focus. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).focused boolnow time.Instantint — a value of this type
($&Toast) inputpub fn (t $&Toast) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Toast) routepub fn (t $&Toast) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Toast) tickpub fn (t $&Toast) tick(now time.Instant,reduced_motion bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).now time.Instantreduced_motion boolbool — true or false
(&Toast) next_tickpub fn (t &Toast) next_tick(now time.Instant) time.InstantOperation on &Toast: next tick. Throws on failure; handle the error or propagate it to the caller.
t &ToastToast instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
(&Toast) paint_styledpub fn (t &Toast) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Toast: paint styled. Throws on failure; handle the error or propagate it to the caller.
t &ToastToast instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
($&Toast) paint_content_styledpub fn (t $&Toast) paint_content_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Toast: paint content styled. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Toast) paint_aux_textpub fn (t $&Toast) paint_aux_text(frame $&draw.Frame,bounds &layout.Rect,styles &Styles) intOperation on $&Toast: paint aux text. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).frame $&draw.Framebounds &layout.Rectstyles &Stylesint — a value of this type
($&Toast) paint_popup_styledpub fn (t $&Toast) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Toast: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&Toast) style_orpub fn (t &Toast) style_or(styles &Styles) ControlStyleOperation on &Toast: style or.
t &ToastToast instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&Toast) set_stylepub fn (t $&Toast) set_style(style &ControlStyle) intOperation on $&Toast: set style. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Toast) set_motionpub fn (t $&Toast) set_motion(spec &MotionSpec) intOperation on $&Toast: set motion. Throws on failure; handle the error or propagate it to the caller.
t $&ToastToast instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
const NOTICE_NORMALpub const NOTICE_NORMAL = 0Constant NOTICE_NORMAL, defining protocol or algorithm parameters.
const NOTICE_IMPORTANTpub const NOTICE_IMPORTANT = 1Constant NOTICE_IMPORTANT, defining protocol or algorithm parameters.
const ACTION_NOTICE_ACTIONpub const ACTION_NOTICE_ACTION = 9Constant ACTION_NOTICE_ACTION, defining protocol or algorithm parameters.
struct Noticepub struct Notice {
pub key string
pub text string
pub action string
pub lifetime time.Duration
pub priority int
}Structure encapsulating key, text, action, lifetime, priority.
key stringtext stringaction stringlifetime time.Durationpriority intnoticepub fn notice(text &string) NoticeExecute notice.
text &stringNotice — a value of this type
struct NoticeRecordpub struct NoticeRecord {
pub token int
pub key string
pub text string
pub action string
pub lifetime time.Duration
pub priority int
}Structure encapsulating token, key, text, action, lifetime.
token intkey stringtext stringaction stringlifetime time.Durationpriority intstruct ToastHostpub struct ToastHost {
}Bounded, stable-priority queue. Expiry starts when a renderer displays a record, never while it is waiting. Keys replace pending copies in place.
This type has no public fields.
toast_hostpub fn toast_host() ToastHostToast host.
No arguments are required.
ToastHost — a value of this type
(&ToastHost) pending_countpub fn (host &ToastHost) pending_count() intOperation on &ToastHost: pending count.
host &ToastHostToastHost instance used by this call (borrow).int — a value of this type
($&ToastHost) set_capacitypub fn (host $&ToastHost) set_capacity(capacity int) intOperation on $&ToastHost: set capacity. Throws on failure; handle the error or propagate it to the caller.
host $&ToastHostToastHost instance used by this call (exclusive borrow).capacity intint — a value of this type
($&ToastHost) enqueuepub fn (host $&ToastHost) enqueue(value &Notice) intExecute enqueue on $&ToastHost. Throws on failure; handle the error or propagate it to the caller.
host $&ToastHostToastHost instance used by this call (exclusive borrow).value &Noticeint — a value of this type
($&ToastHost) next_noticepub fn (host $&ToastHost) next_notice() NoticeRecordOperation on $&ToastHost: next notice. Throws on failure; handle the error or propagate it to the caller.
host $&ToastHostToastHost instance used by this call (exclusive borrow).NoticeRecord — a value of this type
($&Screen) enqueue_noticepub fn (s $&Screen) enqueue_notice(value &Notice) intReturns a notice token; ACTION_NOTICE_ACTION carries this token in value. At most three toast controls are allocated for the lifetime of a Screen. Throws on failure; handle the error or propagate it to the caller.
s $&ScreenScreen instance used by this call (exclusive borrow).value &Noticeint — a value of this type
(&Screen) notice_idspub fn (s &Screen) notice_ids() []intStable control IDs allocated lazily by enqueue_notice. The caller owns the returned snapshot and can register notice actions without borrowing Screen.
s &ScreenScreen instance used by this call (borrow).[]int — slice result
struct Tooltippub struct Tooltip {
}The host forwards anchor pointer/focus events and calls tick at next_tick. No polling task is started. Geometry is in full canvas coordinates.
This type has no public fields.
tooltippub fn tooltip(identity &ui.CanvasEvent,id int,anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) TooltipExecute tooltip. Throws on failure; handle the error or propagate it to the caller.
identity &ui.CanvasEventid intanchor &layout.Rectsize &layout.Sizeviewport &layout.RectTooltip — a value of this type
(&Tooltip) idpub fn (t &Tooltip) id() intReturn the unique integer ID of the element or control.
t &TooltipTooltip instance used by this call (borrow).int — a value of this type
(&Tooltip) boundspub fn (t &Tooltip) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
t &TooltipTooltip instance used by this call (borrow).layout.Rect — a value of this type
(&Tooltip) is_enabledpub fn (t &Tooltip) is_enabled() boolReturn whether the control is currently enabled.
t &TooltipTooltip instance used by this call (borrow).bool — true or false
(&Tooltip) is_selectablepub fn (t &Tooltip) is_selectable() boolOperation on &Tooltip: whether it is selectable.
t &TooltipTooltip instance used by this call (borrow).bool — true or false
($&Tooltip) set_selectablepub fn (t $&Tooltip) set_selectable(selectable bool)Operation on $&Tooltip: set selectable.
t $&TooltipTooltip instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
($&Tooltip) set_textpub fn (t $&Tooltip) set_text(context &draw.Context,text &string) intOperation on $&Tooltip: set text. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).context &draw.Contexttext &stringint — a value of this type
(&Tooltip) has_popup_openpub fn (t &Tooltip) has_popup_open() boolOperation on &Tooltip: whether it has popup open.
t &TooltipTooltip instance used by this call (borrow).bool — true or false
(&Tooltip) popup_boundspub fn (t &Tooltip) popup_bounds() layout.RectOperation on &Tooltip: popup bounds.
t &TooltipTooltip instance used by this call (borrow).layout.Rect — a value of this type
(&Tooltip) selected_textpub fn (t &Tooltip) selected_text() stringOperation on &Tooltip: selected text.
t &TooltipTooltip instance used by this call (borrow).string — result string
(&Tooltip) copy_selectionpub fn (t &Tooltip) copy_selection() intOperation on &Tooltip: copy selection.
t &TooltipTooltip instance used by this call (borrow).int — a value of this type
(&Tooltip) cursorpub fn (t &Tooltip) cursor() intExecute cursor on &Tooltip.
t &TooltipTooltip instance used by this call (borrow).int — a value of this type
($&Tooltip) set_viewportpub fn (t $&Tooltip) set_viewport(viewport &layout.Rect)Operation on $&Tooltip: set viewport.
t $&TooltipTooltip instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&Tooltip) set_localepub fn (t $&Tooltip) set_locale(locale &Locale) intOperation on $&Tooltip: set locale. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).locale &Localeint — a value of this type
(&Tooltip) is_openpub fn (t &Tooltip) is_open() boolReturn whether the overlay, menu or dialog is currently open.
t &TooltipTooltip instance used by this call (borrow).bool — true or false
(&Tooltip) is_visiblepub fn (t &Tooltip) is_visible() boolOperation on &Tooltip: whether it is visible.
t &TooltipTooltip instance used by this call (borrow).bool — true or false
(&Tooltip) opacitypub fn (t &Tooltip) opacity() f64Execute opacity on &Tooltip.
t &TooltipTooltip instance used by this call (borrow).f64 — a value of this type
(&Tooltip) needs_paintpub fn (t &Tooltip) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
t &TooltipTooltip instance used by this call (borrow).bool — true or false
($&Tooltip) paintedpub fn (t $&Tooltip) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
t $&TooltipTooltip instance used by this call (exclusive borrow).This call does not return a value.
($&Tooltip) set_delaypub fn (t $&Tooltip) set_delay(delay time.Duration) intOperation on $&Tooltip: set delay. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).delay time.Durationint — a value of this type
($&Tooltip) set_geometrypub fn (t $&Tooltip) set_geometry(anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) intOperation on $&Tooltip: set geometry. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).anchor &layout.Rectsize &layout.Sizeviewport &layout.Rectint — a value of this type
($&Tooltip) set_placementpub fn (t $&Tooltip) set_placement(placement &OverlayPlacement) intOperation on $&Tooltip: set placement. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).placement &OverlayPlacementint — a value of this type
($&Tooltip) set_enabledpub fn (t $&Tooltip) set_enabled(enabled bool) intOperation on $&Tooltip: set enabled. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).enabled boolint — a value of this type
($&Tooltip) set_blockedpub fn (t $&Tooltip) set_blocked(blocked bool,now time.Instant) intInteractive surfaces take priority over passive help. Suspend immediately, retain the logical trigger, and require a fresh delay when the surface exits. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).blocked boolnow time.Instantint — a value of this type
($&Tooltip) set_focuspub fn (t $&Tooltip) set_focus(focused bool,now time.Instant) intOperation on $&Tooltip: set focus. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).focused boolnow time.Instantint — a value of this type
($&Tooltip) dismisspub fn (t $&Tooltip) dismiss(now time.Instant,reduced_motion bool) intExecute dismiss on $&Tooltip. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).now time.Instantreduced_motion boolint — a value of this type
($&Tooltip) inputpub fn (t $&Tooltip) input(event &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).event &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Tooltip) routepub fn (t $&Tooltip) route(kind int,event &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).kind intevent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Tooltip) tickpub fn (t $&Tooltip) tick(now time.Instant,reduced_motion bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).now time.Instantreduced_motion boolbool — true or false
(&Tooltip) next_tickpub fn (t &Tooltip) next_tick(now time.Instant) time.InstantOperation on &Tooltip: next tick. Throws on failure; handle the error or propagate it to the caller.
t &TooltipTooltip instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
(&Tooltip) paint_styledpub fn (t &Tooltip) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) intOperation on &Tooltip: paint styled. Throws on failure; handle the error or propagate it to the caller.
t &TooltipTooltip instance used by this call (borrow).frame $&draw.Framelabel $&StyledLabelstyles &Stylesint — a value of this type
($&Tooltip) paint_content_styledpub fn (t $&Tooltip) paint_content_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Tooltip: paint content styled. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Tooltip) paint_popup_styledpub fn (t $&Tooltip) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&Tooltip: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
($&Tooltip) set_stylepub fn (t $&Tooltip) set_style(style &ControlStyle) intOperation on $&Tooltip: set style. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&Tooltip) set_motionpub fn (t $&Tooltip) set_motion(spec &MotionSpec) intOperation on $&Tooltip: set motion. Throws on failure; handle the error or propagate it to the caller.
t $&TooltipTooltip instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
const ACTION_ITEM_ACTIONpub const ACTION_ITEM_ACTION = 6Constant ACTION_ITEM_ACTION, defining protocol or algorithm parameters.
($&TreeView) set_appearancepub fn (t $&TreeView) set_appearance(a &TreeAppearance) intOperation on $&TreeView: set appearance. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).a &TreeAppearanceint — a value of this type
($&TreeView) set_motionpub fn (t $&TreeView) set_motion(spec &MotionSpec) intOperation on $&TreeView: set motion. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).spec &MotionSpecint — a value of this type
($&TreeView) set_metadatapub fn (t $&TreeView) set_metadata(node int,text &string) intOperation on $&TreeView: set metadata. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).node inttext &stringint — a value of this type
($&TreeView) set_iconpub fn (t $&TreeView) set_icon(node int,icon int) intOperation on $&TreeView: set icon. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).node inticon intint — a value of this type
($&TreeView) set_actionpub fn (t $&TreeView) set_action(node int,enabled bool) intOperation on $&TreeView: set action. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).node intenabled boolint — a value of this type
($&TreeView) begin_updatepub fn (t $&TreeView) begin_update() intOperation on $&TreeView: begin update. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).int — a value of this type
($&TreeView) end_updatepub fn (t $&TreeView) end_update() intOperation on $&TreeView: end update. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).int — a value of this type
($&TreeView) set_filterpub fn (t $&TreeView) set_filter(query &string) intOperation on $&TreeView: set filter. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).query &stringint — a value of this type
($&TreeView) reveal_selectedpub fn (t $&TreeView) reveal_selected() intOperation on $&TreeView: reveal selected. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).int — a value of this type
($&TreeView) find_nextpub fn (t $&TreeView) find_next(prefix &string) boolUnicode committed text can be passed by the application; raw key events are used only for ASCII type-ahead, never for IME composition. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).prefix &stringbool — true or false
($&TreeView) tickpub fn (t $&TreeView) tick(now time.Instant,reduced_motion bool) boolAdvance animation clock and state transition step. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).now time.Instantreduced_motion boolbool — true or false
(&TreeView) next_tickpub fn (t &TreeView) next_tick(now time.Instant) time.InstantOperation on &TreeView: next tick. Throws on failure; handle the error or propagate it to the caller.
t &TreeViewTreeView instance used by this call (borrow).now time.Instanttime.Instant — a value of this type
(&TreeView) action_boundspub fn (t &TreeView) action_bounds(row int) layout.RectOperation on &TreeView: action bounds.
t &TreeViewTreeView instance used by this call (borrow).row intlayout.Rect — a value of this type
($&TreeView) row_label_rectpub fn (t $&TreeView) row_label_rect(row int,c &ControlStyle,styles &Styles) layout.RectOperation on $&TreeView: row label rectangle.
t $&TreeViewTreeView instance used by this call (exclusive borrow).row intc &ControlStylestyles &Styleslayout.Rect — a value of this type
($&TreeView) paint_styledpub fn (t $&TreeView) paint_styled(frame $&draw.Frame,styles &Styles) intOperation on $&TreeView: paint styled. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
struct TreeViewpub struct TreeView {
}Up to 512 nodes, depth <= 32. add(-1, label) appends a root; other parents must be an earlier node index. Indices stay stable until clear. Children are shown in insertion order, even when they are appended after siblings.
This type has no public fields.
tree_viewpub fn tree_view(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect) TreeViewTree view. Throws on failure; handle the error or propagate it to the caller.
context &draw.Contextidentity &ui.CanvasEventid intbounds &layout.RectTreeView — a value of this type
(&TreeView) idpub fn (t &TreeView) id() intReturn the unique integer ID of the element or control.
t &TreeViewTreeView instance used by this call (borrow).int — a value of this type
(&TreeView) boundspub fn (t &TreeView) bounds() layout.RectReturn the bounding Rectangle of the control or geometry.
t &TreeViewTreeView instance used by this call (borrow).layout.Rect — a value of this type
(&TreeView) countpub fn (t &TreeView) count() intReturn the number of items in this control.
t &TreeViewTreeView instance used by this call (borrow).int — a value of this type
(&TreeView) visible_countpub fn (t &TreeView) visible_count() intOperation on &TreeView: visible count.
t &TreeViewTreeView instance used by this call (borrow).int — a value of this type
(&TreeView) selectedpub fn (t &TreeView) selected() intGet or test the currently selected index, node, or state.
t &TreeViewTreeView instance used by this call (borrow).int — a value of this type
(&TreeView) is_expandedpub fn (t &TreeView) is_expanded(node int) boolOperation on &TreeView: whether it is expanded. Throws on failure; handle the error or propagate it to the caller.
t &TreeViewTreeView instance used by this call (borrow).node intbool — true or false
(&TreeView) parentpub fn (t &TreeView) parent(node int) intExecute parent on &TreeView. Throws on failure; handle the error or propagate it to the caller.
t &TreeViewTreeView instance used by this call (borrow).node intint — a value of this type
(&TreeView) textpub fn (t &TreeView) text(node int) stringOperation on &TreeView: return the current text. Throws on failure; handle the error or propagate it to the caller.
t &TreeViewTreeView instance used by this call (borrow).node intstring — result string
(&TreeView) visible_nodepub fn (t &TreeView) visible_node(index int) intOperation on &TreeView: visible node. Throws on failure; handle the error or propagate it to the caller.
t &TreeViewTreeView instance used by this call (borrow).index intint — a value of this type
(&TreeView) needs_paintpub fn (t &TreeView) needs_paint() boolReturn whether the control needs repainting; call painted after painting to clear the flag.
t &TreeViewTreeView instance used by this call (borrow).bool — true or false
($&TreeView) paintedpub fn (t $&TreeView) painted()Acknowledge the painted frame and clear the dirty flag; this is not a query.
t $&TreeViewTreeView instance used by this call (exclusive borrow).This call does not return a value.
(&TreeView) is_selectablepub fn (t &TreeView) is_selectable() boolOperation on &TreeView: whether it is selectable.
t &TreeViewTreeView instance used by this call (borrow).bool — true or false
($&TreeView) set_selectablepub fn (t $&TreeView) set_selectable(selectable bool)Operation on $&TreeView: set selectable.
t $&TreeViewTreeView instance used by this call (exclusive borrow).selectable boolThis call does not return a value.
(&TreeView) has_popup_openpub fn (t &TreeView) has_popup_open() boolOperation on &TreeView: whether it has popup open.
t &TreeViewTreeView instance used by this call (borrow).bool — true or false
(&TreeView) popup_boundspub fn (t &TreeView) popup_bounds() layout.RectOperation on &TreeView: popup bounds.
t &TreeViewTreeView instance used by this call (borrow).layout.Rect — a value of this type
(&TreeView) selected_textpub fn (t &TreeView) selected_text() stringOperation on &TreeView: selected text.
t &TreeViewTreeView instance used by this call (borrow).string — result string
($&TreeView) set_localepub fn (t $&TreeView) set_locale(locale &Locale) intOperation on $&TreeView: set locale. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).locale &Localeint — a value of this type
($&TreeView) set_viewportpub fn (t $&TreeView) set_viewport(viewport &layout.Rect)Operation on $&TreeView: set viewport.
t $&TreeViewTreeView instance used by this call (exclusive borrow).viewport &layout.RectThis call does not return a value.
($&TreeView) paint_popup_styledpub fn (t $&TreeView) paint_popup_styled(frame $&draw.Frame,styles &Styles) intOperation on $&TreeView: paint popup styled. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).frame $&draw.Framestyles &Stylesint — a value of this type
(&TreeView) cursorpub fn (t &TreeView) cursor() intExecute cursor on &TreeView.
t &TreeViewTreeView instance used by this call (borrow).int — a value of this type
(&TreeView) is_enabledpub fn (t &TreeView) is_enabled() boolReturn whether the control is currently enabled.
t &TreeViewTreeView instance used by this call (borrow).bool — true or false
(&TreeView) is_focusedpub fn (t &TreeView) is_focused() boolReturn whether the control currently has input focus.
t &TreeViewTreeView instance used by this call (borrow).bool — true or false
(&TreeView) is_read_onlypub fn (t &TreeView) is_read_only() boolOperation on &TreeView: whether it is read only.
t &TreeViewTreeView instance used by this call (borrow).bool — true or false
(&TreeView) scroll_offsetpub fn (t &TreeView) scroll_offset() f64Operation on &TreeView: scroll offset.
t &TreeViewTreeView instance used by this call (borrow).f64 — a value of this type
($&TreeView) cancelpub fn (t $&TreeView) cancel()Execute cancel on $&TreeView.
t $&TreeViewTreeView instance used by this call (exclusive borrow).This call does not return a value.
($&TreeView) set_focuspub fn (t $&TreeView) set_focus(focused bool)Operation on $&TreeView: set focus.
t $&TreeViewTreeView instance used by this call (exclusive borrow).focused boolThis call does not return a value.
($&TreeView) set_enabledpub fn (t $&TreeView) set_enabled(enabled bool)Operation on $&TreeView: set enabled.
t $&TreeViewTreeView instance used by this call (exclusive borrow).enabled boolThis call does not return a value.
($&TreeView) set_read_onlypub fn (t $&TreeView) set_read_only(value bool) intOperation on $&TreeView: set read only. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).value boolint — a value of this type
($&TreeView) addpub fn (t $&TreeView) add(parent int,text &string) intOperation on $&TreeView: add. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).parent inttext &stringint — a value of this type
($&TreeView) set_textpub fn (t $&TreeView) set_text(node int,text &string) intOperation on $&TreeView: set text. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).node inttext &stringint — a value of this type
($&TreeView) set_expandedpub fn (t $&TreeView) set_expanded(node int,expanded bool) intOperation on $&TreeView: set expanded. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).node intexpanded boolint — a value of this type
($&TreeView) set_selectedpub fn (t $&TreeView) set_selected(node int) intOperation on $&TreeView: set selected. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).node intint — a value of this type
($&TreeView) clearpub fn (t $&TreeView) clear() intClear all buffered or stored entries and internal state. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).int — a value of this type
($&TreeView) set_boundspub fn (t $&TreeView) set_bounds(bounds &layout.Rect) intOperation on $&TreeView: set bounds. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).bounds &layout.Rectint — a value of this type
($&TreeView) set_scroll_offsetpub fn (t $&TreeView) set_scroll_offset(offset f64) intOperation on $&TreeView: set scroll offset. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).offset f64int — a value of this type
(&TreeView) style_orpub fn (t &TreeView) style_or(styles &Styles) ControlStyleOperation on &TreeView: style or.
t &TreeViewTreeView instance used by this call (borrow).styles &StylesControlStyle — a value of this type
($&TreeView) set_stylepub fn (t $&TreeView) set_style(style &ControlStyle) intOperation on $&TreeView: set style. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).style &ControlStyleint — a value of this type
($&TreeView) clear_stylepub fn (t $&TreeView) clear_style()Operation on $&TreeView: clear style.
t $&TreeViewTreeView instance used by this call (exclusive borrow).This call does not return a value.
($&TreeView) apply_stylespub fn (t $&TreeView) apply_styles(styles &Styles) intResolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).styles &Stylesint — a value of this type
(&TreeView) row_boundspub fn (t &TreeView) row_bounds(index int) layout.RectOperation on &TreeView: row bounds.
t &TreeViewTreeView instance used by this call (borrow).index intlayout.Rect — a value of this type
(&TreeView) node_row_textpub fn (t &TreeView) node_row_text(node int) stringOperation on &TreeView: node row text.
t &TreeViewTreeView instance used by this call (borrow).node intstring — result string
($&TreeView) inputpub fn (t $&TreeView) input(input &ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).input &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&TreeView) routepub fn (t $&TreeView) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&TreeView) eventpub fn (t $&TreeView) event(event &ui.Event) ActionHandle and respond to window or system lifecycle and interaction events. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).event &ui.EventAction — input result with kind, id, repaint and focus requests.
($&TreeView) measure_styledpub fn (t $&TreeView) measure_styled(styles &Styles) layout.SizeOperation on $&TreeView: measure styled. Throws on failure; handle the error or propagate it to the caller.
t $&TreeViewTreeView instance used by this call (exclusive borrow).styles &Styleslayout.Size — a value of this type
($&TreeView) disposepub fn (t $&TreeView) dispose()Release and dispose native resources and underlying handles.
t $&TreeViewTreeView instance used by this call (exclusive borrow).This call does not return a value.
struct@ Painterpub struct@ Painter {
fn paint(int,&layout.Rect,$&draw.Frame) bool
}Method-set constraint Painter.
paint fn paint(int,&layout.Rect,$&draw.Frame) bool(Painter) paintfn paint(int,&layout.Rect,$&draw.Frame) boolPaint the control visually onto the target canvas.
self SelfSelf instance used by this call (value receiver).int intrect &layout.Rectframe $&draw.Framebool — true or false
struct ViewStatspub struct ViewStats {
pub measured int
pub reused_layouts int
pub painted_nodes int
pub recorded_boundaries int
pub reused_boundaries int
pub frame_commands int
}Structure encapsulating measured, reused_layouts, painted_nodes, recorded_boundaries, reused_boundaries.
measured intreused_layouts intpainted_nodes intrecorded_boundaries intreused_boundaries intframe_commands intstruct Viewpub struct View {
}One retained scene per canvas. The application keeps its control/model state this owner keeps stable topology, measured geometry and vector paint caches. Paint callbacks receive node-local bounds, in the same logical coordinate system returned by local_input. They must not mutate the View or topology.
This type has no public fields.
(&Host) viewpub fn (host &Host) view(root_style &layout.BoxStyle,background draw.Color) ViewOperation on &Host: view. Throws on failure; handle the error or propagate it to the caller.
host &HostHost instance used by this call (borrow).root_style &layout.BoxStylebackground draw.ColorView — a value of this type
(&View) rootpub fn (view &View) root() intExecute root on &View.
view &ViewView instance used by this call (borrow).int — a value of this type
($&View) addpub fn (view $&View) add(parent int,style &layout.BoxStyle,intrinsic &layout.Size) intOperation on $&View: add. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).parent intstyle &layout.BoxStyleintrinsic &layout.Sizeint — a value of this type
(&View) containspub fn (view &View) contains(id int) boolOperation on &View: report whether the input contains the given piece.
view &ViewView instance used by this call (borrow).id intbool — true or false
(&View) stylepub fn (view &View) style(id int) layout.BoxStyleExecute style on &View. Throws on failure; handle the error or propagate it to the caller.
view &ViewView instance used by this call (borrow).id intlayout.BoxStyle — a value of this type
($&View) set_stylepub fn (view $&View) set_style(id int,style &layout.BoxStyle) intOperation on $&View: set style. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intstyle &layout.BoxStyleint — a value of this type
($&View) set_intrinsicpub fn (view $&View) set_intrinsic(id int,size &layout.Size) intOperation on $&View: set intrinsic. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intsize &layout.Sizeint — a value of this type
($&View) mark_paintpub fn (view $&View) mark_paint(id int) intOperation on $&View: mark paint. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intint — a value of this type
($&View) set_offsetpub fn (view $&View) set_offset(id int,x f64,y f64) intOperation on $&View: set offset. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intx f64y f64int — a value of this type
($&View) set_scrollpub fn (view $&View) set_scroll(id int,x f64,y f64) intScroll clamps its model offset to the content/viewport extent. Apply that value here after dispatch; the same translation drives paint and hit testing. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intx f64y f64int — a value of this type
($&View) set_boundarypub fn (view $&View) set_boundary(id int,enabled bool) intOperation on $&View: set boundary. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intenabled boolint — a value of this type
($&View) removepub fn (view $&View) remove(id int) intOperation on $&View: remove. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intint — a value of this type
($&View) disposepub fn (view $&View) dispose()Release and dispose native resources and underlying handles.
view $&ViewView instance used by this call (exclusive borrow).This call does not return a value.
($&View) eventpub fn (view $&View) event(event &ui.Event) boolCall from the owning window's event loop. Closing another window or a stale generation does not revoke this scene. Focus/editor cancellation is handled by the application's control state before/alongside this lifecycle hook. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).event &ui.Eventbool — true or false
($&View) set_backgroundpub fn (view $&View) set_background(color draw.Color)Operation on $&View: set background.
view $&ViewView instance used by this call (exclusive borrow).color draw.ColorThis call does not return a value.
(&View) needs_framepub fn (view &View) needs_frame() boolOperation on &View: needs frame.
view &ViewView instance used by this call (borrow).bool — true or false
($&View) layoutpub fn (view $&View) layout(constraints &layout.Constraints) layout.SizeExecute layout on $&View. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).constraints &layout.Constraintslayout.Size — a value of this type
(&View) node_boundspub fn (view &View) node_bounds(id int) layout.RectOperation on &View: node bounds. Throws on failure; handle the error or propagate it to the caller.
view &ViewView instance used by this call (borrow).id intlayout.Rect — a value of this type
(&View) hit_testpub fn (view &View) hit_test(x f64,y f64) intOperation on &View: hit test. Throws on failure; handle the error or propagate it to the caller.
view &ViewView instance used by this call (borrow).x f64y f64int — a value of this type
(&View) local_inputpub fn (view &View) local_input(id int,input &ui.InputEvent) ui.InputEventPointer capture/focus policy belongs to the controls. Route captured releases through this same transform even when hit_test returns a different node. Throws on failure; handle the error or propagate it to the caller.
view &ViewView instance used by this call (borrow).id intinput &ui.InputEventui.InputEvent — a value of this type
(&View) statspub fn (view &View) stats() ViewStatsExecute stats on &View.
view &ViewView instance used by this call (borrow).ViewStats — a value of this type
presentpub fn present#P:Painter(view $&View,constraints &layout.Constraints,painter $&P) boolReturns false without recording/submitting when layout and scene are current. A successful return acknowledges only the View. Control owners call painted after true; failed submissions keep the newly prepared records for cheap retry. Throws on failure; handle the error or propagate it to the caller.
view $&Viewconstraints &layout.Constraintspainter $&Pbool — true or false
snapshotpub fn snapshot#P:Painter(view $&View,constraints &layout.Constraints,scale f64,painter $&P) draw.SurfaceExport the same measured/recorded scene through the native Surface backend. Snapshotting does not acknowledge presentation to the window. A later present can reuse these records without invoking the painter again. Throws on failure; handle the error or propagate it to the caller.
view $&Viewconstraints &layout.Constraintsscale f64painter $&Pdraw.Surface — a value of this type
const ROUTE_INPUTpub const ROUTE_INPUT = 0Constant ROUTE_INPUT, defining protocol or algorithm parameters.
const ROUTE_FOCUSpub const ROUTE_FOCUS = 1Constant ROUTE_FOCUS, defining protocol or algorithm parameters.
const ROUTE_BLURpub const ROUTE_BLUR = 2Constant ROUTE_BLUR, defining protocol or algorithm parameters.
const ROUTE_CANCELpub const ROUTE_CANCEL = 3Constant ROUTE_CANCEL, defining protocol or algorithm parameters.
struct@ InputHandlerpub struct@ InputHandler {
fn input(int,int,&ui.InputEvent) Action
}Method-set constraint InputHandler.
input fn input(int,int,&ui.InputEvent) Action(InputHandler) inputfn input(int,int,&ui.InputEvent) ActionProcess routed mouse, keyboard, or touch input events.
self SelfSelf instance used by this call (value receiver).int intint intinputEvent &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Button) routepub fn (button $&Button) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
button $&ButtonButton instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Checkbox) routepub fn (checkbox $&Checkbox) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
checkbox $&CheckboxCheckbox instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Scroll) routepub fn (scroll $&Scroll) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
scroll $&ScrollScroll instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Switch) routepub fn (sw $&Switch) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
sw $&SwitchSwitch instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Radio) routepub fn (r $&Radio) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
r $&RadioRadio instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Slider) routepub fn (s $&Slider) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
s $&SliderSlider instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Tabs) routepub fn (t $&Tabs) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
t $&TabsTabs instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Select) routepub fn (sel $&Select) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
sel $&SelectSelect instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&Stepper) routepub fn (st $&Stepper) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
st $&StepperStepper instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&ListBox) routepub fn (lb $&ListBox) route(kind int,input &ui.InputEvent) ActionRoute and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.
lb $&ListBoxListBox instance used by this call (exclusive borrow).kind intinput &ui.InputEventAction — input result with kind, id, repaint and focus requests.
($&View) set_inputpub fn (view $&View) set_input(id int,enabled bool,focusable bool) intKeep this registration in sync with the model's enabled state. Focus order is tree order, and excludes hidden, fully clipped, zero-sized and disabled nodes. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intenabled boolfocusable boolint — a value of this type
($&View) set_capture_outsidepub fn (view $&View) set_capture_outside(id int,enabled bool) intEditors retain real drag coordinates outside their bounds. Buttons keep the clipped-hit policy so release through an occluder cannot activate them. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intenabled boolint — a value of this type
(&View) focusedpub fn (view &View) focused() intExecute focused on &View.
view &ViewView instance used by this call (borrow).int — a value of this type
(&View) capturedpub fn (view &View) captured() intExecute captured on &View.
view &ViewView instance used by this call (borrow).int — a value of this type
(&View) pointer_cursorpub fn (view &View) pointer_cursor() intOperation on &View: pointer cursor.
view &ViewView instance used by this call (borrow).int — a value of this type
($&View) set_cursorpub fn (view $&View) set_cursor(id int,cursor int) intOperation on $&View: set cursor. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intcursor intint — a value of this type
($&View) set_pointer_cursorpub fn (view $&View) set_pointer_cursor(cursor int) intCursor commands are scoped to this canvas generation and deduplicated. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).cursor intint — a value of this type
flush_inputpub fn flush_input#H:InputHandler(view $&View,handler $&H) intFlush removed/disabled targets using their old, never-reused IDs. The model handler may still clear retired control state; it must ignore unknown IDs. Throws on failure; handle the error or propagate it to the caller.
view $&Viewhandler $&Hint — a value of this type
cancel_inputpub fn cancel_input#H:InputHandler(view $&View,handler $&H) intCancel input. Throws on failure; handle the error or propagate it to the caller.
view $&Viewhandler $&Hint — a value of this type
dispatchpub fn dispatch#H:InputHandler(view $&View,input &ui.InputEvent,handler $&H) []ActionReturns semantic/consumed actions. Paint invalidation, hover, focus and primary pointer capture are maintained here; callbacks cannot mutate the View while it is borrowed. Apply effects on other model nodes after dispatch returns. Throws on failure; handle the error or propagate it to the caller.
view $&Viewinput &ui.InputEventhandler $&H[]Action — slice result
dispatch_eventpub fn dispatch_event#H:InputHandler(view $&View,event &ui.Event,handler $&H) []ActionDispatch event. Throws on failure; handle the error or propagate it to the caller.
view $&Viewevent &ui.Eventhandler $&H[]Action — slice result
const THEME_DARKpub const THEME_DARK = 0Constant THEME_DARK, defining protocol or algorithm parameters.
const THEME_LIGHTpub const THEME_LIGHT = 1Constant THEME_LIGHT, defining protocol or algorithm parameters.
const THEME_CONTRASTpub const THEME_CONTRAST = 2Constant THEME_CONTRAST, defining protocol or algorithm parameters.
preset_stylespub fn preset_styles(preset int) StylesPreset styles. Throws on failure; handle the error or propagate it to the caller.
preset intStyles — a value of this type
preset_namepub fn preset_name(preset int) stringPreset name. Throws on failure; handle the error or propagate it to the caller.
preset intstring — result string
next_presetpub fn next_preset(preset int) intNext preset. Throws on failure; handle the error or propagate it to the caller.
preset intint — a value of this type
struct StyleSwitcherpub struct StyleSwitcher {
}StyleSwitcher context or state structure.
This type has no public fields.
style_switcherpub fn style_switcher() StyleSwitcherStyle switcher.
No arguments are required.
StyleSwitcher — a value of this type
(&StyleSwitcher) currentpub fn (switcher &StyleSwitcher) current() intExecute current on &StyleSwitcher.
switcher &StyleSwitcherStyleSwitcher instance used by this call (borrow).int — a value of this type
(&StyleSwitcher) namepub fn (switcher &StyleSwitcher) name() stringExecute name on &StyleSwitcher.
switcher &StyleSwitcherStyleSwitcher instance used by this call (borrow).string — result string
(&StyleSwitcher) countpub fn (switcher &StyleSwitcher) count() intReturn the number of items in this control.
switcher &StyleSwitcherStyleSwitcher instance used by this call (borrow).int — a value of this type
(&StyleSwitcher) text_scalepub fn (switcher &StyleSwitcher) text_scale() f64Operation on &StyleSwitcher: text scale.
switcher &StyleSwitcherStyleSwitcher instance used by this call (borrow).f64 — a value of this type
(&StyleSwitcher) densitypub fn (switcher &StyleSwitcher) density() f64Execute density on &StyleSwitcher.
switcher &StyleSwitcherStyleSwitcher instance used by this call (borrow).f64 — a value of this type
(&StyleSwitcher) stylespub fn (switcher &StyleSwitcher) styles() StylesExecute styles on &StyleSwitcher.
switcher &StyleSwitcherStyleSwitcher instance used by this call (borrow).Styles — a value of this type
($&StyleSwitcher) use_presetpub fn (switcher $&StyleSwitcher) use_preset(index int) intOperation on $&StyleSwitcher: use preset. Throws on failure; handle the error or propagate it to the caller.
switcher $&StyleSwitcherStyleSwitcher instance used by this call (exclusive borrow).index intint — a value of this type
($&StyleSwitcher) use_namepub fn (switcher $&StyleSwitcher) use_name(name &string) intOperation on $&StyleSwitcher: use name. Throws on failure; handle the error or propagate it to the caller.
switcher $&StyleSwitcherStyleSwitcher instance used by this call (exclusive borrow).name &stringint — a value of this type
($&StyleSwitcher) nextpub fn (switcher $&StyleSwitcher) next() intOperation on $&StyleSwitcher: take the next item, or end according to this type.
switcher $&StyleSwitcherStyleSwitcher instance used by this call (exclusive borrow).int — a value of this type
($&StyleSwitcher) set_text_scalepub fn (switcher $&StyleSwitcher) set_text_scale(scale f64) intOperation on $&StyleSwitcher: set text scale. Throws on failure; handle the error or propagate it to the caller.
switcher $&StyleSwitcherStyleSwitcher instance used by this call (exclusive borrow).scale f64int — a value of this type
($&StyleSwitcher) set_densitypub fn (switcher $&StyleSwitcher) set_density(density f64) intOperation on $&StyleSwitcher: set density. Throws on failure; handle the error or propagate it to the caller.
switcher $&StyleSwitcherStyleSwitcher instance used by this call (exclusive borrow).density f64int — a value of this type
($&StyleSwitcher) set_presetpub fn (switcher $&StyleSwitcher) set_preset(index int,styles &Styles) intOperation on $&StyleSwitcher: set preset. Throws on failure; handle the error or propagate it to the caller.
switcher $&StyleSwitcherStyleSwitcher instance used by this call (exclusive borrow).index intstyles &Stylesint — a value of this type
($&StyleSwitcher) add_presetpub fn (switcher $&StyleSwitcher) add_preset(name &string,styles &Styles) intOperation on $&StyleSwitcher: add preset. Throws on failure; handle the error or propagate it to the caller.
switcher $&StyleSwitcherStyleSwitcher instance used by this call (exclusive borrow).name &stringstyles &Stylesint — a value of this type
(&StyleSwitcher) applypub fn (switcher &StyleSwitcher) apply(view $&View) intExecute apply on &StyleSwitcher. Throws on failure; handle the error or propagate it to the caller.
switcher &StyleSwitcherStyleSwitcher instance used by this call (borrow).view $&Viewint — a value of this type
($&StyleSwitcher) cyclepub fn (switcher $&StyleSwitcher) cycle(view $&View) intExecute cycle on $&StyleSwitcher. Throws on failure; handle the error or propagate it to the caller.
switcher $&StyleSwitcherStyleSwitcher instance used by this call (exclusive borrow).view $&Viewint — a value of this type
struct@ StyledPainterpub struct@ StyledPainter {
fn measure_styled(int,&Styles) layout.Size
fn paint_styled(int,&layout.Rect,&Styles,$&draw.Frame) bool
fn overlay_styled(int,&layout.Rect,&Styles,$&draw.Frame) bool
}Style-aware retained callbacks. Borrow the effective theme and paint in node-local coordinates. Do not mutate View or topology in callbacks. Overlay runs after children.
measure_styled fn measure_styled(int,&Styles) layout.SizeStyledPainter: measure styled.paint_styled fn paint_styled(int,&layout.Rect,&Styles,$&draw.Frame) boolStyledPainter: paint styled.overlay_styled fn overlay_styled(int,&layout.Rect,&Styles,$&draw.Frame) boolStyledPainter: overlay styled.(StyledPainter) measure_styledfn measure_styled(int,&Styles) layout.SizeOperation on StyledPainter: measure styled.
self SelfSelf instance used by this call (value receiver).int intstyles &Styleslayout.Size — a value of this type
(StyledPainter) paint_styledfn paint_styled(int,&layout.Rect,&Styles,$&draw.Frame) boolOperation on StyledPainter: paint styled.
self SelfSelf instance used by this call (value receiver).int intrect &layout.Rectstyles &Stylesframe $&draw.Framebool — true or false
(StyledPainter) overlay_styledfn overlay_styled(int,&layout.Rect,&Styles,$&draw.Frame) boolOperation on StyledPainter: overlay styled.
self SelfSelf instance used by this call (value receiver).int intrect &layout.Rectstyles &Stylesframe $&draw.Framebool — true or false
(&View) stylespub fn (view &View) styles() StylesExecute styles on &View. Throws on failure; handle the error or propagate it to the caller.
view &ViewView instance used by this call (borrow).Styles — a value of this type
(&View) has_style_scopepub fn (view &View) has_style_scope(id int) boolOperation on &View: whether it has style scope. Throws on failure; handle the error or propagate it to the caller.
view &ViewView instance used by this call (borrow).id intbool — true or false
($&View) invalidate_controlpub fn (view $&View) invalidate_control(id int) intOperation on $&View: invalidate control. Throws on failure; handle the error or propagate it to the caller.
view $&ViewView instance used by this call (exclusive borrow).id intint — a value of this type
(&View) styles_forpub fn (view &View) styles_for(id int) StylesReturn an owned clone of the complete theme inherited by the node.
view &ViewView instance used by this call (borrow).id intowned Styles; throws for an invalid node
($&View) set_stylespub fn (view $&View) set_styles(styles &Styles) intSet the root theme. Palette changes repaint; metric changes also remeasure registered nodes. Equal values are a no-op.
view $&ViewView instance used by this call (exclusive borrow).styles &Styles0 on success; throws on failure
($&View) set_style_scopepub fn (view $&View) set_style_scope(id int,styles &Styles) intStore a complete theme snapshot on a non-root node, inherited until another scope. Later global changes preserve it.
view $&ViewView instance used by this call (exclusive borrow).id intstyles &Styles0 on success; throws on failure
($&View) clear_style_scopepub fn (view $&View) clear_style_scope(id int) intRemove a local theme and restore inheritance, invalidating affected caches.
view $&ViewView instance used by this call (exclusive borrow).id int0 on success; throws on failure
($&View) set_style_measurepub fn (view $&View) set_style_measure(id int,on bool) intOpt a node into StyledPainter.measure_styled; enabling marks measurement dirty.
view $&ViewView instance used by this call (exclusive borrow).id inton bool0 on success; throws on failure
($&View) mark_measurepub fn (view $&View) mark_measure(id int) intCall after text or intrinsic size changes; marks paint dirty and remeasures registered nodes.
view $&ViewView instance used by this call (exclusive borrow).id int0 on success; throws on failure
layout_styledpub fn layout_styled#P:StyledPainter(view $&View,constraints &layout.Constraints,painter $&P) layout.SizeMeasure registered dirty nodes and run layout; synchronize editor placement afterward.
view $&Viewconstraints &layout.Constraintspainter $&Plaid-out root size; throws on failure
present_styledpub fn present_styled#P:StyledPainter(view $&View,constraints &layout.Constraints,painter $&P) boolLay out and present a dirty scene, reusing valid repaint boundaries; submit nothing when clean.
view $&Viewconstraints &layout.Constraintspainter $&Ptrue when submitted, false when clean; throws on failure
snapshot_styledpub fn snapshot_styled#P:StyledPainter(view $&View,constraints &layout.Constraints,scale f64,painter $&P) draw.SurfaceLay out and render into an offscreen Surface; scale selects raster resolution. The caller disposes the result.
view $&Viewconstraints &layout.Constraintsscale f64painter $&Pan owned Surface; throws on failure